PlatformTotpVerifier
in package
implements
PlatformTotpVerifierInterface
Table of Contents
Interfaces
Properties
- $algorithm : string
- $clock : Closure
- $digits : int
- $period : int
- $secretStore : SecretStoreInterface
- $window : int
Methods
- __construct() : mixed
- Constructor.
- codeForTimestamp() : string
- Generate a TOTP code for test vectors and enrollment validation.
- isAvailable() : bool
- Return true when production-grade TOTP verification is available.
- matchingCounter() : int|null
- Return the matched moving factor; callers must atomically consume it.
- verify() : bool
- Verify only the code; authentication callers must consume the counter.
- codeForCounter() : string|null
- Generate the HOTP value for a moving factor counter.
- decodeBase32() : string
- Decode an RFC 4648 base32 secret without external dependencies.
Properties
$algorithm read-only
private
string
$algorithm
= 'sha1'
$clock
private
Closure
$clock
$digits read-only
private
int
$digits
= 6
$period read-only
private
int
$period
= 30
$secretStore read-only
private
SecretStoreInterface
$secretStore
$window read-only
private
int
$window
= 1
Methods
__construct()
Constructor.
public
__construct(SecretStoreInterface $secretStore[, int $window = 1 ][, int $period = 30 ][, int $digits = 6 ][, string $algorithm = 'sha1' ][, callable|null $clock = null ]) : mixed
Parameters
- $secretStore : SecretStoreInterface
- $window : int = 1
- $period : int = 30
- $digits : int = 6
- $algorithm : string = 'sha1'
- $clock : callable|null = null
codeForTimestamp()
Generate a TOTP code for test vectors and enrollment validation.
public
codeForTimestamp(SensitiveString|string $base32Secret, int $timestamp) : string
Parameters
- $base32Secret : SensitiveString|string
- $timestamp : int
Return values
stringisAvailable()
Return true when production-grade TOTP verification is available.
public
isAvailable() : bool
Tags
Return values
boolmatchingCounter()
Return the matched moving factor; callers must atomically consume it.
public
matchingCounter(string|null $totpSecretRef, string $totpCode) : int|null
Parameters
- $totpSecretRef : string|null
-
Secret-store reference for the user.
- $totpCode : string
-
User-provided TOTP code.
Return values
int|nullverify()
Verify only the code; authentication callers must consume the counter.
public
verify(string $platformUserId, string|null $totpSecretRef, string $totpCode) : bool
Parameters
- $platformUserId : string
- $totpSecretRef : string|null
- $totpCode : string
Tags
Return values
boolcodeForCounter()
Generate the HOTP value for a moving factor counter.
private
codeForCounter(SensitiveString $base32Secret, int $counter) : string|null
Parameters
- $base32Secret : SensitiveString
- $counter : int
Return values
string|nulldecodeBase32()
Decode an RFC 4648 base32 secret without external dependencies.
private
decodeBase32(string $secret) : string
Parameters
- $secret : string