Skip to main content
verifySolution() is called server-side in your verify endpoint to check that the browser correctly solved all challenge tokens. It validates the JWT signature, token expiry, the hash proof, replay state, and optional context binding. Each token carries its own algorithm, so verifySolution() verifies SHA-256 and Argon2id proofs automatically with no extra options.

Import

Signature

Parameters

ChallengeToken | ChallengeToken[]
required
The original JWT token(s) returned by createChallenge(). Pass the same tokens your challenge endpoint issued.
number | string | Array<number | string> | ChallengeSolution | ChallengeSolution[]
required
The solution(s) submitted by the browser. Can be:
  • A single nonce string
  • An array of nonce strings
  • A ChallengeSolution object { nonce: string; hash: string }
  • An array of ChallengeSolution objects (what the widget sends as solutions)
VerifySolutionOptions
Optional configuration object. See the options table below.

Options

Return value

Promise<VerifySolutionResult>. The function returns either:
or

Examples

Basic usage:
With structured warning telemetry:
With a rate limiter and telemetry:
rateLimiter runs before token validation, so it protects the verify endpoint even when callers submit malformed input. onEvent fires only after verification completes; if rateLimiter rejects a request, no event is emitted.
Do not pass context: req.ip just to key the rate limiter. Close over the request instead, as shown above. When you pass context, the tokens must have been created with the identical context value or verification fails with context-mismatch.
With a remote replay store:

Warning reasons