\CryptoManana\Core\Traits\ContainersTokenAsymmetricTransformationTrait

Trait TokenAsymmetricTransformationTrait - Reusable implementation of `TokenTransformationInterface`.

Summary

Methods
Properties
Constants
generateAuthenticationToken()
extractAuthenticationToken()
$$randomnessSource
$$asymmetricCipherSource
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$$randomnessSource

$$randomnessSource : \CryptoManana\Core\Abstractions\Randomness\AbstractGenerator

The randomness generator.

Type

\CryptoManana\Core\Abstractions\Randomness\AbstractGenerator

$$asymmetricCipherSource

$$asymmetricCipherSource : \CryptoManana\Core\Abstractions\MessageEncryption\AbstractAsymmetricEncryptionAlgorithm|\CryptoManana\Core\Interfaces\MessageEncryption\DataEncryptionInterface|null

The message asymmetric encryption service.

Type

\CryptoManana\Core\Abstractions\MessageEncryption\AbstractAsymmetricEncryptionAlgorithm|\CryptoManana\Core\Interfaces\MessageEncryption\DataEncryptionInterface|null

Methods

generateAuthenticationToken()

generateAuthenticationToken(integer  $length = 64) : \CryptoManana\DataStructures\AuthenticationToken

Generate a secure token and create an encrypt representation.

Parameters

integer $length

The desired output string length in bytes (default => 64).

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\AuthenticationToken

The authentication token data structure object.

extractAuthenticationToken()

extractAuthenticationToken(string  $cipherToken) : string

Extracts the token from the cipher data via a predefined configuration.

Parameters

string $cipherToken

The encrypted token string.

Throws

\Exception

Validation errors.

Returns

string —

The decrypted authentication token.