Skip to content

otplib API Documentation / @otplib/core / validateSecret

Function: validateSecret()

validateSecret(secret, guardrails): void

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

Validate secret key

Parameters

secret

Uint8Array

The secret to validate

guardrails

OTPGuardrails = DEFAULT_GUARDRAILS

Validation guardrails (defaults to RFC recommendations)

Returns

void

Throws

If secret is too short

Throws

If secret is too long

Released under the MIT License.