Turnstile docs: limit before asking Cloudflare; test and lint fixes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 20:22:21 +01:00
co-authored by Claude Opus 5.5
parent 6ca0730c08
commit b2fed3bf90
4 changed files with 8 additions and 9 deletions
+5 -5
View File
@@ -382,11 +382,6 @@ export type TotpEndpointGuards = {
* it. Return a Response to refuse (too many attempts), null to let it through.
*/
limitVerify?: (req: never) => null | Promise<null | Response> | Response
/**
* Called after a verify attempt that `limitVerify` let through: `correct` is true when the package
* answered `{ ok: true }`. The plugin's limit gives a right code's place back (buildVerifyLimit `settle`).
*/
settleVerify?: (req: never, correct: boolean) => Promise<void> | void
/** The answer for an account whose setup window has passed (in the caller's language). Default: a plain 403. */
onSetupClosed?: (req: never) => Response
/**
@@ -394,6 +389,11 @@ export type TotpEndpointGuards = {
* (sameOrigin.ts). False = refused, and NOT counted against the verify limit.
*/
ownOrigin?: (req: never) => boolean
/**
* Called after a verify attempt that `limitVerify` let through: `correct` is true when the package
* answered `{ ok: true }`. The plugin's limit gives a right code's place back (buildVerifyLimit `settle`).
*/
settleVerify?: (req: never, correct: boolean) => Promise<void> | void
}
export function guardTotpEndpoint<T extends EndpointLike>(endpoint: T, collection: string, guards: TotpEndpointGuards = {}): T {