interface TotpInterface (View source)

Time-based one-time passwords, as used by authenticator apps.

Methods

string
generateSecret(int $length = 16)

No description

bool
verify(string $secret, string $code, int $window = 1)

No description

string
provisioningUri(string $issuer, string $account, string $secret)

The otpauth:// URI an authenticator app scans.

Details

string generateSecret(int $length = 16)

No description

Parameters

int $length

Secret length in bytes; 16 is what authenticator apps expect

Return Value

string

Base32-encoded secret

bool verify(string $secret, string $code, int $window = 1)

No description

Parameters

string $secret
string $code
int $window

How many periods either side of now are accepted, to tolerate a device clock that is slightly out of sync

Return Value

bool

string provisioningUri(string $issuer, string $account, string $secret)

The otpauth:// URI an authenticator app scans.

Parameters

string $issuer
string $account
string $secret

Return Value

string