Skip to content

otplib API Documentation / @otplib/core / utils / validateToken

Function: validateToken() ​

validateToken(token, digits): void

Defined in: packages/core/src/utils.ts:554

Validate token

Parameters ​

token ​

string

The token string to validate

digits ​

number

Expected number of digits

Returns ​

void

Throws ​

If token has incorrect length

Throws ​

If token contains non-digit characters

Released under the MIT License.