Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function fixOtpKey(secret: string) {
return base32.stringify(base32.parse(secret, { loose: true }))
}
export function totp(
secret: string | void,
now: number = Date.now() / 1000
): string | void {
if (secret == null) return
return hotp(base32.parse(secret, { loose: true }), now / 30, 6)
}