GetTOTPCode (open)
Generate a time-based one-time password
Syntax
LOADLIB "wh::util/otp.whlib";
STRING FUNCTION GetTOTPCode(STRING secret, RECORD options)Parameters
STRING secretThe key to use (raw byte value)
RECORD optionsOptions
INTEGER digitsThe length of the resulting password, range [6-8], defaults to 6
STRING hmacThe HMAC algorithm to use, defaults to "HMAC:SHA-1"
INTEGER intervalThe interval to use in seconds, defaults to 30
DATETIME nowThe timestamp to use as 'now', defaults to current date and time
DATETIME startThe timestamp to use as offset date and time, defaults to 1970-01-01T00:00Z
Return value
STRINGThe generated password
Description
This function generates a time-based one-time password. Please note that external applications may not support all of the options and will fallback to the defaults.