Skip to main content

Module api

Module api 

Source
Expand description

Server-side TOTP, backup-code, and QR-code helpers.

Enums§

TwoFactorServerError
Error states returned by server-side two-factor helpers.

Functions§

build_backup_codes
Generates a batch of randomized backup codes.
build_totp_secret
Generates a new TOTP secret and OTPAUTH URI for the account identifier.
build_totp_uri_from_secret
Builds an OTPAUTH URI for an existing Base32 TOTP secret.
render_qr_artifacts
Renders QR code artifacts for the provided OTPAUTH URI.
verify_totp_step
Returns the matching TOTP timestep at the current system time. The application must consume this step durably before granting access.
verify_totp_step_at
Returns the matching timestep for a supplied timestamp. Only the current 30-second step is accepted. No drift window is added.