Skip to content

otplib API Documentation / @otplib/core / validateCounter

Function: validateCounter()

validateCounter(counter, guardrails): void

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

Validate counter value

Parameters

counter

The counter to validate

number | bigint

guardrails

OTPGuardrails = DEFAULT_GUARDRAILS

Validation guardrails (defaults to RFC recommendations)

Returns

void

Throws

If counter is negative

Throws

If counter exceeds safe integer

Released under the MIT License.