@kya-os/checkpoint-nextjs 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/EDGE_RUNTIME_WASM_SETUP.md +348 -0
  3. package/README.md +414 -0
  4. package/bin/setup-edge-wasm.js +497 -0
  5. package/dist/.tsbuildinfo +1 -0
  6. package/dist/adapt.d.mts +39 -0
  7. package/dist/adapt.d.ts +39 -0
  8. package/dist/adapt.js +58 -0
  9. package/dist/adapt.js.map +1 -0
  10. package/dist/adapt.mjs +56 -0
  11. package/dist/adapt.mjs.map +1 -0
  12. package/dist/api-client.d.mts +204 -0
  13. package/dist/api-client.d.ts +204 -0
  14. package/dist/api-client.js +206 -0
  15. package/dist/api-client.js.map +1 -0
  16. package/dist/api-client.mjs +199 -0
  17. package/dist/api-client.mjs.map +1 -0
  18. package/dist/api-middleware.d.mts +156 -0
  19. package/dist/api-middleware.d.ts +156 -0
  20. package/dist/api-middleware.js +510 -0
  21. package/dist/api-middleware.js.map +1 -0
  22. package/dist/api-middleware.mjs +505 -0
  23. package/dist/api-middleware.mjs.map +1 -0
  24. package/dist/create-middleware.d.mts +17 -0
  25. package/dist/create-middleware.d.ts +17 -0
  26. package/dist/create-middleware.js +38 -0
  27. package/dist/create-middleware.js.map +1 -0
  28. package/dist/create-middleware.mjs +35 -0
  29. package/dist/create-middleware.mjs.map +1 -0
  30. package/dist/edge/index.d.mts +110 -0
  31. package/dist/edge/index.d.ts +110 -0
  32. package/dist/edge/index.js +277 -0
  33. package/dist/edge/index.js.map +1 -0
  34. package/dist/edge/index.mjs +275 -0
  35. package/dist/edge/index.mjs.map +1 -0
  36. package/dist/edge-runtime-loader.d.mts +50 -0
  37. package/dist/edge-runtime-loader.d.ts +50 -0
  38. package/dist/edge-runtime-loader.js +204 -0
  39. package/dist/edge-runtime-loader.js.map +1 -0
  40. package/dist/edge-runtime-loader.mjs +201 -0
  41. package/dist/edge-runtime-loader.mjs.map +1 -0
  42. package/dist/edge-wasm-middleware.d.mts +68 -0
  43. package/dist/edge-wasm-middleware.d.ts +68 -0
  44. package/dist/edge-wasm-middleware.js +318 -0
  45. package/dist/edge-wasm-middleware.js.map +1 -0
  46. package/dist/edge-wasm-middleware.mjs +315 -0
  47. package/dist/edge-wasm-middleware.mjs.map +1 -0
  48. package/dist/index.d.mts +25 -0
  49. package/dist/index.d.ts +25 -0
  50. package/dist/index.js +1019 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/index.mjs +979 -0
  53. package/dist/index.mjs.map +1 -0
  54. package/dist/middleware-edge.d.mts +46 -0
  55. package/dist/middleware-edge.d.ts +46 -0
  56. package/dist/middleware-edge.js +134 -0
  57. package/dist/middleware-edge.js.map +1 -0
  58. package/dist/middleware-edge.mjs +129 -0
  59. package/dist/middleware-edge.mjs.map +1 -0
  60. package/dist/middleware-node.d.mts +89 -0
  61. package/dist/middleware-node.d.ts +89 -0
  62. package/dist/middleware-node.js +127 -0
  63. package/dist/middleware-node.js.map +1 -0
  64. package/dist/middleware-node.mjs +124 -0
  65. package/dist/middleware-node.mjs.map +1 -0
  66. package/dist/middleware.d.mts +36 -0
  67. package/dist/middleware.d.ts +36 -0
  68. package/dist/middleware.js +15 -0
  69. package/dist/middleware.js.map +1 -0
  70. package/dist/middleware.mjs +12 -0
  71. package/dist/middleware.mjs.map +1 -0
  72. package/dist/nodejs-wasm-loader.d.mts +25 -0
  73. package/dist/nodejs-wasm-loader.d.ts +25 -0
  74. package/dist/nodejs-wasm-loader.js +95 -0
  75. package/dist/nodejs-wasm-loader.js.map +1 -0
  76. package/dist/nodejs-wasm-loader.mjs +85 -0
  77. package/dist/nodejs-wasm-loader.mjs.map +1 -0
  78. package/dist/policy.d.mts +162 -0
  79. package/dist/policy.d.ts +162 -0
  80. package/dist/policy.js +189 -0
  81. package/dist/policy.js.map +1 -0
  82. package/dist/policy.mjs +165 -0
  83. package/dist/policy.mjs.map +1 -0
  84. package/dist/session-tracker.d.mts +55 -0
  85. package/dist/session-tracker.d.ts +55 -0
  86. package/dist/session-tracker.js +170 -0
  87. package/dist/session-tracker.js.map +1 -0
  88. package/dist/session-tracker.mjs +167 -0
  89. package/dist/session-tracker.mjs.map +1 -0
  90. package/dist/signature-verifier.d.mts +33 -0
  91. package/dist/signature-verifier.d.ts +33 -0
  92. package/dist/signature-verifier.js +386 -0
  93. package/dist/signature-verifier.js.map +1 -0
  94. package/dist/signature-verifier.mjs +362 -0
  95. package/dist/signature-verifier.mjs.map +1 -0
  96. package/dist/translate.d.mts +33 -0
  97. package/dist/translate.d.ts +33 -0
  98. package/dist/translate.js +38 -0
  99. package/dist/translate.js.map +1 -0
  100. package/dist/translate.mjs +36 -0
  101. package/dist/translate.mjs.map +1 -0
  102. package/dist/types-C-xCUNTr.d.mts +105 -0
  103. package/dist/types-C-xCUNTr.d.ts +105 -0
  104. package/dist/wasm-middleware.d.mts +63 -0
  105. package/dist/wasm-middleware.d.ts +63 -0
  106. package/dist/wasm-middleware.js +98 -0
  107. package/dist/wasm-middleware.js.map +1 -0
  108. package/dist/wasm-middleware.mjs +95 -0
  109. package/dist/wasm-middleware.mjs.map +1 -0
  110. package/dist/wasm-setup.d.mts +46 -0
  111. package/dist/wasm-setup.d.ts +46 -0
  112. package/dist/wasm-setup.js +176 -0
  113. package/dist/wasm-setup.js.map +1 -0
  114. package/dist/wasm-setup.mjs +167 -0
  115. package/dist/wasm-setup.mjs.map +1 -0
  116. package/package.json +156 -0
  117. package/templates/middleware-wasm-100.ts +153 -0
  118. package/wasm/agentshield_wasm.d.ts +479 -0
  119. package/wasm/agentshield_wasm.js +1536 -0
  120. package/wasm/agentshield_wasm_bg.wasm +0 -0
  121. package/wasm/package.json +30 -0
  122. package/wasm.d.ts +21 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * AgentShield Middleware Template with WASM (95-100% Confidence)
3
+ *
4
+ * This template provides full cryptographic verification for AI agents
5
+ * following Next.js official documentation for WebAssembly in Edge Runtime.
6
+ *
7
+ * Installation:
8
+ * 1. Copy this file to your project root as `middleware.ts`
9
+ * 2. Install packages: npm install @kya-os/checkpoint @kya-os/checkpoint-nextjs
10
+ * 3. Deploy to Vercel for Edge Runtime support
11
+ */
12
+
13
+ import { NextResponse } from 'next/server';
14
+ import type { NextRequest } from 'next/server';
15
+
16
+ // CRITICAL: Import WASM module with ?module suffix for Edge Runtime
17
+ // This MUST be at the top of the file, before any other AgentShield imports
18
+ import wasmModule from '@kya-os/checkpoint/wasm?module';
19
+
20
+ // Now import the middleware creator
21
+ import {
22
+ createWasmAgentShieldMiddleware,
23
+ instantiateWasm,
24
+ } from '@kya-os/checkpoint-nextjs/wasm-middleware';
25
+
26
+ // Initialize WASM module once at startup
27
+ let wasmInstancePromise: Promise<WebAssembly.Instance> | null = null;
28
+
29
+ async function getWasmInstance() {
30
+ if (!wasmInstancePromise) {
31
+ wasmInstancePromise = instantiateWasm(wasmModule);
32
+ }
33
+ return wasmInstancePromise;
34
+ }
35
+
36
+ export async function middleware(request: NextRequest) {
37
+ try {
38
+ // Get or create WASM instance
39
+ const wasmInstance = await getWasmInstance();
40
+
41
+ // Create middleware with WASM support
42
+ const agentShieldMiddleware = createWasmAgentShieldMiddleware({
43
+ wasmInstance,
44
+
45
+ // Skip authentication and static assets
46
+ skipPaths: ['/api/auth', '/_next', '/favicon.ico', '/public'],
47
+
48
+ // What to do when agent is detected
49
+ onAgentDetected: async (result) => {
50
+ // With WASM: 95-100% confidence for cryptographically verified agents
51
+ console.log(`🤖 AI Agent detected:`, {
52
+ agent: result.agent,
53
+ confidence: `${Math.round(result.confidence * 100)}%`,
54
+ verification: result.verificationMethod, // 'signature' with WASM, 'pattern' without
55
+ risk: result.riskLevel,
56
+ timestamp: result.timestamp,
57
+ });
58
+
59
+ // You can add custom logic here:
60
+ // - Log to analytics
61
+ // - Send alerts
62
+ // - Apply rate limiting
63
+ // - etc.
64
+ },
65
+
66
+ // Set to true to block AI agents
67
+ blockOnHighConfidence: false, // Change to true to block agents
68
+
69
+ // Minimum confidence to trigger blocking (0.8 = 80%)
70
+ confidenceThreshold: 0.8,
71
+
72
+ // Custom response when blocking
73
+ blockedResponse: {
74
+ status: 403,
75
+ message: 'AI agent access restricted',
76
+ headers: {
77
+ 'Content-Type': 'application/json',
78
+ 'X-Blocked-Reason': 'ai-agent-detected',
79
+ },
80
+ },
81
+ });
82
+
83
+ // Run AgentShield detection
84
+ const response = await agentShieldMiddleware(request);
85
+
86
+ // Add security headers to all responses
87
+ response.headers.set('X-Frame-Options', 'DENY');
88
+ response.headers.set('X-Content-Type-Options', 'nosniff');
89
+ response.headers.set('Referrer-Policy', 'strict-origin-when-cross-origin');
90
+
91
+ return response;
92
+ } catch (error) {
93
+ // If WASM fails to load, fall back to pattern detection (85% confidence)
94
+ console.warn('⚠️ WASM initialization failed, using pattern detection:', error);
95
+
96
+ // You could use the regular middleware here as fallback
97
+ // For now, just continue
98
+ return NextResponse.next();
99
+ }
100
+ }
101
+
102
+ // Configure which paths the middleware runs on
103
+ export const config = {
104
+ matcher: [
105
+ /*
106
+ * Match all request paths except for the ones starting with:
107
+ * - _next/static (static files)
108
+ * - _next/image (image optimization files)
109
+ * - favicon.ico (favicon file)
110
+ * - public folder
111
+ */
112
+ {
113
+ source: '/((?!_next/static|_next/image|favicon.ico|public).*)',
114
+ missing: [
115
+ { type: 'header', key: 'next-router-prefetch' },
116
+ { type: 'header', key: 'purpose', value: 'prefetch' },
117
+ ],
118
+ },
119
+ ],
120
+ };
121
+
122
+ /**
123
+ * TypeScript Support
124
+ *
125
+ * Add this to a `types/wasm.d.ts` file in your project:
126
+ *
127
+ * declare module '@kya-os/checkpoint/wasm?module' {
128
+ * const value: WebAssembly.Module;
129
+ * export default value;
130
+ * }
131
+ */
132
+
133
+ /**
134
+ * What You'll See in Logs:
135
+ *
136
+ * With WASM (95-100% confidence):
137
+ * 🤖 AI Agent detected: {
138
+ * agent: 'ChatGPT-User',
139
+ * confidence: '100%',
140
+ * verification: 'signature', // Cryptographically verified!
141
+ * risk: 'high',
142
+ * timestamp: '2024-01-01T00:00:00.000Z'
143
+ * }
144
+ *
145
+ * Without WASM (85% confidence):
146
+ * 🤖 AI Agent detected: {
147
+ * agent: 'ChatGPT-User',
148
+ * confidence: '85%',
149
+ * verification: 'pattern', // Pattern matching only
150
+ * risk: 'medium',
151
+ * timestamp: '2024-01-01T00:00:00.000Z'
152
+ * }
153
+ */
@@ -0,0 +1,479 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Initialize the AgentShield WASM module
5
+ */
6
+ export function init(): void;
7
+ /**
8
+ * Analyze a request and detect if it's from an agent
9
+ */
10
+ export function detect_agent(metadata: JsRequestMetadata): JsDetectionResult;
11
+ /**
12
+ * Get the version of the AgentShield library
13
+ */
14
+ export function version(): string;
15
+ /**
16
+ * Get the version of the AgentShield library
17
+ */
18
+ export function get_version(): string;
19
+ /**
20
+ * Get build information
21
+ */
22
+ export function get_build_info(): string;
23
+ /**
24
+ * Verify an MCP-I proof (VC-JWT token)
25
+ *
26
+ * This function verifies a Verifiable Credential JWT and extracts the
27
+ * principal (issuer) and agent (subject) DIDs.
28
+ *
29
+ * # Arguments
30
+ *
31
+ * * `vc_jwt` - The VC-JWT token string (header.payload.signature)
32
+ * * `current_time_secs` - Current Unix timestamp in seconds (for expiration check)
33
+ *
34
+ * # Returns
35
+ *
36
+ * A `JsMcpIVerificationResult` with verification status and extracted DIDs.
37
+ */
38
+ export function verify_mcp_i_proof(
39
+ vc_jwt: string,
40
+ current_time_secs: bigint
41
+ ): JsMcpIVerificationResult;
42
+ /**
43
+ * Resolve a did:key identifier to its public key
44
+ *
45
+ * # Arguments
46
+ *
47
+ * * `did` - The did:key identifier (e.g., "did:key:z6Mkf...")
48
+ *
49
+ * # Returns
50
+ *
51
+ * A `JsDidKeyResult` with the resolved public key or an error.
52
+ */
53
+ export function resolve_did_key_wasm(did: string): JsDidKeyResult;
54
+ /**
55
+ * Check if a requested scope is permitted by granted scopes
56
+ *
57
+ * # Arguments
58
+ *
59
+ * * `requested` - The scope being requested (e.g., "read:email")
60
+ * * `granted_json` - JSON array of granted scopes (e.g., "[\"read:*\", \"write:calendar\"]")
61
+ *
62
+ * # Returns
63
+ *
64
+ * A `JsScopeCheckResult` indicating whether the scope is permitted.
65
+ */
66
+ export function check_delegation_scope(requested: string, granted_json: string): JsScopeCheckResult;
67
+ /**
68
+ * Verify a delegation with time constraints
69
+ *
70
+ * # Arguments
71
+ *
72
+ * * `requested` - The scope being requested
73
+ * * `granted_json` - JSON array of granted scopes
74
+ * * `not_before` - Optional Unix timestamp (0 to skip)
75
+ * * `not_after` - Optional Unix timestamp (0 to skip)
76
+ * * `current_time` - Current Unix timestamp (0 to skip time checks)
77
+ *
78
+ * # Returns
79
+ *
80
+ * A `JsScopeCheckResult` indicating whether the delegation is valid.
81
+ */
82
+ export function verify_delegation_scope(
83
+ requested: string,
84
+ granted_json: string,
85
+ not_before: bigint,
86
+ not_after: bigint,
87
+ current_time: bigint
88
+ ): JsScopeCheckResult;
89
+ /**
90
+ * Evaluate a request against a policy configuration
91
+ *
92
+ * # Arguments
93
+ *
94
+ * * `policy_json` - Policy configuration as JSON string
95
+ * * `context_json` - Evaluation context as JSON string
96
+ *
97
+ * # Returns
98
+ *
99
+ * A `JsPolicyEvaluationResult` with the enforcement action and reason.
100
+ *
101
+ * # Example
102
+ *
103
+ * ```javascript
104
+ * const policy = JSON.stringify({
105
+ * version: "1.0.0",
106
+ * enabled: true,
107
+ * defaultAction: "allow",
108
+ * thresholds: { confidenceThreshold: 80, confidenceAction: "block" },
109
+ * denyList: [],
110
+ * allowList: [],
111
+ * rules: []
112
+ * });
113
+ *
114
+ * const context = JSON.stringify({
115
+ * agentType: "ai_agent",
116
+ * agentName: "ChatGPT",
117
+ * confidence: 95
118
+ * });
119
+ *
120
+ * const result = evaluate_policy(policy, context);
121
+ * console.log(result.action); // "block" (confidence exceeded threshold)
122
+ * ```
123
+ */
124
+ export function evaluate_policy(
125
+ policy_json: string,
126
+ context_json: string
127
+ ): JsPolicyEvaluationResult;
128
+ /**
129
+ * Check if a policy allows a request (convenience function)
130
+ *
131
+ * # Arguments
132
+ *
133
+ * * `policy_json` - Policy configuration as JSON string
134
+ * * `context_json` - Evaluation context as JSON string
135
+ *
136
+ * # Returns
137
+ *
138
+ * `true` if the request is allowed, `false` otherwise.
139
+ */
140
+ export function policy_allows(policy_json: string, context_json: string): boolean;
141
+ /**
142
+ * JavaScript-compatible detection result
143
+ */
144
+ export class JsDetectionResult {
145
+ private constructor();
146
+ free(): void;
147
+ [Symbol.dispose](): void;
148
+ /**
149
+ * Whether the request was identified as coming from an agent
150
+ */
151
+ is_agent: boolean;
152
+ /**
153
+ * Confidence score (0.0 to 1.0 scale)
154
+ */
155
+ confidence: number;
156
+ /**
157
+ * Get the detected agent name
158
+ */
159
+ readonly agent: string | undefined;
160
+ /**
161
+ * Get the detection class for database storage
162
+ * Returns: 'human', 'ai_agent', 'bot', 'automation', or 'unknown'
163
+ */
164
+ readonly detection_class: string;
165
+ /**
166
+ * Get the verification method as a string
167
+ */
168
+ readonly verification_method: string;
169
+ /**
170
+ * Get the risk level as a string
171
+ */
172
+ readonly risk_level: string;
173
+ /**
174
+ * Get the timestamp as a string
175
+ */
176
+ readonly timestamp: string;
177
+ }
178
+ /**
179
+ * JavaScript-compatible result from did:key resolution
180
+ */
181
+ export class JsDidKeyResult {
182
+ private constructor();
183
+ free(): void;
184
+ [Symbol.dispose](): void;
185
+ /**
186
+ * Whether the resolution was successful
187
+ */
188
+ success: boolean;
189
+ /**
190
+ * Get the public key as hex string
191
+ */
192
+ readonly public_key_hex: string | undefined;
193
+ /**
194
+ * Get the key type
195
+ */
196
+ readonly key_type: string | undefined;
197
+ /**
198
+ * Get the error message
199
+ */
200
+ readonly error: string | undefined;
201
+ }
202
+ /**
203
+ * JavaScript-compatible result from MCP-I verification
204
+ */
205
+ export class JsMcpIVerificationResult {
206
+ private constructor();
207
+ free(): void;
208
+ [Symbol.dispose](): void;
209
+ /**
210
+ * Whether the verification was successful
211
+ */
212
+ verified: boolean;
213
+ /**
214
+ * Confidence score (0.0 to 1.0 scale) - 0.99 for verified MCP-I
215
+ */
216
+ confidence: number;
217
+ /**
218
+ * Get the issuer DID (principal)
219
+ */
220
+ readonly issuer_did: string | undefined;
221
+ /**
222
+ * Get the subject DID (agent)
223
+ */
224
+ readonly subject_did: string | undefined;
225
+ /**
226
+ * Get the error message
227
+ */
228
+ readonly error: string | undefined;
229
+ }
230
+ /**
231
+ * JavaScript-compatible policy evaluation result
232
+ */
233
+ export class JsPolicyEvaluationResult {
234
+ private constructor();
235
+ free(): void;
236
+ [Symbol.dispose](): void;
237
+ /**
238
+ * Check if the action permits the request to proceed
239
+ * Returns true for 'allow' and 'log' (allow but log for monitoring)
240
+ */
241
+ is_allowed(): boolean;
242
+ /**
243
+ * Check if the action blocks the request
244
+ * Returns true for 'block', 'redirect', and 'challenge'
245
+ */
246
+ is_blocked(): boolean;
247
+ /**
248
+ * Convert to JSON string for serialization
249
+ */
250
+ to_json(): string;
251
+ /**
252
+ * Get the enforcement action
253
+ */
254
+ readonly action: string;
255
+ /**
256
+ * Get the reason for the action
257
+ */
258
+ readonly reason: string;
259
+ /**
260
+ * Get the matched rule ID
261
+ */
262
+ readonly rule_id: string | undefined;
263
+ /**
264
+ * Get the matched rule name
265
+ */
266
+ readonly rule_name: string | undefined;
267
+ /**
268
+ * Get the redirect URL
269
+ */
270
+ readonly redirect_url: string | undefined;
271
+ /**
272
+ * Get the custom message
273
+ */
274
+ readonly message: string | undefined;
275
+ /**
276
+ * Get the match type
277
+ */
278
+ readonly match_type: string;
279
+ }
280
+ /**
281
+ * JavaScript-compatible request metadata
282
+ */
283
+ export class JsRequestMetadata {
284
+ free(): void;
285
+ [Symbol.dispose](): void;
286
+ /**
287
+ * Constructor for JsRequestMetadata
288
+ */
289
+ constructor(
290
+ user_agent: string | null | undefined,
291
+ ip_address: string | null | undefined,
292
+ headers: string,
293
+ timestamp: string,
294
+ url?: string | null,
295
+ method?: string | null,
296
+ client_fingerprint?: string | null,
297
+ tls_fingerprint?: string | null
298
+ );
299
+ /**
300
+ * Get the user agent
301
+ */
302
+ readonly user_agent: string | undefined;
303
+ /**
304
+ * Get the IP address
305
+ */
306
+ readonly ip_address: string | undefined;
307
+ /**
308
+ * Get the headers as JSON string
309
+ */
310
+ readonly headers: string;
311
+ /**
312
+ * Get the timestamp
313
+ */
314
+ readonly timestamp: string;
315
+ /**
316
+ * Get the URL
317
+ */
318
+ readonly url: string | undefined;
319
+ /**
320
+ * Get the method
321
+ */
322
+ readonly method: string | undefined;
323
+ /**
324
+ * Get the client fingerprint
325
+ */
326
+ readonly client_fingerprint: string | undefined;
327
+ /**
328
+ * Get the TLS fingerprint
329
+ */
330
+ readonly tls_fingerprint: string | undefined;
331
+ }
332
+ /**
333
+ * JavaScript-compatible result from scope check
334
+ */
335
+ export class JsScopeCheckResult {
336
+ private constructor();
337
+ free(): void;
338
+ [Symbol.dispose](): void;
339
+ /**
340
+ * Whether the scope is permitted
341
+ */
342
+ permitted: boolean;
343
+ /**
344
+ * Get the matching scope
345
+ */
346
+ readonly matched_by: string | undefined;
347
+ /**
348
+ * Get the match type
349
+ */
350
+ readonly match_type: string;
351
+ /**
352
+ * Get the error message
353
+ */
354
+ readonly error: string | undefined;
355
+ }
356
+
357
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
358
+
359
+ export interface InitOutput {
360
+ readonly memory: WebAssembly.Memory;
361
+ readonly __wbg_jsdetectionresult_free: (a: number, b: number) => void;
362
+ readonly __wbg_get_jsdetectionresult_is_agent: (a: number) => number;
363
+ readonly __wbg_set_jsdetectionresult_is_agent: (a: number, b: number) => void;
364
+ readonly __wbg_get_jsdetectionresult_confidence: (a: number) => number;
365
+ readonly __wbg_set_jsdetectionresult_confidence: (a: number, b: number) => void;
366
+ readonly jsdetectionresult_agent: (a: number, b: number) => void;
367
+ readonly jsdetectionresult_detection_class: (a: number, b: number) => void;
368
+ readonly jsdetectionresult_verification_method: (a: number, b: number) => void;
369
+ readonly jsdetectionresult_risk_level: (a: number, b: number) => void;
370
+ readonly jsdetectionresult_timestamp: (a: number, b: number) => void;
371
+ readonly __wbg_jsrequestmetadata_free: (a: number, b: number) => void;
372
+ readonly jsrequestmetadata_new: (
373
+ a: number,
374
+ b: number,
375
+ c: number,
376
+ d: number,
377
+ e: number,
378
+ f: number,
379
+ g: number,
380
+ h: number,
381
+ i: number,
382
+ j: number,
383
+ k: number,
384
+ l: number,
385
+ m: number,
386
+ n: number,
387
+ o: number,
388
+ p: number
389
+ ) => number;
390
+ readonly jsrequestmetadata_user_agent: (a: number, b: number) => void;
391
+ readonly jsrequestmetadata_ip_address: (a: number, b: number) => void;
392
+ readonly jsrequestmetadata_headers: (a: number, b: number) => void;
393
+ readonly jsrequestmetadata_timestamp: (a: number, b: number) => void;
394
+ readonly jsrequestmetadata_url: (a: number, b: number) => void;
395
+ readonly jsrequestmetadata_method: (a: number, b: number) => void;
396
+ readonly jsrequestmetadata_client_fingerprint: (a: number, b: number) => void;
397
+ readonly jsrequestmetadata_tls_fingerprint: (a: number, b: number) => void;
398
+ readonly init: () => void;
399
+ readonly detect_agent: (a: number, b: number) => void;
400
+ readonly get_version: (a: number) => void;
401
+ readonly get_build_info: (a: number) => void;
402
+ readonly __wbg_jsmcpiverificationresult_free: (a: number, b: number) => void;
403
+ readonly __wbg_get_jsmcpiverificationresult_verified: (a: number) => number;
404
+ readonly __wbg_set_jsmcpiverificationresult_verified: (a: number, b: number) => void;
405
+ readonly jsmcpiverificationresult_issuer_did: (a: number, b: number) => void;
406
+ readonly jsmcpiverificationresult_subject_did: (a: number, b: number) => void;
407
+ readonly jsmcpiverificationresult_error: (a: number, b: number) => void;
408
+ readonly verify_mcp_i_proof: (a: number, b: number, c: bigint) => number;
409
+ readonly __wbg_jsdidkeyresult_free: (a: number, b: number) => void;
410
+ readonly __wbg_get_jsdidkeyresult_success: (a: number) => number;
411
+ readonly __wbg_set_jsdidkeyresult_success: (a: number, b: number) => void;
412
+ readonly jsdidkeyresult_public_key_hex: (a: number, b: number) => void;
413
+ readonly jsdidkeyresult_key_type: (a: number, b: number) => void;
414
+ readonly jsdidkeyresult_error: (a: number, b: number) => void;
415
+ readonly resolve_did_key_wasm: (a: number, b: number) => number;
416
+ readonly __wbg_jsscopecheckresult_free: (a: number, b: number) => void;
417
+ readonly jsscopecheckresult_matched_by: (a: number, b: number) => void;
418
+ readonly jsscopecheckresult_match_type: (a: number, b: number) => void;
419
+ readonly jsscopecheckresult_error: (a: number, b: number) => void;
420
+ readonly check_delegation_scope: (a: number, b: number, c: number, d: number) => number;
421
+ readonly verify_delegation_scope: (
422
+ a: number,
423
+ b: number,
424
+ c: number,
425
+ d: number,
426
+ e: bigint,
427
+ f: bigint,
428
+ g: bigint
429
+ ) => number;
430
+ readonly __wbg_jspolicyevaluationresult_free: (a: number, b: number) => void;
431
+ readonly jspolicyevaluationresult_action: (a: number, b: number) => void;
432
+ readonly jspolicyevaluationresult_reason: (a: number, b: number) => void;
433
+ readonly jspolicyevaluationresult_rule_id: (a: number, b: number) => void;
434
+ readonly jspolicyevaluationresult_rule_name: (a: number, b: number) => void;
435
+ readonly jspolicyevaluationresult_redirect_url: (a: number, b: number) => void;
436
+ readonly jspolicyevaluationresult_message: (a: number, b: number) => void;
437
+ readonly jspolicyevaluationresult_match_type: (a: number, b: number) => void;
438
+ readonly jspolicyevaluationresult_is_allowed: (a: number) => number;
439
+ readonly jspolicyevaluationresult_is_blocked: (a: number) => number;
440
+ readonly jspolicyevaluationresult_to_json: (a: number, b: number) => void;
441
+ readonly evaluate_policy: (a: number, b: number, c: number, d: number, e: number) => void;
442
+ readonly policy_allows: (a: number, b: number, c: number, d: number) => number;
443
+ readonly version: (a: number) => void;
444
+ readonly __wbg_set_jsmcpiverificationresult_confidence: (a: number, b: number) => void;
445
+ readonly __wbg_get_jsmcpiverificationresult_confidence: (a: number) => number;
446
+ readonly __wbg_set_jsscopecheckresult_permitted: (a: number, b: number) => void;
447
+ readonly __wbg_get_jsscopecheckresult_permitted: (a: number) => number;
448
+ readonly __wbindgen_export: (a: number, b: number, c: number) => void;
449
+ readonly __wbindgen_export2: (a: number, b: number) => number;
450
+ readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
451
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
452
+ readonly __wbindgen_start: () => void;
453
+ }
454
+
455
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
456
+ /**
457
+ * Instantiates the given `module`, which can either be bytes or
458
+ * a precompiled `WebAssembly.Module`.
459
+ *
460
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
461
+ *
462
+ * @returns {InitOutput}
463
+ */
464
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
465
+
466
+ /**
467
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
468
+ * for everything else, calls `WebAssembly.instantiate` directly.
469
+ *
470
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
471
+ *
472
+ * @returns {Promise<InitOutput>}
473
+ */
474
+ export default function __wbg_init(
475
+ module_or_path?:
476
+ | { module_or_path: InitInput | Promise<InitInput> }
477
+ | InitInput
478
+ | Promise<InitInput>
479
+ ): Promise<InitOutput>;