ribaunt for use in your server-side code.
ChallengeToken
A signed JWT challenge token. This is the string value returned in the array from createChallenge() and the value you pass back to verifySolution().
ChallengeSolution
The proof-of-work solution produced by the browser solver (or by solveChallenge() in tests). The nonce is the value that, when hashed with the challenge string, produces a digest beginning with the required number of leading zero hex digits. The hash is SHA-256 or Argon2id depending on the token’s algorithm.
PowAlgorithm and ArgonProfile
PowAlgorithm selects the proof-of-work algorithm for createChallenge() and selectWorkload(). The default is 'sha256'; 'argon2id' is a memory-hard opt-in — see Argon2id opt-in.
ArgonProfile abstracts the raw Argon2id parameters so you never pass memory sizes yourself. It is only valid when the algorithm is 'argon2id'. Both profiles currently resolve to the same conservative parameters (m: 8192, t: 1, p: 1, hashLen: 32). Because each token embeds its own parameters and a construction version, choosing a tier now is safe: retuning in a future release cannot break in-flight tokens.
HARD_MAX is the library-enforced upper bound on Argon2id parameters. Tokens carrying parameters above these values are rejected with invalid-token, so a tampered token cannot force a browser to allocate unbounded memory.
ChallengeOptions
The options object accepted by createChallenge().
algorithm: 'argon2id', minDifficulty and maxDifficulty default to 1 and 2, and difficulty caps at 8 instead of 64.
ClientCalibration
Reported benchmark from the client used as a raise-only signal in "auto" mode.
Workload and AdaptiveWorkloadOptions
selectWorkload() returns a Workload object and accepts an optional adaptive configuration.
RiskSignals
Caller-supplied signals passed to assess(). All fields are optional and treated as untrusted. The index signature lets custom scorers consume application-specific keys; the default scorer ignores unknown keys.
RiskScorer
The interface you implement to replace the default risk heuristic in assess(). score() may be async so you can call a remote model or service. It must return a finite number from 0 to 100; otherwise, assess() rejects.
RiskThresholds and DEFAULT_RISK_THRESHOLDS
Decision boundaries for assess(). Validation requires 0 <= challenge < block <= 100; invalid thresholds throw instead of being silently repaired. DEFAULT_RISK_THRESHOLDS is a frozen object exported from ribaunt.
AssessOptions and AssessWorkloadOptions
The options object accepted by assess(). workload bounds are only used when the resulting action is challenge, but they are validated on every call. workload also accepts algorithm and argonProfile, which thread through to the generated Workload.
RiskAssessment
The result returned by assess(). risk is a bounded heuristic score, not a fraud probability. workload is present only when action is 'challenge' and is produced by the same selectWorkload() engine used for adaptive difficulty.
ReplayStore
The interface you implement to provide distributed replay prevention when replayPrevention is set to 'remote'. You pass your implementation to verifySolution() via options.replayStore.
jti is the JWT token ID uniquely identifying the challenge. expiresAt is a Unix timestamp in seconds indicating when the token expires. Return true to allow the submission (first use) and false to reject it (replay detected). Your implementation must be atomic — use a primitive such as Redis SET NX EXAT to avoid race conditions.
LocalReplayStore
The built-in, process-local implementation of ReplayStore exported from ribaunt. It stores consumed token IDs in memory and automatically evicts entries once their TTL has passed. Use this when replayPrevention is 'local' (the default) — it is used automatically in that mode. You can also instantiate it directly when you need a dedicated per-handler store.
LocalReplayStore is not suitable for multi-process or serverless deployments. For those environments, implement your own ReplayStore backed by a distributed atomic store such as Redis SET NX EXAT.
ReplayPreventionMode
Controls how verifySolution() prevents a token from being submitted more than once.
'local'(default) — replay checks are process-local. Suitable for single-process deployments.'remote'— replay checks use yourReplayStore. Use this for serverless or horizontally scaled deployments.'disabled'— no replay checks. Tokens can be reused until they expire. Only use this if another layer handles replay prevention.
VerifySolutionOptions
Optional configuration passed as the third argument to verifySolution().
RateLimiter
The interface you implement to plug your own rate limiter into createChallenge() and verifySolution(). Ribaunt calls check() with the optional context value from the same call. Resolve true to allow, false to reject. Rejection surfaces as a thrown RateLimitedError.
key argument is whatever you passed as context to createChallenge() or verifySolution(). Remember that context also binds tokens cryptographically, so both calls must use the identical value. To bucket by request data such as the client IP, close over the request in your check() implementation instead of passing it as context. check() may be async, which is why createChallenge() returns a Promise.
RateLimitedError
Thrown by createChallenge() or verifySolution() when a supplied rateLimiter.check() resolves false. Catch this to return a 429 response.
RibauntEvent
Discriminated union passed to the optional onEvent telemetry hook on both createChallenge() and verifySolution(). Use it to feed metrics or logs without wrapping Ribaunt yourself.
challenge-issued— emitted bycreateChallenge()after tokens are signed.verify-success— emitted byverifySolution()when the submission passes all checks.verify-failure— emitted byverifySolution()when the submission is rejected.reasonreuses the sameVerifyFailureReasonunion asVerifyWarning, so you can share dashboards between the two hooks.
onEvent callback are caught and ignored, so telemetry can never break challenge issuance or verification.
VerifySolutionResult
The structured result returned by verifySolution().
VerifyWarning
The structured warning object passed to the onWarning callback when verifySolution() encounters a problem. This allows you to capture telemetry without enabling console output.
VerifyFailureReason and VerifyWarningReason
A string union describing the category of verification failure. You can use this to route warnings to different monitoring channels or metrics.
replay-store-unavailable is reported when your ReplayStore throws (for example, Redis is unreachable). Verification fails closed with this reason instead of miscategorizing the outage as invalid-token, so you can alert on store health separately from bad submissions.
SolveChallengeOptions
Optional guardrails passed to solveChallenge() and solveChallengeAsync() to prevent them from running indefinitely during tests.
WidgetState
Imported from ribaunt/widget. Represents the current state of the CAPTCHA widget in the browser.
WidgetErrorCode
Machine-readable error classification emitted on the widget’s error event detail.code.
WidgetError
Exported from ribaunt/widget. The error class the widget throws internally when a verification attempt fails. Every instance carries a machine-readable code (a WidgetErrorCode), so you can classify failures without parsing human-readable messages. The same code is surfaced on the error event’s detail.code.
RibauntWidgetHandle
Imported from ribaunt/widget-react. This is the imperative handle exposed via a React ref attached to the <RibauntWidget> component. Use it to programmatically control the widget from your application code.