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
ChallengeSolutionobject{ nonce: string; hash: string } - An array of
ChallengeSolutionobjects (what the widget sends assolutions)
VerifySolutionOptions
Optional configuration object. See the options table below.
Options
Return value
Promise<VerifySolutionResult>. The function returns either:
Examples
Basic usage: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.