@agent-score/commerce 2.3.0 → 2.5.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.
- package/README.md +6 -6
- package/dist/challenge/index.d.mts +9 -5
- package/dist/challenge/index.d.ts +9 -5
- package/dist/challenge/index.js +11 -4
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +11 -4
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-ChyOi7aU.d.ts → checkout-McfNpZJf.d.ts} +80 -12
- package/dist/{checkout-Ceo1_rVJ.d.mts → checkout-o17dIxHi.d.mts} +80 -12
- package/dist/core.d.mts +27 -7
- package/dist/core.d.ts +27 -7
- package/dist/core.js +25 -11
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +25 -11
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +26 -10
- package/dist/discovery/index.d.ts +26 -10
- package/dist/discovery/index.js +58 -10
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +58 -10
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/gate-CWP10xPQ.d.mts +339 -0
- package/dist/gate-CWP10xPQ.d.ts +339 -0
- package/dist/identity/express.d.mts +26 -1
- package/dist/identity/express.d.ts +26 -1
- package/dist/identity/express.js +599 -25
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +595 -24
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +12 -2
- package/dist/identity/fastify.d.ts +12 -2
- package/dist/identity/fastify.js +607 -25
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +603 -24
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +26 -1
- package/dist/identity/hono.d.ts +26 -1
- package/dist/identity/hono.js +588 -25
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +584 -24
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +3 -0
- package/dist/identity/nextjs.d.ts +3 -0
- package/dist/identity/nextjs.js +593 -25
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +589 -24
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +24 -1
- package/dist/identity/web.d.ts +24 -1
- package/dist/identity/web.js +593 -25
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +589 -24
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +129 -14
- package/dist/index.d.ts +129 -14
- package/dist/index.js +978 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +956 -99
- package/dist/index.mjs.map +1 -1
- package/dist/{default_rails-DtR_E9N9.d.ts → network_kind-BIJM2peR.d.ts} +22 -8
- package/dist/{default_rails-K25PtWrL.d.mts → network_kind-C0EMkdzz.d.mts} +22 -8
- package/dist/payment/index.d.mts +16 -26
- package/dist/payment/index.d.ts +16 -26
- package/dist/payment/index.js +62 -57
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +62 -57
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{pricing-B3-aKxSz.d.ts → pricing-CytRwhC2.d.ts} +1 -1
- package/dist/{pricing-BReyZiqN.d.mts → pricing-KHDqMLd7.d.mts} +1 -1
- package/dist/{rail_spec-B1239jPp.d.mts → rail_spec-BFZmW9RN.d.mts} +3 -4
- package/dist/{rail_spec-B1239jPp.d.ts → rail_spec-BFZmW9RN.d.ts} +3 -4
- package/dist/stripe-multichain/index.d.mts +2 -9
- package/dist/stripe-multichain/index.d.ts +2 -9
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/{wwwauthenticate-D_FMnPgU.d.mts → wwwauthenticate-CVaGUMjU.d.mts} +8 -6
- package/dist/{wwwauthenticate-D_FMnPgU.d.ts → wwwauthenticate-CVaGUMjU.d.ts} +8 -6
- package/package.json +14 -13
package/dist/identity/hono.js
CHANGED
|
@@ -21,12 +21,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var hono_exports = {};
|
|
22
22
|
__export(hono_exports, {
|
|
23
23
|
agentscoreGate: () => agentscoreGate,
|
|
24
|
+
aipGate: () => aipGate,
|
|
24
25
|
captureWallet: () => captureWallet,
|
|
25
26
|
conditionalAgentscoreGate: () => conditionalAgentscoreGate,
|
|
27
|
+
conditionalAipGate: () => conditionalAipGate,
|
|
26
28
|
getAgentScoreData: () => getAgentScoreData,
|
|
27
29
|
getGateDegradedState: () => getGateDegradedState,
|
|
28
30
|
getGateQuotaInfo: () => getGateQuotaInfo,
|
|
29
|
-
getSignerVerdict: () => getSignerVerdict
|
|
31
|
+
getSignerVerdict: () => getSignerVerdict,
|
|
32
|
+
getVerifiedAit: () => getVerifiedAit
|
|
30
33
|
});
|
|
31
34
|
module.exports = __toCommonJS(hono_exports);
|
|
32
35
|
|
|
@@ -163,7 +166,520 @@ function denialReasonToBody(reason) {
|
|
|
163
166
|
return body;
|
|
164
167
|
}
|
|
165
168
|
|
|
169
|
+
// src/aip/verify.ts
|
|
170
|
+
var import_jose2 = require("jose");
|
|
171
|
+
|
|
172
|
+
// src/aip/http-signature.ts
|
|
173
|
+
var import_jose = require("jose");
|
|
174
|
+
var { subtle } = globalThis.crypto;
|
|
175
|
+
var b64ToBytes = (b64) => {
|
|
176
|
+
const bin = atob(b64);
|
|
177
|
+
const out = new Uint8Array(bin.length);
|
|
178
|
+
for (let i = 0; i < bin.length; i++) {
|
|
179
|
+
out[i] = bin.charCodeAt(i);
|
|
180
|
+
}
|
|
181
|
+
return out;
|
|
182
|
+
};
|
|
183
|
+
var AIP_COVERED_COMPONENTS = ["@method", "@authority", "@path", "agent-identity"];
|
|
184
|
+
var AIP_SIGNATURE_TAG = "agent-identity";
|
|
185
|
+
var DEFAULT_MAX_SKEW_SECONDS = 60;
|
|
186
|
+
var normalizeAuthority = (authority) => {
|
|
187
|
+
const lower = authority.trim().toLowerCase();
|
|
188
|
+
const colon = lower.lastIndexOf(":");
|
|
189
|
+
if (colon === -1) {
|
|
190
|
+
return lower;
|
|
191
|
+
}
|
|
192
|
+
if (lower.includes("]") && colon < lower.indexOf("]")) {
|
|
193
|
+
return lower;
|
|
194
|
+
}
|
|
195
|
+
const host = lower.slice(0, colon);
|
|
196
|
+
const port = lower.slice(colon + 1);
|
|
197
|
+
if (port === "80" || port === "443") {
|
|
198
|
+
return host;
|
|
199
|
+
}
|
|
200
|
+
return lower;
|
|
201
|
+
};
|
|
202
|
+
var componentValue = (name, input) => {
|
|
203
|
+
switch (name) {
|
|
204
|
+
case "@method":
|
|
205
|
+
return input.method.toUpperCase();
|
|
206
|
+
case "@authority":
|
|
207
|
+
return normalizeAuthority(input.authority);
|
|
208
|
+
case "@path":
|
|
209
|
+
return input.path;
|
|
210
|
+
case "agent-identity":
|
|
211
|
+
return input.agentIdentity.trim();
|
|
212
|
+
default:
|
|
213
|
+
return input.extra?.[name] ?? null;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
var serializeComponentList = (components) => `(${components.map((c) => `"${c}"`).join(" ")})`;
|
|
217
|
+
var serializeParams = (p) => {
|
|
218
|
+
const parts = [];
|
|
219
|
+
if (p.created !== void 0) {
|
|
220
|
+
parts.push(`created=${p.created}`);
|
|
221
|
+
}
|
|
222
|
+
if (p.expires !== void 0) {
|
|
223
|
+
parts.push(`expires=${p.expires}`);
|
|
224
|
+
}
|
|
225
|
+
if (p.keyid !== void 0) {
|
|
226
|
+
parts.push(`keyid="${p.keyid}"`);
|
|
227
|
+
}
|
|
228
|
+
if (p.alg !== void 0) {
|
|
229
|
+
parts.push(`alg="${p.alg}"`);
|
|
230
|
+
}
|
|
231
|
+
if (p.tag !== void 0) {
|
|
232
|
+
parts.push(`tag="${p.tag}"`);
|
|
233
|
+
}
|
|
234
|
+
return parts.map((s) => `;${s}`).join("");
|
|
235
|
+
};
|
|
236
|
+
var buildSignatureBase = (params, input) => {
|
|
237
|
+
const lines = [];
|
|
238
|
+
for (const name of params.components) {
|
|
239
|
+
const value = componentValue(name, input);
|
|
240
|
+
if (value === null) {
|
|
241
|
+
throw new MissingComponentError(name);
|
|
242
|
+
}
|
|
243
|
+
lines.push(`"${name}": ${value}`);
|
|
244
|
+
}
|
|
245
|
+
const paramsValue = serializeComponentList(params.components) + serializeParams(params);
|
|
246
|
+
lines.push(`"@signature-params": ${paramsValue}`);
|
|
247
|
+
return lines.join("\n");
|
|
248
|
+
};
|
|
249
|
+
var MissingComponentError = class extends Error {
|
|
250
|
+
constructor(component) {
|
|
251
|
+
super(`signature base missing covered component: ${component}`);
|
|
252
|
+
this.component = component;
|
|
253
|
+
this.name = "MissingComponentError";
|
|
254
|
+
}
|
|
255
|
+
component;
|
|
256
|
+
};
|
|
257
|
+
var parseSignatureInput = (header, tag = AIP_SIGNATURE_TAG) => {
|
|
258
|
+
const members = splitDictionary(header);
|
|
259
|
+
if (members.length === 0) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
const parsed = members.map((m) => {
|
|
263
|
+
const params = parseInnerListMember(m.value);
|
|
264
|
+
return params ? { label: m.label, params } : null;
|
|
265
|
+
}).filter((x) => x !== null);
|
|
266
|
+
if (parsed.length === 0) {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
const tagged = parsed.find((p) => p.params.tag === tag);
|
|
270
|
+
if (tagged) {
|
|
271
|
+
return tagged;
|
|
272
|
+
}
|
|
273
|
+
if (parsed.length === 1 && parsed[0].params.tag === void 0) {
|
|
274
|
+
return parsed[0];
|
|
275
|
+
}
|
|
276
|
+
return null;
|
|
277
|
+
};
|
|
278
|
+
var parseSignatureValue = (header, label) => {
|
|
279
|
+
const members = splitDictionary(header);
|
|
280
|
+
const member = members.find((m) => m.label === label);
|
|
281
|
+
if (!member) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const v = member.value.trim();
|
|
285
|
+
if (!v.startsWith(":") || !v.endsWith(":") || v.length < 2) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
const b64 = v.slice(1, -1);
|
|
289
|
+
try {
|
|
290
|
+
return b64ToBytes(b64);
|
|
291
|
+
} catch {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
var splitDictionary = (header) => {
|
|
296
|
+
const out = [];
|
|
297
|
+
let depth = 0;
|
|
298
|
+
let inBytes = false;
|
|
299
|
+
let inString = false;
|
|
300
|
+
let current = "";
|
|
301
|
+
for (let i = 0; i < header.length; i++) {
|
|
302
|
+
const ch = header[i];
|
|
303
|
+
if (inString) {
|
|
304
|
+
current += ch;
|
|
305
|
+
if (ch === '"' && header[i - 1] !== "\\") {
|
|
306
|
+
inString = false;
|
|
307
|
+
}
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (ch === '"') {
|
|
311
|
+
inString = true;
|
|
312
|
+
current += ch;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (ch === ":") {
|
|
316
|
+
inBytes = !inBytes;
|
|
317
|
+
current += ch;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (!inBytes && ch === "(") {
|
|
321
|
+
depth++;
|
|
322
|
+
current += ch;
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
if (!inBytes && ch === ")") {
|
|
326
|
+
depth = Math.max(0, depth - 1);
|
|
327
|
+
current += ch;
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (!inBytes && depth === 0 && ch === ",") {
|
|
331
|
+
pushMember(out, current);
|
|
332
|
+
current = "";
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
current += ch;
|
|
336
|
+
}
|
|
337
|
+
pushMember(out, current);
|
|
338
|
+
return out;
|
|
339
|
+
};
|
|
340
|
+
var pushMember = (out, raw) => {
|
|
341
|
+
const trimmed = raw.trim();
|
|
342
|
+
if (!trimmed) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const eq = trimmed.indexOf("=");
|
|
346
|
+
if (eq === -1) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const label = trimmed.slice(0, eq).trim();
|
|
350
|
+
const value = trimmed.slice(eq + 1).trim();
|
|
351
|
+
if (label) {
|
|
352
|
+
out.push({ label, value });
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var parseInnerListMember = (value) => {
|
|
356
|
+
const open = value.indexOf("(");
|
|
357
|
+
const close = value.indexOf(")", open + 1);
|
|
358
|
+
if (open === -1 || close === -1) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
const listBody = value.slice(open + 1, close).trim();
|
|
362
|
+
const components = listBody.length === 0 ? [] : (listBody.match(/"[^"]*"/g) ?? []).map((s) => s.slice(1, -1));
|
|
363
|
+
const params = { components };
|
|
364
|
+
const paramStr = value.slice(close + 1);
|
|
365
|
+
const re = /;\s*([a-zA-Z][a-zA-Z0-9_-]*)\s*=\s*("(?:[^"\\]|\\.)*"|-?\d+)/g;
|
|
366
|
+
let match;
|
|
367
|
+
while ((match = re.exec(paramStr)) !== null) {
|
|
368
|
+
const key = match[1];
|
|
369
|
+
const raw = match[2];
|
|
370
|
+
const val = raw.startsWith('"') ? raw.slice(1, -1) : Number(raw);
|
|
371
|
+
if (key === "created") {
|
|
372
|
+
params.created = val;
|
|
373
|
+
} else if (key === "expires") {
|
|
374
|
+
params.expires = val;
|
|
375
|
+
} else if (key === "keyid") {
|
|
376
|
+
params.keyid = val;
|
|
377
|
+
} else if (key === "tag") {
|
|
378
|
+
params.tag = val;
|
|
379
|
+
} else if (key === "alg") {
|
|
380
|
+
params.alg = val;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return params;
|
|
384
|
+
};
|
|
385
|
+
var verifyMessageSignature = async (input) => {
|
|
386
|
+
const selected = parseSignatureInput(input.signatureInput);
|
|
387
|
+
if (!selected) {
|
|
388
|
+
return { ok: false, reason: "no_aip_signature" };
|
|
389
|
+
}
|
|
390
|
+
const { label, params } = selected;
|
|
391
|
+
if (params.alg !== void 0 && !["ed25519", "eddsa"].includes(params.alg.toLowerCase())) {
|
|
392
|
+
return { ok: false, reason: "unsupported_alg" };
|
|
393
|
+
}
|
|
394
|
+
for (const required of AIP_COVERED_COMPONENTS) {
|
|
395
|
+
if (!params.components.includes(required)) {
|
|
396
|
+
return { ok: false, reason: "missing_covered_component" };
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const now = input.now ?? Math.floor(Date.now() / 1e3);
|
|
400
|
+
const skew = input.maxSkewSeconds ?? DEFAULT_MAX_SKEW_SECONDS;
|
|
401
|
+
if (params.created !== void 0 && params.created > now + skew) {
|
|
402
|
+
return { ok: false, reason: "created_in_future" };
|
|
403
|
+
}
|
|
404
|
+
if (params.expires !== void 0 && params.expires < now - skew) {
|
|
405
|
+
return { ok: false, reason: "expired" };
|
|
406
|
+
}
|
|
407
|
+
if (!params.keyid) {
|
|
408
|
+
return { ok: false, reason: "missing_keyid" };
|
|
409
|
+
}
|
|
410
|
+
const cnf = input.cnfJwk;
|
|
411
|
+
if (cnf.kty !== "OKP" || cnf.crv !== "Ed25519" || typeof cnf.x !== "string" || cnf.x.length === 0) {
|
|
412
|
+
return { ok: false, reason: "unsupported_cnf_key" };
|
|
413
|
+
}
|
|
414
|
+
let thumbprint;
|
|
415
|
+
try {
|
|
416
|
+
thumbprint = await (0, import_jose.calculateJwkThumbprint)(input.cnfJwk, "sha256");
|
|
417
|
+
} catch {
|
|
418
|
+
return { ok: false, reason: "unsupported_cnf_key" };
|
|
419
|
+
}
|
|
420
|
+
if (params.keyid !== thumbprint) {
|
|
421
|
+
return { ok: false, reason: "keyid_mismatch" };
|
|
422
|
+
}
|
|
423
|
+
const sig = parseSignatureValue(input.signature, label);
|
|
424
|
+
if (!sig) {
|
|
425
|
+
return { ok: false, reason: "malformed_signature" };
|
|
426
|
+
}
|
|
427
|
+
let base;
|
|
428
|
+
try {
|
|
429
|
+
base = buildSignatureBase(params, {
|
|
430
|
+
method: input.method,
|
|
431
|
+
authority: input.authority,
|
|
432
|
+
path: input.path,
|
|
433
|
+
agentIdentity: input.agentIdentity,
|
|
434
|
+
extra: input.extraComponents
|
|
435
|
+
});
|
|
436
|
+
} catch (err) {
|
|
437
|
+
if (err instanceof MissingComponentError) {
|
|
438
|
+
return { ok: false, reason: "missing_covered_component" };
|
|
439
|
+
}
|
|
440
|
+
throw err;
|
|
441
|
+
}
|
|
442
|
+
let valid;
|
|
443
|
+
try {
|
|
444
|
+
const key = await (0, import_jose.importJWK)(input.cnfJwk, "EdDSA");
|
|
445
|
+
if (!(key instanceof CryptoKey)) {
|
|
446
|
+
return { ok: false, reason: "signature_invalid" };
|
|
447
|
+
}
|
|
448
|
+
valid = await subtle.verify(
|
|
449
|
+
{ name: "Ed25519" },
|
|
450
|
+
key,
|
|
451
|
+
sig,
|
|
452
|
+
new TextEncoder().encode(base)
|
|
453
|
+
);
|
|
454
|
+
} catch {
|
|
455
|
+
return { ok: false, reason: "signature_invalid" };
|
|
456
|
+
}
|
|
457
|
+
return valid ? { ok: true, params } : { ok: false, reason: "signature_invalid" };
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// src/aip/types.ts
|
|
461
|
+
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
462
|
+
var isNonEmptyString = (v) => typeof v === "string" && v.length > 0;
|
|
463
|
+
var isAitShape = (payload) => isObject(payload) && isObject(payload.cnf) && isObject(payload.agent);
|
|
464
|
+
var validateAitPayload = (payload) => {
|
|
465
|
+
if (!isObject(payload)) {
|
|
466
|
+
return { ok: false, reason: "not_an_object" };
|
|
467
|
+
}
|
|
468
|
+
if (!isNonEmptyString(payload.aip_version)) {
|
|
469
|
+
return { ok: false, reason: "missing_aip_version" };
|
|
470
|
+
}
|
|
471
|
+
if (!isNonEmptyString(payload.iss)) {
|
|
472
|
+
return { ok: false, reason: "missing_iss" };
|
|
473
|
+
}
|
|
474
|
+
if (!isNonEmptyString(payload.sub)) {
|
|
475
|
+
return { ok: false, reason: "missing_sub" };
|
|
476
|
+
}
|
|
477
|
+
if (typeof payload.iat !== "number") {
|
|
478
|
+
return { ok: false, reason: "missing_iat" };
|
|
479
|
+
}
|
|
480
|
+
if (typeof payload.exp !== "number") {
|
|
481
|
+
return { ok: false, reason: "missing_exp" };
|
|
482
|
+
}
|
|
483
|
+
if (!isObject(payload.cnf) || !isObject(payload.cnf.jwk)) {
|
|
484
|
+
return { ok: false, reason: "missing_cnf" };
|
|
485
|
+
}
|
|
486
|
+
if (!isObject(payload.agent) || !isNonEmptyString(payload.agent.provider)) {
|
|
487
|
+
return { ok: false, reason: "missing_agent_provider" };
|
|
488
|
+
}
|
|
489
|
+
if (payload.trust_level === "human_confirmed") {
|
|
490
|
+
const auth = payload.auth;
|
|
491
|
+
const amr = isObject(auth) ? auth.amr : void 0;
|
|
492
|
+
if (!Array.isArray(amr) || amr.length === 0) {
|
|
493
|
+
return { ok: false, reason: "human_confirmed_without_amr" };
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return { ok: true, payload };
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
// src/aip/verify.ts
|
|
500
|
+
var AGENT_IDENTITY_HEADER = "agent-identity";
|
|
501
|
+
var verifyAit = async (ctx, opts) => {
|
|
502
|
+
if (ctx.agentIdentityHeaders.length === 0) {
|
|
503
|
+
return { ok: false, reason: "no_token" };
|
|
504
|
+
}
|
|
505
|
+
if (!ctx.signatureInput || !ctx.signature) {
|
|
506
|
+
return { ok: false, reason: "pop_signature_missing" };
|
|
507
|
+
}
|
|
508
|
+
let lastFailure = "malformed_token";
|
|
509
|
+
for (const raw of ctx.agentIdentityHeaders) {
|
|
510
|
+
const token = stripBearer(raw);
|
|
511
|
+
let header;
|
|
512
|
+
let payload;
|
|
513
|
+
try {
|
|
514
|
+
header = (0, import_jose2.decodeProtectedHeader)(token);
|
|
515
|
+
payload = (0, import_jose2.decodeJwt)(token);
|
|
516
|
+
} catch {
|
|
517
|
+
lastFailure = "malformed_token";
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
if (header.alg === void 0 || header.alg.toLowerCase() === "none") {
|
|
521
|
+
lastFailure = "malformed_token";
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
if (!isAitShape(payload)) {
|
|
525
|
+
lastFailure = "malformed_token";
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
528
|
+
const validated = validateAitPayload(payload);
|
|
529
|
+
if (!validated.ok) {
|
|
530
|
+
lastFailure = "invalid_claims";
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
const claims = validated.payload;
|
|
534
|
+
const keyLookup = await opts.jwks.getKey(claims.iss, header.kid);
|
|
535
|
+
if (!keyLookup.ok) {
|
|
536
|
+
lastFailure = keyLookup.reason === "untrusted_issuer" || keyLookup.reason === "insecure_issuer" ? "untrusted_issuer" : "key_unavailable";
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
const jwtClockTolerance = opts.maxSkewSeconds ?? 60;
|
|
540
|
+
try {
|
|
541
|
+
const idpKey = await (0, import_jose2.importJWK)(keyLookup.key, normalizeAlg(header.alg));
|
|
542
|
+
await (0, import_jose2.jwtVerify)(token, idpKey, {
|
|
543
|
+
// Pin the signature algorithm allowlist (RFC 8725 §3.1) — also rejects `alg:none`. Without
|
|
544
|
+
// this, jose accepts whatever alg the resolved JWK supports, so a trusted IdP publishing a
|
|
545
|
+
// non-Ed25519 (e.g. RSA/EC) `use:sig` key would let an attacker present an RS256/ES256
|
|
546
|
+
// token that verifies. Matches the server-side allowlist in core/api aip-verify.
|
|
547
|
+
algorithms: AIT_SIGNING_ALGS,
|
|
548
|
+
clockTolerance: jwtClockTolerance,
|
|
549
|
+
currentDate: opts.now !== void 0 ? new Date(opts.now * 1e3) : void 0
|
|
550
|
+
});
|
|
551
|
+
} catch (err) {
|
|
552
|
+
lastFailure = isExpiry(err) ? "expired_token" : "idp_signature_invalid";
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
const nowSec = opts.now ?? Math.floor(Date.now() / 1e3);
|
|
556
|
+
if (claims.iat > nowSec + jwtClockTolerance) {
|
|
557
|
+
lastFailure = "expired_token";
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
const popResult = await verifyMessageSignature({
|
|
561
|
+
method: ctx.method,
|
|
562
|
+
authority: ctx.authority,
|
|
563
|
+
path: ctx.path,
|
|
564
|
+
agentIdentity: raw,
|
|
565
|
+
signatureInput: ctx.signatureInput,
|
|
566
|
+
signature: ctx.signature,
|
|
567
|
+
cnfJwk: claims.cnf.jwk,
|
|
568
|
+
now: opts.now,
|
|
569
|
+
maxSkewSeconds: opts.maxSkewSeconds
|
|
570
|
+
});
|
|
571
|
+
if (!popResult.ok) {
|
|
572
|
+
lastFailure = "pop_signature_invalid";
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
return { ok: true, ait: { payload: claims, iss: claims.iss, cnfJwk: claims.cnf.jwk, token } };
|
|
576
|
+
}
|
|
577
|
+
return { ok: false, reason: lastFailure };
|
|
578
|
+
};
|
|
579
|
+
var stripBearer = (value) => {
|
|
580
|
+
const trimmed = value.trim();
|
|
581
|
+
return /^bearer\s+/i.test(trimmed) ? trimmed.replace(/^bearer\s+/i, "") : trimmed;
|
|
582
|
+
};
|
|
583
|
+
var AIT_SIGNING_ALGS = ["EdDSA", "ES256"];
|
|
584
|
+
var normalizeAlg = (alg) => alg.toLowerCase() === "eddsa" ? "EdDSA" : alg;
|
|
585
|
+
var isExpiry = (err) => typeof err === "object" && err !== null && err.code === "ERR_JWT_EXPIRED";
|
|
586
|
+
|
|
587
|
+
// src/aip/request.ts
|
|
588
|
+
var readAgentIdentityHeaders = (headers) => {
|
|
589
|
+
const raw = headers.get(AGENT_IDENTITY_HEADER);
|
|
590
|
+
if (!raw) {
|
|
591
|
+
return [];
|
|
592
|
+
}
|
|
593
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
594
|
+
};
|
|
595
|
+
var deriveAuthority = (req, url) => req.headers.get("host") ?? url.host;
|
|
596
|
+
var buildVerifyContextFromRequest = (req) => {
|
|
597
|
+
const url = new URL(req.url);
|
|
598
|
+
return {
|
|
599
|
+
method: req.method,
|
|
600
|
+
authority: deriveAuthority(req, url),
|
|
601
|
+
path: url.pathname,
|
|
602
|
+
agentIdentityHeaders: readAgentIdentityHeaders(req.headers),
|
|
603
|
+
signatureInput: req.headers.get("signature-input"),
|
|
604
|
+
signature: req.headers.get("signature")
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
var hasAgentIdentityHeader = (req) => readAgentIdentityHeaders(req.headers).length > 0;
|
|
608
|
+
|
|
609
|
+
// src/aip/gate.ts
|
|
610
|
+
var verifyFromContext = async (ctx, opts) => {
|
|
611
|
+
const result = await verifyAit(ctx, { jwks: opts.jwks, now: opts.now, maxSkewSeconds: opts.maxSkewSeconds });
|
|
612
|
+
return result.ok ? { ok: true, ait: result.ait } : { ok: false, failure: result.reason };
|
|
613
|
+
};
|
|
614
|
+
var verifyAitRequest = (req, opts) => verifyFromContext(buildVerifyContextFromRequest(req), opts);
|
|
615
|
+
var aipErrorCode = (failure) => {
|
|
616
|
+
switch (failure) {
|
|
617
|
+
case "no_token":
|
|
618
|
+
case "pop_signature_missing":
|
|
619
|
+
return "agent_identity_required";
|
|
620
|
+
case "untrusted_issuer":
|
|
621
|
+
return "untrusted_issuer";
|
|
622
|
+
case "expired_token":
|
|
623
|
+
return "expired_token";
|
|
624
|
+
case "invalid_claims":
|
|
625
|
+
return "insufficient_claims";
|
|
626
|
+
case "key_unavailable":
|
|
627
|
+
return "idp_unavailable";
|
|
628
|
+
case "malformed_token":
|
|
629
|
+
case "idp_signature_invalid":
|
|
630
|
+
case "pop_signature_invalid":
|
|
631
|
+
return "invalid_signature";
|
|
632
|
+
default:
|
|
633
|
+
return "invalid_signature";
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
var aipErrorStatus = (failure) => {
|
|
637
|
+
switch (failure) {
|
|
638
|
+
case "key_unavailable":
|
|
639
|
+
return 503;
|
|
640
|
+
case "untrusted_issuer":
|
|
641
|
+
case "invalid_claims":
|
|
642
|
+
return 403;
|
|
643
|
+
default:
|
|
644
|
+
return 401;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
var aipErrorDetail = (failure) => {
|
|
648
|
+
switch (failure) {
|
|
649
|
+
case "no_token":
|
|
650
|
+
return "No Agent-Identity token was presented.";
|
|
651
|
+
case "pop_signature_missing":
|
|
652
|
+
return "The request is missing the RFC 9421 HTTP Message Signature that proves possession of the token-bound key.";
|
|
653
|
+
case "untrusted_issuer":
|
|
654
|
+
return "The token's issuer is not in this service's trusted-issuer list.";
|
|
655
|
+
case "expired_token":
|
|
656
|
+
return "The Agent Identity Token has expired.";
|
|
657
|
+
case "invalid_claims":
|
|
658
|
+
return "The token is missing required claims for this endpoint.";
|
|
659
|
+
case "malformed_token":
|
|
660
|
+
return "The Agent-Identity header could not be parsed as an Agent Identity Token.";
|
|
661
|
+
case "idp_signature_invalid":
|
|
662
|
+
return "The identity provider's signature on the token failed verification.";
|
|
663
|
+
case "pop_signature_invalid":
|
|
664
|
+
return "The request signature did not match the key bound to the token.";
|
|
665
|
+
case "key_unavailable":
|
|
666
|
+
return "The identity provider's signing key could not be resolved.";
|
|
667
|
+
default:
|
|
668
|
+
return "Token verification failed.";
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
var buildAipErrorBody = (failure) => {
|
|
672
|
+
const code = aipErrorCode(failure);
|
|
673
|
+
return {
|
|
674
|
+
type: `urn:aip:error:${code}`,
|
|
675
|
+
title: code.replace(/_/g, " "),
|
|
676
|
+
status: aipErrorStatus(failure),
|
|
677
|
+
detail: aipErrorDetail(failure)
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
|
|
166
681
|
// src/core.ts
|
|
682
|
+
var import_node_crypto = require("crypto");
|
|
167
683
|
var import_sdk = require("@agent-score/sdk");
|
|
168
684
|
|
|
169
685
|
// src/address.ts
|
|
@@ -258,8 +774,9 @@ var INVALID_CREDENTIAL_INSTRUCTIONS = JSON.stringify({
|
|
|
258
774
|
],
|
|
259
775
|
user_message: "The operator_token is not recognized. Use a different stored token, or restart the verification session flow to mint a new one."
|
|
260
776
|
});
|
|
261
|
-
function buildAgentMemoryHint() {
|
|
777
|
+
function buildAgentMemoryHint(aipTrustedIssuers) {
|
|
262
778
|
const api = CANONICAL_AGENTSCORE_API;
|
|
779
|
+
const acceptsAip = aipTrustedIssuers !== void 0 && aipTrustedIssuers.length > 0;
|
|
263
780
|
return {
|
|
264
781
|
save_for_future_agentscore_gates: true,
|
|
265
782
|
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.",
|
|
@@ -267,8 +784,12 @@ function buildAgentMemoryHint() {
|
|
|
267
784
|
identity_check_endpoint: `${api}/v1/credentials`,
|
|
268
785
|
identity_paths: {
|
|
269
786
|
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.",
|
|
270
|
-
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."
|
|
787
|
+
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.",
|
|
788
|
+
...acceptsAip && {
|
|
789
|
+
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.'
|
|
790
|
+
}
|
|
271
791
|
},
|
|
792
|
+
...acceptsAip && { aip_trusted_issuers: aipTrustedIssuers },
|
|
272
793
|
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.",
|
|
273
794
|
do_not_persist_in_memory: ["operator_token", "poll_secret"],
|
|
274
795
|
persist_in_credential_store: ["operator_token"]
|
|
@@ -290,11 +811,12 @@ function createAgentScoreCore(options) {
|
|
|
290
811
|
baseUrl: rawBaseUrl = "https://api.agentscore.sh",
|
|
291
812
|
chain: gateChain,
|
|
292
813
|
userAgent,
|
|
293
|
-
createSessionOnMissing
|
|
814
|
+
createSessionOnMissing,
|
|
815
|
+
aipTrustedIssuers
|
|
294
816
|
} = options;
|
|
295
817
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
296
|
-
const agentMemoryHint = buildAgentMemoryHint();
|
|
297
|
-
const defaultUa = `@agent-score/commerce@${"2.
|
|
818
|
+
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
819
|
+
const defaultUa = `@agent-score/commerce@${"2.5.0"}`;
|
|
298
820
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
299
821
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
300
822
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -312,6 +834,7 @@ function createAgentScoreCore(options) {
|
|
|
312
834
|
return s;
|
|
313
835
|
}
|
|
314
836
|
const cache = new TTLCache(cacheSeconds * 1e3);
|
|
837
|
+
const lastSignerRaw = /* @__PURE__ */ new Map();
|
|
315
838
|
async function tryMintSessionDenial(ctx) {
|
|
316
839
|
if (!createSessionOnMissing) return void 0;
|
|
317
840
|
try {
|
|
@@ -369,13 +892,18 @@ function createAgentScoreCore(options) {
|
|
|
369
892
|
}
|
|
370
893
|
}
|
|
371
894
|
async function evaluate(identity, ctx, signer) {
|
|
372
|
-
if (!identity || !identity.address && !identity.operatorToken) {
|
|
895
|
+
if (!identity || !identity.address?.trim() && !identity.operatorToken?.trim() && !identity.aipToken?.trim()) {
|
|
373
896
|
if (failOpen) return { kind: "allow" };
|
|
374
897
|
const sessionReason = await tryMintSessionDenial(ctx);
|
|
375
898
|
if (sessionReason) return { kind: "deny", reason: sessionReason };
|
|
899
|
+
const acceptsAip = aipTrustedIssuers !== void 0 && aipTrustedIssuers.length > 0;
|
|
900
|
+
const aipStep = acceptsAip ? [
|
|
901
|
+
`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.`
|
|
902
|
+
] : [];
|
|
376
903
|
const missingIdentityInstructions = JSON.stringify({
|
|
377
904
|
action: "probe_identity_then_session",
|
|
378
905
|
steps: [
|
|
906
|
+
...aipStep,
|
|
379
907
|
"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.",
|
|
380
908
|
"If step 1 is denied or you already have a stored operator_token (valid + not expired): send X-Operator-Token: opc_... and retry.",
|
|
381
909
|
"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."
|
|
@@ -391,7 +919,7 @@ function createAgentScoreCore(options) {
|
|
|
391
919
|
}
|
|
392
920
|
};
|
|
393
921
|
}
|
|
394
|
-
const cacheKey = identity.operatorToken?.toLowerCase() ?? (identity.address ? normalizeAddress(identity.address) : "");
|
|
922
|
+
const cacheKey = identity.aipToken ? `aip:${(0, import_node_crypto.createHash)("sha256").update(identity.aipToken).digest("hex")}` : identity.operatorToken?.toLowerCase() ?? (identity.address ? normalizeAddress(identity.address) : "");
|
|
395
923
|
const cached = cache.get(cacheKey);
|
|
396
924
|
if (cached) {
|
|
397
925
|
if (cached.allow) {
|
|
@@ -436,7 +964,7 @@ function createAgentScoreCore(options) {
|
|
|
436
964
|
// regardless of policy.require_sanctions_clear (which gates the separate NAME screen).
|
|
437
965
|
...signer && { signer: { address: signer.address, network: signer.network } }
|
|
438
966
|
};
|
|
439
|
-
const result = identity.address ? await sdk.assess(identity.address, { ...opts, operatorToken: identity.operatorToken }) : await sdk.assess(null, { ...opts, operatorToken: identity.operatorToken });
|
|
967
|
+
const result = identity.aipToken ? await sdk.assess(null, { ...opts, aipToken: identity.aipToken }) : identity.address ? await sdk.assess(identity.address, { ...opts, operatorToken: identity.operatorToken }) : await sdk.assess(null, { ...opts, operatorToken: identity.operatorToken });
|
|
440
968
|
data = result;
|
|
441
969
|
} catch (err) {
|
|
442
970
|
if (err instanceof import_sdk.PaymentRequiredError) {
|
|
@@ -507,6 +1035,9 @@ function createAgentScoreCore(options) {
|
|
|
507
1035
|
const decisionReasons = data.decision_reasons ?? [];
|
|
508
1036
|
const allow = decision === "allow" || decision == null;
|
|
509
1037
|
cache.set(cacheKey, { allow, decision: decision ?? void 0, reasons: decisionReasons, raw: data });
|
|
1038
|
+
if (identity.address !== void 0 && identity.operatorToken === void 0 && identity.aipToken === void 0 && (data.signer_match !== void 0 || data.signer_sanctions !== void 0)) {
|
|
1039
|
+
lastSignerRaw.set(normalizeAddress(identity.address), data);
|
|
1040
|
+
}
|
|
510
1041
|
if (allow) {
|
|
511
1042
|
const quota = data.quota;
|
|
512
1043
|
return {
|
|
@@ -571,9 +1102,7 @@ function createAgentScoreCore(options) {
|
|
|
571
1102
|
}
|
|
572
1103
|
function getSignerVerdict2(claimedAddress) {
|
|
573
1104
|
const claimedNorm = normalizeAddress(claimedAddress);
|
|
574
|
-
const
|
|
575
|
-
if (!cached) return void 0;
|
|
576
|
-
const raw = cached.raw;
|
|
1105
|
+
const raw = lastSignerRaw.get(claimedNorm) ?? cache.get(claimedNorm)?.raw;
|
|
577
1106
|
if (!raw) return void 0;
|
|
578
1107
|
const rawMatch = raw.signer_match;
|
|
579
1108
|
const rawSanctions = raw.signer_sanctions;
|
|
@@ -651,6 +1180,18 @@ async function extractSolanaSignerFromCredential(credential) {
|
|
|
651
1180
|
}
|
|
652
1181
|
}
|
|
653
1182
|
async function extractPaymentSigner(request, x402PaymentHeader) {
|
|
1183
|
+
if (x402PaymentHeader) {
|
|
1184
|
+
try {
|
|
1185
|
+
const decoded = atob(x402PaymentHeader);
|
|
1186
|
+
const parsed = JSON.parse(decoded);
|
|
1187
|
+
const from = parsed?.payload?.authorization?.from;
|
|
1188
|
+
if (typeof from === "string" && /^0x[0-9a-fA-F]{40}$/.test(from)) {
|
|
1189
|
+
return { address: from.toLowerCase(), network: "evm" };
|
|
1190
|
+
}
|
|
1191
|
+
} catch (err) {
|
|
1192
|
+
console.warn("[gate] x402 signer extraction failed:", err instanceof Error ? err.message : err);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
654
1195
|
const authHeader = request.headers.get("authorization");
|
|
655
1196
|
if (authHeader) {
|
|
656
1197
|
try {
|
|
@@ -670,18 +1211,6 @@ async function extractPaymentSigner(request, x402PaymentHeader) {
|
|
|
670
1211
|
console.warn("[gate] MPP signer extraction failed:", err instanceof Error ? err.message : err);
|
|
671
1212
|
}
|
|
672
1213
|
}
|
|
673
|
-
if (x402PaymentHeader) {
|
|
674
|
-
try {
|
|
675
|
-
const decoded = atob(x402PaymentHeader);
|
|
676
|
-
const parsed = JSON.parse(decoded);
|
|
677
|
-
const from = parsed?.payload?.authorization?.from;
|
|
678
|
-
if (typeof from === "string" && /^0x[0-9a-fA-F]{40}$/.test(from)) {
|
|
679
|
-
return { address: from.toLowerCase(), network: "evm" };
|
|
680
|
-
}
|
|
681
|
-
} catch (err) {
|
|
682
|
-
console.warn("[gate] x402 signer extraction failed:", err instanceof Error ? err.message : err);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
1214
|
return null;
|
|
686
1215
|
}
|
|
687
1216
|
function readX402PaymentHeader(request) {
|
|
@@ -767,14 +1296,48 @@ function conditionalAgentscoreGate(options) {
|
|
|
767
1296
|
return gate(c, next);
|
|
768
1297
|
};
|
|
769
1298
|
}
|
|
1299
|
+
var AIT_CONTEXT_KEY = "__agentscoreAit";
|
|
1300
|
+
function defaultAipOnDenied(_c, body) {
|
|
1301
|
+
return new Response(JSON.stringify(body), {
|
|
1302
|
+
status: body.status,
|
|
1303
|
+
headers: { "content-type": "application/problem+json" }
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
function aipGate(options) {
|
|
1307
|
+
const { onDenied = defaultAipOnDenied, ...gateOpts } = options;
|
|
1308
|
+
return async (c, next) => {
|
|
1309
|
+
const result = await verifyAitRequest(c.req.raw, gateOpts);
|
|
1310
|
+
if (!result.ok) {
|
|
1311
|
+
return onDenied(c, buildAipErrorBody(result.failure));
|
|
1312
|
+
}
|
|
1313
|
+
c.set(AIT_CONTEXT_KEY, result.ait);
|
|
1314
|
+
await next();
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
function conditionalAipGate(options) {
|
|
1318
|
+
const gate = aipGate(options);
|
|
1319
|
+
return async (c, next) => {
|
|
1320
|
+
if (!hasAgentIdentityHeader(c.req.raw)) {
|
|
1321
|
+
await next();
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
return gate(c, next);
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
function getVerifiedAit(c) {
|
|
1328
|
+
return c.get(AIT_CONTEXT_KEY);
|
|
1329
|
+
}
|
|
770
1330
|
// Annotate the CommonJS export names for ESM import in node:
|
|
771
1331
|
0 && (module.exports = {
|
|
772
1332
|
agentscoreGate,
|
|
1333
|
+
aipGate,
|
|
773
1334
|
captureWallet,
|
|
774
1335
|
conditionalAgentscoreGate,
|
|
1336
|
+
conditionalAipGate,
|
|
775
1337
|
getAgentScoreData,
|
|
776
1338
|
getGateDegradedState,
|
|
777
1339
|
getGateQuotaInfo,
|
|
778
|
-
getSignerVerdict
|
|
1340
|
+
getSignerVerdict,
|
|
1341
|
+
getVerifiedAit
|
|
779
1342
|
});
|
|
780
1343
|
//# sourceMappingURL=hono.js.map
|