Table of contents
Source: shared/code/tce_functions_otp.php
Functions for One Time Password (OTP).
Functions
F_checkOTPLogin()
Check a One Time Password submitted at login.
A valid code is stored in the sessions table for 5 minutes and is rejected while stored.
function F_checkOTPLogin(mixed $user_name, mixed $otpkey, mixed $code): bool
Parameters:
$user_name(mixed): (string) user name.$otpkey(mixed): (string) user’s One Time Password secret key (Base32 encoded).$code(mixed): (string) submitted code.
Returns: bool: true if the code is valid and not yet used, false otherwise.
Source: shared/code/tce_functions_otp.php:143
F_decodeBase32()
Decode a Base32 encoded string.
function F_decodeBase32(mixed $code): Decoded
Parameters:
$code(mixed): (string) Base32 code to be decoded.
Returns: Decoded: key.
Source: shared/code/tce_functions_otp.php:45
F_getOTP()
Get a One Time Password for the specified secret key.
function F_getOTP(mixed $otpkey, mixed $mtime = 0): OTP
Parameters:
$otpkey(mixed): (string) One Time Password secret key.$mtime(mixed): (int) Reference time in microseconds.
Returns: OTP
Source: shared/code/tce_functions_otp.php:75
F_getRandomOTPkey()
Return a random One Time Password Secret Key (Base32 encoded).
function F_getRandomOTPkey(): Base32
Returns: Base32: encoded key.
Source: shared/code/tce_functions_otp.php:27
F_isValidOTPCode()
Check a One Time Password code against a secret key.
The code must have 6 digits and match the key for the current, previous or next 30-second step.
function F_isValidOTPCode(mixed $otpkey, mixed $code, mixed $mtime = 0.0): bool
Parameters:
$otpkey(mixed): (string) One Time Password secret key (Base32 encoded).$code(mixed): (string) code to check.$mtime(mixed): (float) reference time in seconds (0 = current time).
Returns: bool: true if the code matches, false otherwise.