final class TotpSecret (View source)

Holds a canonical, minimum-strength Base32 TOTP secret without implicit string conversion.

Constants

MINIMUM_BYTES

Methods

static TotpSecret
fromBase32(string $value)

Imports a formatted Base32 secret and canonicalizes it after enforcing the enrollment minimum.

string

Exports the secret only through an explicit canonical Base32 operation for trusted consumers.

string
array

Redacts secret material from PHP debug dumps.

array
array

Refuses PHP serialization so secret material cannot be exported through object serialization.

array
void
__unserialize(array $data)

Refuses PHP unserialization because serialized TOTP secrets are never accepted by this contract.

void

Details

fromBase32

static TotpSecret fromBase32(string $value)

Imports a formatted Base32 secret and canonicalizes it after enforcing the enrollment minimum.

Parameters

string $value

Return Value

TotpSecret

Exceptions

InvalidTotpSecretException

toBase32

string toBase32()

Exports the secret only through an explicit canonical Base32 operation for trusted consumers.

Return Value

string

__debugInfo

array __debugInfo()

Redacts secret material from PHP debug dumps.

Return Value

array

__serialize

array __serialize()

Refuses PHP serialization so secret material cannot be exported through object serialization.

Return Value

array

Exceptions

LogicException

__unserialize

void __unserialize(array $data)

Refuses PHP unserialization because serialized TOTP secrets are never accepted by this contract.

Parameters

array $data

Serialized data rejected by this security boundary.

Return Value

void

Exceptions

LogicException