totp
TOTP/HOTP 2FA, authenticator apps, backup codes.
Load with: use totp
Quick example
use totp
result = totps("hello")
prn(result)
Functions
Secret generation
totps()
Performs the operation.
totps(str_input)
Performs the operation. Takes str_input.
TOTP generation
totpn(secret, digits, period)
Performs the operation. Takes secret, digits, period.
totp(secret, counter)
Performs the operation. Takes secret, counter.
totpv(secret, code, window)
Performs the operation. Takes secret, code, window.
HOTP
hotpg(secret, counter, digits)
Performs the operation. Takes secret, counter, digits.
hotpv(secret, code, counter, window)
Performs the operation. Takes secret, code, counter, window.
QR code generation
totpq(issuer, account, secret, digits, period)
Performs the operation. Takes issuer, account, secret, digits, period.
hotpq(issuer, account, secret, counter)
Performs the operation. Takes issuer, account, secret, counter.
Backup codes
totpb(count)
Performs the operation. Takes count.
Time sync
totpt(ntp_server)
Performs the operation. Takes ntp_server.
Drift handling
totpc(secret, code, expected_step)
Performs the operation. Takes secret, code, expected_step.
Steam Guard
steam(shared_secret, time_offset)
Performs the operation. Takes shared_secret, time_offset.
Google Authenticator format
gauth(qr_data)
Performs the operation. Takes qr_data.
Authy import
authy(backup_file)
Performs the operation. Takes backup_file.
Multi-factor enrollment
mfaen(user_id, methods)
Encodes. Takes user_id, methods.
Verify MFA
verif(user_record, provided_codes)
Performs the operation. Takes user_record, provided_codes.
Rate limiting
mfara(attempts, max_attempts, window_secs)
Performs the operation. Takes attempts, max_attempts, window_secs.
Notes
- TOTP/HOTP one-time password generation and verification.