nio_google_authenticator v2.1.2 NioGoogleAuthenticator

This module provides simple wrapper functions to create secrets for Google Authenticator as well as validate them with a time based token.

Link to this section Summary

Functions

Creates a random Base 32 encoded string

Generates a valid token based on a secret

Creates a URL for a Google QR code that includes a secret, label, and issuer. Scanning this QR code in the Google Authenticator app allows the generation of validation tokens

Validates a given token based on a secret. You can pass the function a keyword list of the following options: token_length default 6 interval_length default 30 window default 0

Link to this section Functions

Link to this function generate_secret()

Creates a random Base 32 encoded string

Link to this function generate_token(secret)

Generates a valid token based on a secret

Link to this function generate_url(secret, label, issuer \\ default_issuer())

Creates a URL for a Google QR code that includes a secret, label, and issuer. Scanning this QR code in the Google Authenticator app allows the generation of validation tokens.

Link to this function validate_token(secret, token)

Validates a given token based on a secret. You can pass the function a keyword list of the following options: token_length default 6 interval_length default 30 window default 0

Returns {:ok, :pass} if the token is valid and {:error, :invalid_token} if it is not.

Link to this function validate_token(secret, token, options)