OTP.
- RFC 6238 Time-Based One-Time Password Algorithm
- RFC 4226 HMAC-Based One-Time Password Algorithm
- Generate random base32 secret by RAND_bytes, or
- Use existing secret, base32 or plain text (internally converted to base32)
- Specify
X
(unix timestamp),T0
(start time) or compute based on current time - Specify hash algorithm
- Generate [key URI](Key Uri Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
- Generate QRCODE in .png or .svg format
hotp code based on archiecobbs/mod-authn-otp
var $params : Object
$params:={secret: "😣."; \
type: OTP Type totp; \
algorithm: OTP Algorithm SHA1; \
t0: 0; \
timestamp: 1708522781; \
period: 30; \
digits: 6; \
issuer: "github"; \
account: "[email protected]"}
$status:=OTP Generate($params)
ASSERT($status.base32_secret="6CPZRIZO")
ASSERT($status.otp="219145")
ASSERT($status.url="otpauth:https://totp/github%3Akeisuke.miyako%404d.com?issuer=github&secret=6CPZRIZO&algorithm=SHA1&digits=6&period=30")
SET PICTURE TO PASTEBOARD($status.qr)
var $params : Object
$params:={secret: "😣."; \
type: OTP Type hotp; \
algorithm: OTP Algorithm SHA1; \
counter: 1; \
digits: 6; \
issuer: "github"; \
account: "[email protected]"}
$status:=OTP Generate($params)
ASSERT($status.base32_secret="6CPZRIZO")
ASSERT($status.otp="912647")
ASSERT($status.url="otpauth:https://hotp/github%3Akeisuke.miyako%404d.com?issuer=github&secret=6CPZRIZO&algorithm=SHA1&digits=6&counter=1")
SET PICTURE TO PASTEBOARD($status.qr)
key | type | |
---|---|---|
secret | Text | if passed, internally encoded to base32_secret |
base32_secret | Text | |
type | Text | totp(default), hotp |
algorithm | Text | SHA1(default), SHA256, SHA512 |
digits | Integer | 6(default) |
period | Integer | 30(default), totp only |
t0 | Integer | 0(default), totp only |
timestamp | Integer | default=now, totp only |
counter | Integer | 0(default), hotp only |
- QR code options
key | type | |
---|---|---|
format | Text | .png(default), .svg |
size | Integer | 3(default) |
dpi | Integer | 72(default) |
margin | Integer | 0(default) |
version | Integer | 1(default) |
level | Integer | 0=L(default), 1=M, 2=Q, 3=H |
- BASE32 by Adrien Kunysz
- RFC3986 by dnmfarrell/URI-Encode-C
- qrencode by Kentaro Fukuchi