Skip to main content

verifyTotp

@webda/core


Function: verifyTotp()

verifyTotp(secret, code, opts?): number

Defined in: packages/core/src/utils/totp.ts:149

Verify a TOTP code against a secret within an accepted time window

Parameters​

secret​

string | Buffer<ArrayBufferLike>

Base32 secret string or raw Buffer

code​

string

user-submitted OTP code

opts?​

TotpOptions & object

options including window (±steps) and now

Returns​

number

the matched time step if valid, or undefined