Latest
darkflare/authenticator
secret
Generate a new secret.
import * as Authenticator from 'darkflare/authenticator'
const secret = Authenticator.secret() // 64-character hexadecimal string
Parameters:
length
- number (optional)
token
Generate a new 6-digit numeric token.
import * as Authenticator from 'darkflare/authenticator'
const token = Authenticator.token(secret)
Parameters:
secret
- hexadecimal stringtimestamp
- number (optional)
uri
Generate a URI to use for e.g. a QR code to scan with Google Authenticator.
import * as Authenticator from 'darkflare/authenticator'
const uri = Authenticator.uri(label, issuer, secret)
Parameters:
label
- stringissuer
- stringsecret
- hexadecimal string
validate
Determine whether a 6-digit numeric token is valid.
import * as Authenticator from 'darkflare/authenticator'
Authenticator.validate(token, secret)
Parameters:
token
- stringsecret
- hexadecimal string