@agent-score/commerce 2.4.0 → 2.6.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 (80) hide show
  1. package/README.md +19 -17
  2. package/dist/challenge/index.d.mts +31 -3
  3. package/dist/challenge/index.d.ts +31 -3
  4. package/dist/challenge/index.js +25 -9
  5. package/dist/challenge/index.js.map +1 -1
  6. package/dist/challenge/index.mjs +25 -9
  7. package/dist/challenge/index.mjs.map +1 -1
  8. package/dist/{checkout-B-MIzYzW.d.ts → checkout-C4RD7M0Z.d.ts} +117 -13
  9. package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-CzB9f_jf.d.mts} +117 -13
  10. package/dist/core.d.mts +40 -7
  11. package/dist/core.d.ts +40 -7
  12. package/dist/core.js +52 -27
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +52 -27
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/discovery/index.d.mts +33 -3
  17. package/dist/discovery/index.d.ts +33 -3
  18. package/dist/discovery/index.js +50 -16
  19. package/dist/discovery/index.js.map +1 -1
  20. package/dist/discovery/index.mjs +49 -16
  21. package/dist/discovery/index.mjs.map +1 -1
  22. package/dist/gate-D2RP6bZg.d.ts +307 -0
  23. package/dist/gate-GCXy4FHI.d.mts +307 -0
  24. package/dist/identity/express.d.mts +28 -1
  25. package/dist/identity/express.d.ts +28 -1
  26. package/dist/identity/express.js +714 -31
  27. package/dist/identity/express.js.map +1 -1
  28. package/dist/identity/express.mjs +710 -30
  29. package/dist/identity/express.mjs.map +1 -1
  30. package/dist/identity/fastify.d.mts +14 -2
  31. package/dist/identity/fastify.d.ts +14 -2
  32. package/dist/identity/fastify.js +727 -31
  33. package/dist/identity/fastify.js.map +1 -1
  34. package/dist/identity/fastify.mjs +723 -30
  35. package/dist/identity/fastify.mjs.map +1 -1
  36. package/dist/identity/hono.d.mts +28 -1
  37. package/dist/identity/hono.d.ts +28 -1
  38. package/dist/identity/hono.js +696 -33
  39. package/dist/identity/hono.js.map +1 -1
  40. package/dist/identity/hono.mjs +692 -32
  41. package/dist/identity/hono.mjs.map +1 -1
  42. package/dist/identity/nextjs.d.mts +5 -0
  43. package/dist/identity/nextjs.d.ts +5 -0
  44. package/dist/identity/nextjs.js +695 -30
  45. package/dist/identity/nextjs.js.map +1 -1
  46. package/dist/identity/nextjs.mjs +691 -29
  47. package/dist/identity/nextjs.mjs.map +1 -1
  48. package/dist/identity/policy.d.mts +21 -2
  49. package/dist/identity/policy.d.ts +21 -2
  50. package/dist/identity/policy.js +22 -1
  51. package/dist/identity/policy.js.map +1 -1
  52. package/dist/identity/policy.mjs +21 -1
  53. package/dist/identity/policy.mjs.map +1 -1
  54. package/dist/identity/web.d.mts +26 -1
  55. package/dist/identity/web.d.ts +26 -1
  56. package/dist/identity/web.js +695 -30
  57. package/dist/identity/web.js.map +1 -1
  58. package/dist/identity/web.mjs +691 -29
  59. package/dist/identity/web.mjs.map +1 -1
  60. package/dist/index.d.mts +165 -4
  61. package/dist/index.d.ts +165 -4
  62. package/dist/index.js +3103 -534
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +3086 -545
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/payment/index.d.mts +1 -1
  67. package/dist/payment/index.d.ts +1 -1
  68. package/dist/payment/index.js +10 -2
  69. package/dist/payment/index.js.map +1 -1
  70. package/dist/payment/index.mjs +10 -2
  71. package/dist/payment/index.mjs.map +1 -1
  72. package/dist/stripe-multichain/index.js +1614 -266
  73. package/dist/stripe-multichain/index.js.map +1 -1
  74. package/dist/stripe-multichain/index.mjs +1614 -266
  75. package/dist/stripe-multichain/index.mjs.map +1 -1
  76. package/dist/types-D1slMt0H.d.mts +137 -0
  77. package/dist/types-D1slMt0H.d.ts +137 -0
  78. package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
  79. package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
  80. package/package.json +26 -21
@@ -44,7 +44,7 @@ var IDENTITY_VERIFICATION_REQUIRED_FALLBACK_INSTRUCTIONS = JSON.stringify({
44
44
  var API_ERROR_INSTRUCTIONS = JSON.stringify({
45
45
  action: "retry_with_backoff",
46
46
  steps: [
47
- "Verification is temporarily unavailable. Retry the request after 5\u201330 seconds with exponential backoff.",
47
+ "Verification is temporarily unavailable. Retry the request after 5-30 seconds with exponential backoff.",
48
48
  "This is NOT a compliance denial \u2014 the user does not need to re-verify their identity. Send the same identity headers (X-Wallet-Address or X-Operator-Token) on retry.",
49
49
  "If the request continues to fail after 3+ retries (~60 seconds total), surface the error to the user with the merchant's support contact."
50
50
  ],
@@ -131,7 +131,605 @@ function denialReasonToBody(reason) {
131
131
  return body;
132
132
  }
133
133
 
134
+ // src/aip/verify.ts
135
+ import { decodeJwt, decodeProtectedHeader, importJWK as importJWK2, jwtVerify } from "jose";
136
+
137
+ // src/aip/http-signature.ts
138
+ import { calculateJwkThumbprint, importJWK } from "jose";
139
+ var { subtle } = globalThis.crypto;
140
+ var b64ToBytes = (b64) => {
141
+ const bin = atob(b64);
142
+ const out = new Uint8Array(bin.length);
143
+ for (let i = 0; i < bin.length; i++) {
144
+ out[i] = bin.charCodeAt(i);
145
+ }
146
+ return out;
147
+ };
148
+ var AIP_COVERED_COMPONENTS = ["@method", "@authority", "@path", "agent-identity"];
149
+ var AIP_SIGNATURE_TAG = "agent-identity";
150
+ var DEFAULT_MAX_SKEW_SECONDS = 60;
151
+ var MAX_POP_WINDOW_SECONDS = 120;
152
+ var normalizeAuthority = (authority) => {
153
+ const lower = authority.trim().toLowerCase();
154
+ const colon = lower.lastIndexOf(":");
155
+ if (colon === -1) {
156
+ return lower;
157
+ }
158
+ if (lower.includes("]") && colon < lower.indexOf("]")) {
159
+ return lower;
160
+ }
161
+ const host = lower.slice(0, colon);
162
+ const port = lower.slice(colon + 1);
163
+ if (port === "80" || port === "443") {
164
+ return host;
165
+ }
166
+ return lower;
167
+ };
168
+ var componentValue = (name, input) => {
169
+ switch (name) {
170
+ case "@method":
171
+ return input.method.toUpperCase();
172
+ case "@authority":
173
+ return normalizeAuthority(input.authority);
174
+ case "@path":
175
+ return input.path;
176
+ case "agent-identity":
177
+ return input.agentIdentity.trim();
178
+ default:
179
+ return input.extra?.[name] ?? null;
180
+ }
181
+ };
182
+ var serializeComponentList = (components) => `(${components.map((c) => `"${c}"`).join(" ")})`;
183
+ var serializeParams = (p) => {
184
+ const parts = [];
185
+ if (p.created !== void 0) {
186
+ parts.push(`created=${p.created}`);
187
+ }
188
+ if (p.expires !== void 0) {
189
+ parts.push(`expires=${p.expires}`);
190
+ }
191
+ if (p.keyid !== void 0) {
192
+ parts.push(`keyid="${p.keyid}"`);
193
+ }
194
+ if (p.alg !== void 0) {
195
+ parts.push(`alg="${p.alg}"`);
196
+ }
197
+ if (p.tag !== void 0) {
198
+ parts.push(`tag="${p.tag}"`);
199
+ }
200
+ return parts.map((s) => `;${s}`).join("");
201
+ };
202
+ var buildSignatureBase = (params, input, rawSignatureParams) => {
203
+ const lines = [];
204
+ for (const name of params.components) {
205
+ const value = componentValue(name, input);
206
+ if (value === null) {
207
+ throw new MissingComponentError(name);
208
+ }
209
+ lines.push(`"${name}": ${value}`);
210
+ }
211
+ const paramsValue = rawSignatureParams ?? serializeComponentList(params.components) + serializeParams(params);
212
+ lines.push(`"@signature-params": ${paramsValue}`);
213
+ return lines.join("\n");
214
+ };
215
+ var MissingComponentError = class extends Error {
216
+ constructor(component) {
217
+ super(`signature base missing covered component: ${component}`);
218
+ this.component = component;
219
+ this.name = "MissingComponentError";
220
+ }
221
+ component;
222
+ };
223
+ var parseSignatureInput = (header, tag = AIP_SIGNATURE_TAG) => {
224
+ const members = splitDictionary(header);
225
+ if (members.length === 0) {
226
+ return null;
227
+ }
228
+ const parsed = members.map((m) => {
229
+ const params = parseInnerListMember(m.value);
230
+ return params ? { label: m.label, params, rawParams: m.value } : null;
231
+ }).filter((x) => x !== null);
232
+ if (parsed.length === 0) {
233
+ return null;
234
+ }
235
+ return parsed.find((p) => p.params.tag === tag) ?? null;
236
+ };
237
+ var parseSignatureValue = (header, label) => {
238
+ const members = splitDictionary(header);
239
+ const member = members.find((m) => m.label === label);
240
+ if (!member) {
241
+ return null;
242
+ }
243
+ const v = member.value.trim();
244
+ if (!v.startsWith(":") || !v.endsWith(":") || v.length < 2) {
245
+ return null;
246
+ }
247
+ const b64 = v.slice(1, -1);
248
+ try {
249
+ return b64ToBytes(b64);
250
+ } catch {
251
+ return null;
252
+ }
253
+ };
254
+ var splitDictionary = (header) => {
255
+ const out = [];
256
+ let depth = 0;
257
+ let inBytes = false;
258
+ let inString = false;
259
+ let current = "";
260
+ for (let i = 0; i < header.length; i++) {
261
+ const ch = header[i];
262
+ if (inString) {
263
+ current += ch;
264
+ if (ch === '"' && header[i - 1] !== "\\") {
265
+ inString = false;
266
+ }
267
+ continue;
268
+ }
269
+ if (ch === '"') {
270
+ inString = true;
271
+ current += ch;
272
+ continue;
273
+ }
274
+ if (ch === ":") {
275
+ inBytes = !inBytes;
276
+ current += ch;
277
+ continue;
278
+ }
279
+ if (!inBytes && ch === "(") {
280
+ depth++;
281
+ current += ch;
282
+ continue;
283
+ }
284
+ if (!inBytes && ch === ")") {
285
+ depth = Math.max(0, depth - 1);
286
+ current += ch;
287
+ continue;
288
+ }
289
+ if (!inBytes && depth === 0 && ch === ",") {
290
+ pushMember(out, current);
291
+ current = "";
292
+ continue;
293
+ }
294
+ current += ch;
295
+ }
296
+ pushMember(out, current);
297
+ return out;
298
+ };
299
+ var pushMember = (out, raw) => {
300
+ const trimmed = raw.trim();
301
+ if (!trimmed) {
302
+ return;
303
+ }
304
+ const eq = trimmed.indexOf("=");
305
+ if (eq === -1) {
306
+ return;
307
+ }
308
+ const label = trimmed.slice(0, eq).trim();
309
+ const value = trimmed.slice(eq + 1).trim();
310
+ if (label) {
311
+ out.push({ label, value });
312
+ }
313
+ };
314
+ var parseInnerListMember = (value) => {
315
+ const open = value.indexOf("(");
316
+ const close = value.indexOf(")", open + 1);
317
+ if (open === -1 || close === -1) {
318
+ return null;
319
+ }
320
+ const listBody = value.slice(open + 1, close).trim();
321
+ const components = listBody.length === 0 ? [] : (listBody.match(/"[^"]*"/g) ?? []).map((s) => s.slice(1, -1));
322
+ const params = { components };
323
+ const paramStr = value.slice(close + 1);
324
+ const re = /;\s*([a-zA-Z][a-zA-Z0-9_-]*)\s*=\s*("(?:[^"\\]|\\.)*"|-?\d+)/g;
325
+ let match;
326
+ while ((match = re.exec(paramStr)) !== null) {
327
+ const key = match[1];
328
+ const raw = match[2];
329
+ const val = raw.startsWith('"') ? raw.slice(1, -1) : Number(raw);
330
+ if (key === "created") {
331
+ params.created = val;
332
+ } else if (key === "expires") {
333
+ params.expires = val;
334
+ } else if (key === "keyid") {
335
+ params.keyid = val;
336
+ } else if (key === "tag") {
337
+ params.tag = val;
338
+ } else if (key === "alg") {
339
+ params.alg = val;
340
+ }
341
+ }
342
+ return params;
343
+ };
344
+ var verifyMessageSignature = async (input) => {
345
+ const selected = parseSignatureInput(input.signatureInput);
346
+ if (!selected) {
347
+ return { ok: false, reason: "no_aip_signature" };
348
+ }
349
+ const { label, params, rawParams } = selected;
350
+ if (params.alg !== void 0 && !["ed25519", "eddsa"].includes(params.alg.toLowerCase())) {
351
+ return { ok: false, reason: "unsupported_alg" };
352
+ }
353
+ for (const required of AIP_COVERED_COMPONENTS) {
354
+ if (!params.components.includes(required)) {
355
+ return { ok: false, reason: "missing_covered_component" };
356
+ }
357
+ }
358
+ if (params.created === void 0) {
359
+ return { ok: false, reason: "created_missing" };
360
+ }
361
+ if (params.expires === void 0) {
362
+ return { ok: false, reason: "expires_missing" };
363
+ }
364
+ if (params.expires < params.created || params.expires - params.created > MAX_POP_WINDOW_SECONDS) {
365
+ return { ok: false, reason: "pop_window_too_long" };
366
+ }
367
+ const now = input.now ?? Math.floor(Date.now() / 1e3);
368
+ const skew = input.maxSkewSeconds ?? DEFAULT_MAX_SKEW_SECONDS;
369
+ if (params.created > now + skew) {
370
+ return { ok: false, reason: "created_in_future" };
371
+ }
372
+ if (params.expires < now - skew) {
373
+ return { ok: false, reason: "expired" };
374
+ }
375
+ if (!params.keyid) {
376
+ return { ok: false, reason: "missing_keyid" };
377
+ }
378
+ const cnf = input.cnfJwk;
379
+ if (cnf.kty !== "OKP" || cnf.crv !== "Ed25519" || typeof cnf.x !== "string" || cnf.x.length === 0) {
380
+ return { ok: false, reason: "unsupported_cnf_key" };
381
+ }
382
+ let thumbprint;
383
+ try {
384
+ thumbprint = await calculateJwkThumbprint(input.cnfJwk, "sha256");
385
+ } catch {
386
+ return { ok: false, reason: "unsupported_cnf_key" };
387
+ }
388
+ if (params.keyid !== thumbprint) {
389
+ return { ok: false, reason: "keyid_mismatch" };
390
+ }
391
+ const sig = parseSignatureValue(input.signature, label);
392
+ if (!sig) {
393
+ return { ok: false, reason: "malformed_signature" };
394
+ }
395
+ let base;
396
+ try {
397
+ base = buildSignatureBase(params, {
398
+ method: input.method,
399
+ authority: input.authority,
400
+ path: input.path,
401
+ agentIdentity: input.agentIdentity,
402
+ extra: input.extraComponents
403
+ }, rawParams);
404
+ } catch (err) {
405
+ if (err instanceof MissingComponentError) {
406
+ return { ok: false, reason: "missing_covered_component" };
407
+ }
408
+ throw err;
409
+ }
410
+ let valid;
411
+ try {
412
+ const key = await importJWK(input.cnfJwk, "EdDSA");
413
+ if (!(key instanceof CryptoKey)) {
414
+ return { ok: false, reason: "signature_invalid" };
415
+ }
416
+ valid = await subtle.verify(
417
+ { name: "Ed25519" },
418
+ key,
419
+ sig,
420
+ new TextEncoder().encode(base)
421
+ );
422
+ } catch {
423
+ return { ok: false, reason: "signature_invalid" };
424
+ }
425
+ return valid ? { ok: true, params } : { ok: false, reason: "signature_invalid" };
426
+ };
427
+
428
+ // src/aip/types.ts
429
+ var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
430
+ var isNonEmptyString = (v) => typeof v === "string" && v.length > 0;
431
+ var isAitShape = (payload) => isObject(payload) && isObject(payload.cnf) && isObject(payload.agent);
432
+ var validateAitPayload = (payload) => {
433
+ if (!isObject(payload)) {
434
+ return { ok: false, reason: "not_an_object" };
435
+ }
436
+ if (!isNonEmptyString(payload.aip_version)) {
437
+ return { ok: false, reason: "missing_aip_version" };
438
+ }
439
+ if (!isNonEmptyString(payload.iss)) {
440
+ return { ok: false, reason: "missing_iss" };
441
+ }
442
+ if (!isNonEmptyString(payload.sub)) {
443
+ return { ok: false, reason: "missing_sub" };
444
+ }
445
+ if (typeof payload.iat !== "number") {
446
+ return { ok: false, reason: "missing_iat" };
447
+ }
448
+ if (typeof payload.exp !== "number") {
449
+ return { ok: false, reason: "missing_exp" };
450
+ }
451
+ if (!isObject(payload.cnf) || !isObject(payload.cnf.jwk)) {
452
+ return { ok: false, reason: "missing_cnf" };
453
+ }
454
+ if (!isObject(payload.agent) || !isNonEmptyString(payload.agent.provider)) {
455
+ return { ok: false, reason: "missing_agent_provider" };
456
+ }
457
+ if (payload.trust_level === "human_confirmed") {
458
+ const auth = payload.auth;
459
+ const amr = isObject(auth) ? auth.amr : void 0;
460
+ if (!Array.isArray(amr) || amr.length === 0) {
461
+ return { ok: false, reason: "human_confirmed_without_amr" };
462
+ }
463
+ }
464
+ return { ok: true, payload };
465
+ };
466
+
467
+ // src/aip/verify.ts
468
+ var AGENT_IDENTITY_HEADER = "agent-identity";
469
+ var verifyAit = async (ctx, opts) => {
470
+ if (ctx.agentIdentityHeaders.length === 0) {
471
+ return { ok: false, reason: "no_token" };
472
+ }
473
+ if (!ctx.signatureInput || !ctx.signature) {
474
+ return { ok: false, reason: "pop_signature_missing" };
475
+ }
476
+ const signatureInput = ctx.signatureInput;
477
+ const signature = ctx.signature;
478
+ let lastFailure = "malformed_token";
479
+ for (const raw of ctx.agentIdentityHeaders) {
480
+ const token = stripBearer(raw);
481
+ let header;
482
+ let payload;
483
+ try {
484
+ header = decodeProtectedHeader(token);
485
+ payload = decodeJwt(token);
486
+ } catch {
487
+ lastFailure = "malformed_token";
488
+ continue;
489
+ }
490
+ if (header.alg === void 0 || header.alg.toLowerCase() === "none") {
491
+ lastFailure = "malformed_token";
492
+ continue;
493
+ }
494
+ if (!isAitShape(payload)) {
495
+ lastFailure = "malformed_token";
496
+ continue;
497
+ }
498
+ const validated = validateAitPayload(payload);
499
+ if (!validated.ok) {
500
+ lastFailure = "invalid_claims";
501
+ continue;
502
+ }
503
+ const claims = validated.payload;
504
+ const keyLookup = await opts.jwks.getKey(claims.iss, header.kid);
505
+ if (!keyLookup.ok) {
506
+ lastFailure = keyLookup.reason === "untrusted_issuer" || keyLookup.reason === "insecure_issuer" ? "untrusted_issuer" : "key_unavailable";
507
+ continue;
508
+ }
509
+ const jwtClockTolerance = opts.maxSkewSeconds ?? 60;
510
+ try {
511
+ const idpKey = await importJWK2(keyLookup.key, normalizeAlg(header.alg));
512
+ await jwtVerify(token, idpKey, {
513
+ // Pin the signature algorithm allowlist (RFC 8725 §3.1) — also rejects `alg:none`. Without
514
+ // this, jose accepts whatever alg the resolved JWK supports, so a trusted IdP publishing a
515
+ // non-Ed25519 (e.g. RSA/EC) `use:sig` key would let an attacker present an RS256/ES256
516
+ // token that verifies. Matches the server-side allowlist in the AgentScore API verifier.
517
+ algorithms: AIT_SIGNING_ALGS,
518
+ clockTolerance: jwtClockTolerance,
519
+ currentDate: opts.now !== void 0 ? new Date(opts.now * 1e3) : void 0
520
+ });
521
+ } catch (err) {
522
+ lastFailure = isExpiry(err) ? "expired_token" : "idp_signature_invalid";
523
+ continue;
524
+ }
525
+ const nowSec = opts.now ?? Math.floor(Date.now() / 1e3);
526
+ if (claims.iat > nowSec + jwtClockTolerance) {
527
+ lastFailure = "expired_token";
528
+ continue;
529
+ }
530
+ if (claims.exp - claims.iat > (opts.maxLifetimeSeconds ?? 300)) {
531
+ lastFailure = "expired_token";
532
+ continue;
533
+ }
534
+ const popResult = await verifyMessageSignature({
535
+ method: ctx.method,
536
+ authority: ctx.authority,
537
+ path: ctx.path,
538
+ // The agent-identity covered component is the BARE AIT (a Bearer prefix, if present, is
539
+ // transport that `stripBearer` removed above). Verify over `token`, not `raw`, so the edge and
540
+ // the API — which verifies over the forwarded bare aip_token — reconstruct the identical base.
541
+ agentIdentity: token,
542
+ signatureInput,
543
+ signature,
544
+ cnfJwk: claims.cnf.jwk,
545
+ now: opts.now,
546
+ maxSkewSeconds: opts.maxSkewSeconds
547
+ });
548
+ if (!popResult.ok) {
549
+ lastFailure = "pop_signature_invalid";
550
+ continue;
551
+ }
552
+ return {
553
+ ok: true,
554
+ ait: {
555
+ payload: claims,
556
+ iss: claims.iss,
557
+ cnfJwk: claims.cnf.jwk,
558
+ token,
559
+ signatureMaterial: {
560
+ method: ctx.method,
561
+ authority: ctx.authority,
562
+ path: ctx.path,
563
+ signature_input: signatureInput,
564
+ signature
565
+ }
566
+ }
567
+ };
568
+ }
569
+ return { ok: false, reason: lastFailure };
570
+ };
571
+ var stripBearer = (value) => {
572
+ const trimmed = value.trim();
573
+ return /^bearer\s+/i.test(trimmed) ? trimmed.replace(/^bearer\s+/i, "") : trimmed;
574
+ };
575
+ var AIT_SIGNING_ALGS = ["EdDSA", "ES256"];
576
+ var normalizeAlg = (alg) => alg.toLowerCase() === "eddsa" ? "EdDSA" : alg;
577
+ var isExpiry = (err) => typeof err === "object" && err !== null && err.code === "ERR_JWT_EXPIRED";
578
+
579
+ // src/aip/request.ts
580
+ var readAgentIdentityHeaders = (headers) => {
581
+ const raw = headers.get(AGENT_IDENTITY_HEADER);
582
+ if (!raw) {
583
+ return [];
584
+ }
585
+ return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
586
+ };
587
+ var deriveAuthority = (req, url) => req.headers.get("host") ?? url.host;
588
+ var buildVerifyContextFromRequest = (req, authority) => {
589
+ const url = new URL(req.url);
590
+ return {
591
+ method: req.method,
592
+ authority: authority ?? deriveAuthority(req, url),
593
+ path: url.pathname,
594
+ agentIdentityHeaders: readAgentIdentityHeaders(req.headers),
595
+ signatureInput: req.headers.get("signature-input"),
596
+ signature: req.headers.get("signature")
597
+ };
598
+ };
599
+ var hasAgentIdentityHeader = (req) => readAgentIdentityHeaders(req.headers).length > 0;
600
+
601
+ // src/aip/gate.ts
602
+ var aipErrorCode = (failure) => {
603
+ switch (failure) {
604
+ case "no_token":
605
+ case "pop_signature_missing":
606
+ return "agent_identity_required";
607
+ case "untrusted_issuer":
608
+ return "untrusted_issuer";
609
+ case "expired_token":
610
+ return "expired_token";
611
+ case "invalid_claims":
612
+ return "insufficient_claims";
613
+ case "key_unavailable":
614
+ return "idp_unavailable";
615
+ case "malformed_token":
616
+ case "idp_signature_invalid":
617
+ case "pop_signature_invalid":
618
+ return "invalid_signature";
619
+ default:
620
+ return "invalid_signature";
621
+ }
622
+ };
623
+ var aipErrorStatus = (failure) => {
624
+ switch (failure) {
625
+ case "key_unavailable":
626
+ return 503;
627
+ case "untrusted_issuer":
628
+ case "invalid_claims":
629
+ return 403;
630
+ default:
631
+ return 401;
632
+ }
633
+ };
634
+ var aipErrorDetail = (failure) => {
635
+ switch (failure) {
636
+ case "no_token":
637
+ return "No Agent-Identity token was presented.";
638
+ case "pop_signature_missing":
639
+ return "The request is missing the RFC 9421 HTTP Message Signature that proves possession of the token-bound key.";
640
+ case "untrusted_issuer":
641
+ return "The token's issuer is not in this service's trusted-issuer list.";
642
+ case "expired_token":
643
+ return "The Agent Identity Token has expired.";
644
+ case "invalid_claims":
645
+ return "The token is missing required claims for this endpoint.";
646
+ case "malformed_token":
647
+ return "The Agent-Identity header could not be parsed as an Agent Identity Token.";
648
+ case "idp_signature_invalid":
649
+ return "The identity provider's signature on the token failed verification.";
650
+ case "pop_signature_invalid":
651
+ return "The request signature did not match the key bound to the token.";
652
+ case "key_unavailable":
653
+ return "The identity provider's signing key could not be resolved.";
654
+ default:
655
+ return "Token verification failed.";
656
+ }
657
+ };
658
+ var buildAipErrorBody = (failure, requirements) => {
659
+ const code = aipErrorCode(failure);
660
+ const body = {
661
+ type: `urn:aip:error:${code}`,
662
+ title: code.replace(/_/g, " "),
663
+ status: aipErrorStatus(failure),
664
+ detail: aipErrorDetail(failure)
665
+ };
666
+ if (requirements) {
667
+ if (code === "untrusted_issuer" && requirements.trustedIssuers?.length) {
668
+ body.trusted_issuers = requirements.trustedIssuers;
669
+ }
670
+ if (code === "insufficient_claims") {
671
+ if (requirements.requiredClaims?.length) body.required_claims = requirements.requiredClaims;
672
+ if (requirements.requiredTrustLevel !== void 0) body.required_trust_level = requirements.requiredTrustLevel;
673
+ if (requirements.requiredAmr?.length) body.required_amr = requirements.requiredAmr;
674
+ }
675
+ }
676
+ return body;
677
+ };
678
+ var TRUST_RANK = { autonomous: 0, human_present: 1, human_confirmed: 2 };
679
+ var checkTrustRequirements = (payload, requiredTrustLevel, requiredAmr) => {
680
+ if (requiredTrustLevel !== void 0) {
681
+ const have = TRUST_RANK[payload.trust_level ?? "autonomous"] ?? 0;
682
+ const need = TRUST_RANK[requiredTrustLevel] ?? 0;
683
+ if (have < need) {
684
+ return `This endpoint requires trust_level '${requiredTrustLevel}'; the token asserts '${payload.trust_level ?? "autonomous"}'. Re-mint an AIT at the required trust level (human confirmation).`;
685
+ }
686
+ }
687
+ if (requiredAmr !== void 0 && requiredAmr.length > 0) {
688
+ const amr = Array.isArray(payload.auth?.amr) ? payload.auth.amr : [];
689
+ if (!amr.some((m) => requiredAmr.includes(m))) {
690
+ return `This endpoint requires an authentication method in [${requiredAmr.join(", ")}]; the token carries [${amr.join(", ") || "none"}].`;
691
+ }
692
+ }
693
+ return null;
694
+ };
695
+ var buildAipWeakAuthBody = (opts) => ({
696
+ type: "urn:aip:error:weak_auth",
697
+ title: "weak auth",
698
+ status: 403,
699
+ detail: opts.detail,
700
+ ...opts.requiredTrustLevel !== void 0 && { required_trust_level: opts.requiredTrustLevel },
701
+ ...opts.requiredAmr !== void 0 && opts.requiredAmr.length > 0 && { required_amr: opts.requiredAmr },
702
+ ...opts.trustedIssuers !== void 0 && opts.trustedIssuers.length > 0 && { trusted_issuers: opts.trustedIssuers }
703
+ });
704
+ var requirementsFromOptions = (opts) => ({
705
+ ...opts.trustedIssuers !== void 0 && { trustedIssuers: opts.trustedIssuers },
706
+ ...opts.requiredClaims !== void 0 && { requiredClaims: opts.requiredClaims },
707
+ ...opts.requireTrustLevel !== void 0 && { requiredTrustLevel: opts.requireTrustLevel },
708
+ ...opts.requireAmr !== void 0 && { requiredAmr: opts.requireAmr }
709
+ });
710
+ var evaluateFromContext = async (ctx, opts) => {
711
+ const result = await verifyAit(ctx, { jwks: opts.jwks, now: opts.now, maxSkewSeconds: opts.maxSkewSeconds });
712
+ if (!result.ok) {
713
+ return { ok: false, body: buildAipErrorBody(result.reason, requirementsFromOptions(opts)) };
714
+ }
715
+ const weak = checkTrustRequirements(result.ait.payload, opts.requireTrustLevel, opts.requireAmr);
716
+ if (weak !== null) {
717
+ return {
718
+ ok: false,
719
+ body: buildAipWeakAuthBody({
720
+ detail: weak,
721
+ ...opts.requireTrustLevel !== void 0 && { requiredTrustLevel: opts.requireTrustLevel },
722
+ ...opts.requireAmr !== void 0 && { requiredAmr: opts.requireAmr },
723
+ ...opts.trustedIssuers !== void 0 && { trustedIssuers: opts.trustedIssuers }
724
+ })
725
+ };
726
+ }
727
+ return { ok: true, ait: result.ait };
728
+ };
729
+ var evaluateAipRequest = (req, opts) => evaluateFromContext(buildVerifyContextFromRequest(req, opts.authority), opts);
730
+
134
731
  // src/core.ts
732
+ import { createHash } from "crypto";
135
733
  import {
136
734
  AgentScore,
137
735
  InvalidCredentialError,
@@ -207,7 +805,7 @@ function stripTrailingSlashes(s) {
207
805
  while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
208
806
  return end === s.length ? s : s.slice(0, end);
209
807
  }
210
- var CANONICAL_AGENTSCORE_API = "https://api.agentscore.sh";
808
+ var CANONICAL_AGENTSCORE_API = "https://api.agentscore.com";
211
809
  var WALLET_SIGNER_MISMATCH_INSTRUCTIONS = JSON.stringify({
212
810
  action: "resign_or_switch_to_operator_token",
213
811
  steps: [
@@ -233,17 +831,22 @@ var INVALID_CREDENTIAL_INSTRUCTIONS = JSON.stringify({
233
831
  ],
234
832
  user_message: "The operator_token is not recognized. Use a different stored token, or restart the verification session flow to mint a new one."
235
833
  });
236
- function buildAgentMemoryHint() {
834
+ function buildAgentMemoryHint(aipTrustedIssuers) {
237
835
  const api = CANONICAL_AGENTSCORE_API;
836
+ const acceptsAip = aipTrustedIssuers !== void 0 && aipTrustedIssuers.length > 0;
238
837
  return {
239
838
  save_for_future_agentscore_gates: true,
240
839
  pattern_summary: "AgentScore is a cross-merchant identity substrate for agent commerce. Any endpoint that returns 403 missing_identity / identity_verification_required or 402 challenges referencing AgentScore uses the same identity system. One KYC works across all AgentScore merchants \u2014 no re-verification per site. Save this pattern (and the endpoints below) to persistent memory so future AgentScore encounters skip the cold-start session flow.",
241
- quickstart: "https://docs.agentscore.sh/guides/agent-identity",
840
+ quickstart: "https://docs.agentscore.com/guides/agent-identity",
242
841
  identity_check_endpoint: `${api}/v1/credentials`,
243
842
  identity_paths: {
244
843
  wallet: "If paying from a crypto wallet you have used before on any AgentScore merchant, send `X-Wallet-Address: 0x...`. Shortest path; no token lifecycle to manage.",
245
- operator_token: "For any rail (Stripe SPT, card, or a wallet you have not linked yet), send `X-Operator-Token: opc_...`. Reusable across merchants until the token expires."
844
+ operator_token: "For any rail (Stripe SPT, card, or a wallet you have not linked yet), send `X-Operator-Token: opc_...`. Reusable across merchants until the token expires.",
845
+ ...acceptsAip && {
846
+ agent_identity: 'If you hold an AIP Agent Identity Token from a trusted issuer (see aip_trusted_issuers), present it: send the JWT in an `Agent-Identity` header plus an RFC 9421 HTTP Message Signature (Signature-Input + Signature over @method @authority @path agent-identity, tag="agent-identity") signed with the token-bound cnf key. The merchant verifies it and applies its policy \u2014 no separate AgentScore credential needed.'
847
+ }
246
848
  },
849
+ ...acceptsAip && { aip_trusted_issuers: aipTrustedIssuers },
247
850
  bootstrap: "If you have neither a linked wallet nor a valid operator_token, follow the session/verify flow in the per-request `agent_instructions` block. This happens at most once per agent identity \u2014 after first verification, the operator_token and any subsequently used wallet are reusable everywhere.",
248
851
  do_not_persist_in_memory: ["operator_token", "poll_secret"],
249
852
  persist_in_credential_store: ["operator_token"]
@@ -251,7 +854,7 @@ function buildAgentMemoryHint() {
251
854
  }
252
855
  function createAgentScoreCore(options) {
253
856
  if (!options.apiKey) {
254
- throw new Error("AgentScore API key is required. Get one at https://agentscore.sh/sign-up");
857
+ throw new Error("AgentScore API key is required. Get one at https://www.agentscore.com/sign-up");
255
858
  }
256
859
  const {
257
860
  apiKey,
@@ -262,14 +865,15 @@ function createAgentScoreCore(options) {
262
865
  allowedJurisdictions,
263
866
  failOpen = false,
264
867
  cacheSeconds = 300,
265
- baseUrl: rawBaseUrl = "https://api.agentscore.sh",
868
+ baseUrl: rawBaseUrl = "https://api.agentscore.com",
266
869
  chain: gateChain,
267
870
  userAgent,
268
- createSessionOnMissing
871
+ createSessionOnMissing,
872
+ aipTrustedIssuers
269
873
  } = options;
270
874
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
271
- const agentMemoryHint = buildAgentMemoryHint();
272
- const defaultUa = `@agent-score/commerce@${"2.4.0"}`;
875
+ const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
876
+ const defaultUa = `@agent-score/commerce@${"2.6.0"}`;
273
877
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
274
878
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
275
879
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -344,16 +948,21 @@ function createAgentScoreCore(options) {
344
948
  }
345
949
  }
346
950
  async function evaluate(identity, ctx, signer) {
347
- if (!identity || !identity.address && !identity.operatorToken) {
951
+ if (!identity || !identity.address?.trim() && !identity.operatorToken?.trim() && !identity.aipToken?.trim()) {
348
952
  if (failOpen) return { kind: "allow" };
349
953
  const sessionReason = await tryMintSessionDenial(ctx);
350
954
  if (sessionReason) return { kind: "deny", reason: sessionReason };
955
+ const acceptsAip = aipTrustedIssuers !== void 0 && aipTrustedIssuers.length > 0;
956
+ const aipStep = acceptsAip ? [
957
+ `If you hold an AIP Agent Identity Token from a trusted issuer (${aipTrustedIssuers.join(", ")}): present it \u2014 send the JWT in an Agent-Identity header plus an RFC 9421 HTTP Message Signature (Signature-Input + Signature over @method @authority @path agent-identity, tag="agent-identity") signed with the token-bound cnf key. This satisfies identity in one round trip without an AgentScore credential.`
958
+ ] : [];
351
959
  const missingIdentityInstructions = JSON.stringify({
352
960
  action: "probe_identity_then_session",
353
961
  steps: [
962
+ ...aipStep,
354
963
  "If you have a wallet AND this merchant accepts a wallet-signing rail (Tempo MPP or x402 \u2014 see openapi.json x-payment-info): send X-Wallet-Address and retry. If the wallet is already linked to an AgentScore operator (via prior SIWE claim or prior captureWallet), this passes in one round trip. If the wallet is unlinked or the account has no KYC, the 403 will include a verify_url \u2014 share it with the user to claim the wallet + complete KYC, then retry.",
355
964
  "If step 1 is denied or you already have a stored operator_token (valid + not expired): send X-Operator-Token: opc_... and retry.",
356
- "If neither applies: retry with NO identity header. Merchants that auto-create verification sessions (most AgentScore merchants do) return verify_url + session_id + poll_secret in the 403 body \u2014 share verify_url with the user, then poll poll_url every 5s with the X-Poll-Secret header until status=verified (the poll returns a one-time operator_token). If the retry returns the same bare 403, this merchant does not support self-service session bootstrapping \u2014 direct the user to https://agentscore.sh/sign-up to create an AgentScore identity and mint an operator_token from their dashboard (https://agentscore.sh/dashboard/verify). The user hands the opc_... to you, and you retry with X-Operator-Token."
965
+ "If neither applies: retry with NO identity header. Merchants that auto-create verification sessions (most AgentScore merchants do) return verify_url + session_id + poll_secret in the 403 body \u2014 share verify_url with the user, then poll poll_url every 5s with the X-Poll-Secret header until status=verified (the poll returns a one-time operator_token). If the retry returns the same bare 403, this merchant does not support self-service session bootstrapping \u2014 direct the user to https://www.agentscore.com/sign-up to create an AgentScore identity and mint an operator_token from their dashboard (https://www.agentscore.com/dashboard/verify). The user hands the opc_... to you, and you retry with X-Operator-Token."
357
966
  ],
358
967
  user_message: "Try X-Wallet-Address first if you have a wallet and the merchant accepts Tempo/x402; fall back to a stored X-Operator-Token, then to the session/verify flow described in agent_memory.bootstrap."
359
968
  });
@@ -366,21 +975,26 @@ function createAgentScoreCore(options) {
366
975
  }
367
976
  };
368
977
  }
369
- const cacheKey = identity.operatorToken?.toLowerCase() ?? (identity.address ? normalizeAddress(identity.address) : "");
978
+ const identityKey = identity.aipToken ? `aip:${createHash("sha256").update(identity.aipToken).digest("hex")}` : identity.operatorToken?.toLowerCase() ?? (identity.address ? normalizeAddress(identity.address) : "");
979
+ const cacheKey = signer ? JSON.stringify([identityKey, signer.network, normalizeAddress(signer.address)]) : JSON.stringify([identityKey]);
370
980
  const cached = cache.get(cacheKey);
371
981
  if (cached) {
982
+ const cachedVerdict = cached.raw ? buildSignerVerdict(identity, cached.raw) : void 0;
372
983
  if (cached.allow) {
373
984
  const cachedRaw = cached.raw;
374
985
  const cachedQuota = cachedRaw?.quota;
375
986
  return {
376
987
  kind: "allow",
377
988
  data: cachedRaw,
378
- ...cachedQuota !== void 0 && { quota: cachedQuota }
989
+ ...cachedQuota !== void 0 && { quota: cachedQuota },
990
+ ...cachedVerdict !== void 0 && { signerVerdict: cachedVerdict }
379
991
  };
380
992
  }
381
993
  if (isFixableDenial(cached.reasons)) {
382
994
  const sessionReason = await tryMintSessionDenial(ctx);
383
- if (sessionReason) return { kind: "deny", reason: sessionReason };
995
+ if (sessionReason) {
996
+ return { kind: "deny", reason: sessionReason, ...cachedVerdict !== void 0 && { signerVerdict: cachedVerdict } };
997
+ }
384
998
  }
385
999
  return {
386
1000
  kind: "deny",
@@ -390,7 +1004,8 @@ function createAgentScoreCore(options) {
390
1004
  reasons: cached.reasons,
391
1005
  verify_url: cached.raw?.verify_url,
392
1006
  data: cached.raw
393
- }
1007
+ },
1008
+ ...cachedVerdict !== void 0 && { signerVerdict: cachedVerdict }
394
1009
  };
395
1010
  }
396
1011
  const policy = {};
@@ -411,7 +1026,10 @@ function createAgentScoreCore(options) {
411
1026
  // regardless of policy.require_sanctions_clear (which gates the separate NAME screen).
412
1027
  ...signer && { signer: { address: signer.address, network: signer.network } }
413
1028
  };
414
- const result = identity.address ? await sdk.assess(identity.address, { ...opts, operatorToken: identity.operatorToken }) : await sdk.assess(null, { ...opts, operatorToken: identity.operatorToken });
1029
+ if (identity.aipToken !== void 0 && identity.aipSignature === void 0) {
1030
+ throw new Error("AgentScoreCore.evaluate: aipToken requires aipSignature (RFC 9421 proof-of-possession material).");
1031
+ }
1032
+ const result = identity.aipToken !== void 0 && identity.aipSignature !== void 0 ? await sdk.assess(null, { ...opts, aipToken: identity.aipToken, aipSignature: identity.aipSignature }) : identity.address ? await sdk.assess(identity.address, { ...opts, operatorToken: identity.operatorToken }) : await sdk.assess(null, { ...opts, operatorToken: identity.operatorToken });
415
1033
  data = result;
416
1034
  } catch (err) {
417
1035
  if (err instanceof PaymentRequiredError) {
@@ -482,17 +1100,21 @@ function createAgentScoreCore(options) {
482
1100
  const decisionReasons = data.decision_reasons ?? [];
483
1101
  const allow = decision === "allow" || decision == null;
484
1102
  cache.set(cacheKey, { allow, decision: decision ?? void 0, reasons: decisionReasons, raw: data });
1103
+ const signerVerdict = buildSignerVerdict(identity, data);
485
1104
  if (allow) {
486
1105
  const quota = data.quota;
487
1106
  return {
488
1107
  kind: "allow",
489
1108
  data,
490
- ...quota !== void 0 && { quota }
1109
+ ...quota !== void 0 && { quota },
1110
+ ...signerVerdict !== void 0 && { signerVerdict }
491
1111
  };
492
1112
  }
493
1113
  if (isFixableDenial(decisionReasons)) {
494
1114
  const sessionReason = await tryMintSessionDenial(ctx);
495
- if (sessionReason) return { kind: "deny", reason: sessionReason };
1115
+ if (sessionReason) {
1116
+ return { kind: "deny", reason: sessionReason, ...signerVerdict !== void 0 && { signerVerdict } };
1117
+ }
496
1118
  }
497
1119
  return {
498
1120
  kind: "deny",
@@ -502,7 +1124,8 @@ function createAgentScoreCore(options) {
502
1124
  reasons: decisionReasons,
503
1125
  verify_url: data.verify_url,
504
1126
  data
505
- }
1127
+ },
1128
+ ...signerVerdict !== void 0 && { signerVerdict }
506
1129
  };
507
1130
  }
508
1131
  async function captureWallet2(options2) {
@@ -544,22 +1167,21 @@ function createAgentScoreCore(options) {
544
1167
  agentInstructions: sm.agent_instructions ?? WALLET_SIGNER_MISMATCH_INSTRUCTIONS
545
1168
  };
546
1169
  }
547
- function getSignerVerdict2(claimedAddress) {
548
- const claimedNorm = normalizeAddress(claimedAddress);
549
- const cached = cache.get(claimedNorm);
550
- if (!cached) return void 0;
551
- const raw = cached.raw;
552
- if (!raw) return void 0;
1170
+ function buildSignerVerdict(identity, raw) {
1171
+ if (identity.address === void 0 || identity.operatorToken !== void 0 || identity.aipToken !== void 0) {
1172
+ return void 0;
1173
+ }
553
1174
  const rawMatch = raw.signer_match;
554
1175
  const rawSanctions = raw.signer_sanctions;
555
1176
  if (!rawMatch && !rawSanctions) return void 0;
1177
+ const claimedNorm = normalizeAddress(identity.address);
556
1178
  const signerNorm = rawMatch?.actual_signer ?? claimedNorm;
557
1179
  return {
558
1180
  signer_match: rawMatch ? projectSignerMatch(rawMatch, claimedNorm, signerNorm) : null,
559
1181
  signer_sanctions: rawSanctions ?? null
560
1182
  };
561
1183
  }
562
- return { evaluate, captureWallet: captureWallet2, getSignerVerdict: getSignerVerdict2 };
1184
+ return { evaluate, captureWallet: captureWallet2 };
563
1185
  }
564
1186
 
565
1187
  // src/payment/payment_header.ts
@@ -691,18 +1313,23 @@ function agentscoreGate(options) {
691
1313
  const signer = await extractPaymentSigner(c.req.raw, readX402PaymentHeader(c.req.raw));
692
1314
  const outcome = await core.evaluate(identity, c, signer);
693
1315
  if (outcome.kind === "allow") {
694
- if (outcome.degraded || outcome.quota) {
1316
+ if (outcome.degraded || outcome.quota || outcome.signerVerdict) {
695
1317
  const prev = c.get(GATE_STATE_KEY);
696
1318
  c.set(GATE_STATE_KEY, {
697
1319
  ...prev,
698
1320
  ...outcome.degraded && { degraded: true, infraReason: outcome.infraReason },
699
- ...outcome.quota && { quota: outcome.quota }
1321
+ ...outcome.quota && { quota: outcome.quota },
1322
+ ...outcome.signerVerdict && { signerVerdict: outcome.signerVerdict }
700
1323
  });
701
1324
  }
702
1325
  if (outcome.data) c.set(CONTEXT_KEY, outcome.data);
703
1326
  await next();
704
1327
  return;
705
1328
  }
1329
+ if (outcome.signerVerdict) {
1330
+ const prev = c.get(GATE_STATE_KEY);
1331
+ c.set(GATE_STATE_KEY, { ...prev, signerVerdict: outcome.signerVerdict });
1332
+ }
706
1333
  return onDenied(c, outcome.reason);
707
1334
  };
708
1335
  }
@@ -729,8 +1356,7 @@ async function captureWallet(c, options) {
729
1356
  }
730
1357
  function getSignerVerdict(c) {
731
1358
  const state = c.get(GATE_STATE_KEY);
732
- if (!state?.walletAddress) return void 0;
733
- return state.core.getSignerVerdict(state.walletAddress);
1359
+ return state?.signerVerdict;
734
1360
  }
735
1361
  function conditionalAgentscoreGate(options) {
736
1362
  const gate = agentscoreGate(options);
@@ -742,13 +1368,47 @@ function conditionalAgentscoreGate(options) {
742
1368
  return gate(c, next);
743
1369
  };
744
1370
  }
1371
+ var AIT_CONTEXT_KEY = "__agentscoreAit";
1372
+ function defaultAipOnDenied(_c, body) {
1373
+ return new Response(JSON.stringify(body), {
1374
+ status: body.status,
1375
+ headers: { "content-type": "application/problem+json" }
1376
+ });
1377
+ }
1378
+ function aipGate(options) {
1379
+ const { onDenied = defaultAipOnDenied, ...gateOpts } = options;
1380
+ return async (c, next) => {
1381
+ const result = await evaluateAipRequest(c.req.raw, gateOpts);
1382
+ if (!result.ok) {
1383
+ return onDenied(c, result.body);
1384
+ }
1385
+ c.set(AIT_CONTEXT_KEY, result.ait);
1386
+ await next();
1387
+ };
1388
+ }
1389
+ function conditionalAipGate(options) {
1390
+ const gate = aipGate(options);
1391
+ return async (c, next) => {
1392
+ if (!hasAgentIdentityHeader(c.req.raw)) {
1393
+ await next();
1394
+ return;
1395
+ }
1396
+ return gate(c, next);
1397
+ };
1398
+ }
1399
+ function getVerifiedAit(c) {
1400
+ return c.get(AIT_CONTEXT_KEY);
1401
+ }
745
1402
  export {
746
1403
  agentscoreGate,
1404
+ aipGate,
747
1405
  captureWallet,
748
1406
  conditionalAgentscoreGate,
1407
+ conditionalAipGate,
749
1408
  getAgentScoreData,
750
1409
  getGateDegradedState,
751
1410
  getGateQuotaInfo,
752
- getSignerVerdict
1411
+ getSignerVerdict,
1412
+ getVerifiedAit
753
1413
  };
754
1414
  //# sourceMappingURL=hono.mjs.map