GetTOTPCode (open)
Generate a time-based one-time password
Syntax
LOADLIB "wh::util/otp.whlib";
STRING FUNCTION GetTOTPCode(STRING secret, RECORD options)
Parameters
STRING secret
The key to use (raw byte value)
RECORD options
Options
INTEGER digits
The length of the resulting password, range [6-8], defaults to 6
STRING hmac
The HMAC algorithm to use, defaults to "HMAC:SHA-1"
INTEGER interval
The interval to use in seconds, defaults to 30
DATETIME now
The timestamp to use as 'now', defaults to current date and time
DATETIME start
The timestamp to use as offset date and time, defaults to 1970-01-01T00:00Z
Return value
STRING
The 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.