-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
30 lines (28 loc) · 1.08 KB
/
index.d.ts
File metadata and controls
30 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export interface TrustGateOptions {
/** Minimum trust score (0-100) to allow access */
minScore?: number;
/** What to do when score is below threshold (default: "block") */
action?: "block" | "warn" | "surcharge";
/** Price multiplier for low-trust agents in surcharge mode (default: 2) */
surchargeMultiplier?: number;
/** Allow agents with no score data through (default: true) */
allowUnknown?: boolean;
/** AgentScore API URL (default: https://agentscores.xyz/api/score) */
apiUrl?: string;
/** Cache TTL in milliseconds (default: 300000 / 5 minutes) */
cacheTtl?: number;
}
/**
* Wrap a Next.js route handler with trust gating.
* Checks the agent's AgentScore before allowing access.
*/
export function withTrustGate(
handler: (request: Request, context?: any) => Response | Promise<Response>,
options?: TrustGateOptions
): (request: Request, context?: any) => Promise<Response>;
/**
* Express/Connect-style middleware for trust gating.
*/
export function trustGateMiddleware(
options?: TrustGateOptions
): (req: any, res: any, next: () => void) => Promise<void>;