@astrasyncai/verification-gateway 5.14.0 → 5.16.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 (100) hide show
  1. package/README.md +36 -18
  2. package/dist/adapters/express.d.mts +1 -1
  3. package/dist/adapters/express.d.ts +1 -1
  4. package/dist/adapters/express.js +492 -240
  5. package/dist/adapters/express.js.map +1 -1
  6. package/dist/adapters/express.mjs +492 -240
  7. package/dist/adapters/express.mjs.map +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.d.ts +1 -1
  10. package/dist/adapters/mcp.js +23 -6
  11. package/dist/adapters/mcp.js.map +1 -1
  12. package/dist/adapters/mcp.mjs +23 -6
  13. package/dist/adapters/mcp.mjs.map +1 -1
  14. package/dist/adapters/nextjs.d.mts +1 -1
  15. package/dist/adapters/nextjs.d.ts +1 -1
  16. package/dist/adapters/nextjs.js +475 -239
  17. package/dist/adapters/nextjs.js.map +1 -1
  18. package/dist/adapters/nextjs.mjs +475 -239
  19. package/dist/adapters/nextjs.mjs.map +1 -1
  20. package/dist/adapters/sdk.d.mts +18 -10
  21. package/dist/adapters/sdk.d.ts +18 -10
  22. package/dist/adapters/sdk.js +83 -23
  23. package/dist/adapters/sdk.js.map +1 -1
  24. package/dist/adapters/sdk.mjs +83 -23
  25. package/dist/adapters/sdk.mjs.map +1 -1
  26. package/dist/agent/index.d.mts +69 -54
  27. package/dist/agent/index.d.ts +69 -54
  28. package/dist/agent/index.js +24 -14
  29. package/dist/agent/index.js.map +1 -1
  30. package/dist/agent/index.mjs +24 -14
  31. package/dist/agent/index.mjs.map +1 -1
  32. package/dist/bin/astrasync-claude-hook.js +58 -11
  33. package/dist/bin/astrasync-codex-hook.js +58 -11
  34. package/dist/bin/astrasync-guard.js +177 -11
  35. package/dist/bin/astrasync.js +433 -38
  36. package/dist/browser/background.js +53 -6
  37. package/dist/browser/background.js.map +1 -1
  38. package/dist/browser/background.mjs +63 -6
  39. package/dist/browser/background.mjs.map +1 -1
  40. package/dist/cli/index.js +1 -1
  41. package/dist/cli/index.js.map +1 -1
  42. package/dist/cli/index.mjs +1 -1
  43. package/dist/cli/index.mjs.map +1 -1
  44. package/dist/codex/index.js +58 -11
  45. package/dist/codex/index.js.map +1 -1
  46. package/dist/codex/index.mjs +68 -11
  47. package/dist/codex/index.mjs.map +1 -1
  48. package/dist/cursor/extension.js +58 -11
  49. package/dist/cursor/extension.js.map +1 -1
  50. package/dist/cursor/extension.mjs +68 -11
  51. package/dist/cursor/extension.mjs.map +1 -1
  52. package/dist/edge-config.d.mts +31 -2
  53. package/dist/edge-config.d.ts +31 -2
  54. package/dist/edge-config.js +35 -5
  55. package/dist/edge-config.js.map +1 -1
  56. package/dist/edge-config.mjs +32 -4
  57. package/dist/edge-config.mjs.map +1 -1
  58. package/dist/edge-core/index.d.mts +11 -2
  59. package/dist/edge-core/index.d.ts +11 -2
  60. package/dist/edge-core/index.js +97 -11
  61. package/dist/edge-core/index.js.map +1 -1
  62. package/dist/edge-core/index.mjs +95 -11
  63. package/dist/edge-core/index.mjs.map +1 -1
  64. package/dist/gateway/gateway.js +53 -6
  65. package/dist/gateway/gateway.js.map +1 -1
  66. package/dist/gateway/gateway.mjs +63 -6
  67. package/dist/gateway/gateway.mjs.map +1 -1
  68. package/dist/git-trigger/git-hooks.d.mts +1 -1
  69. package/dist/git-trigger/git-hooks.d.ts +1 -1
  70. package/dist/index.d.mts +1407 -88
  71. package/dist/index.d.ts +1407 -88
  72. package/dist/index.js +5148 -2616
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +5094 -2618
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/registration/index.d.mts +28 -2
  77. package/dist/registration/index.d.ts +28 -2
  78. package/dist/registration/index.js +18 -3
  79. package/dist/registration/index.js.map +1 -1
  80. package/dist/registration/index.mjs +15 -2
  81. package/dist/registration/index.mjs.map +1 -1
  82. package/dist/transport/index.d.mts +7 -5
  83. package/dist/transport/index.d.ts +7 -5
  84. package/dist/transport/index.js +61 -5
  85. package/dist/transport/index.js.map +1 -1
  86. package/dist/transport/index.mjs +67 -11
  87. package/dist/transport/index.mjs.map +1 -1
  88. package/dist/{types-BCkwBA84.d.mts → types-Blz520bR.d.mts} +116 -12
  89. package/dist/{types-BCkwBA84.d.ts → types-Blz520bR.d.ts} +116 -12
  90. package/dist/{types-C_b4QTyO.d.ts → types-Bm1QvGqI.d.ts} +114 -10
  91. package/dist/{types-DlshIIR-.d.mts → types-DBe4hgfT.d.mts} +114 -10
  92. package/dist/ui/index.d.mts +1 -1
  93. package/dist/ui/index.d.ts +1 -1
  94. package/dist/verify.d.mts +1 -1
  95. package/dist/verify.d.ts +1 -1
  96. package/dist/verify.js +23 -6
  97. package/dist/verify.js.map +1 -1
  98. package/dist/verify.mjs +23 -6
  99. package/dist/verify.mjs.map +1 -1
  100. package/package.json +1 -1
@@ -3969,7 +3969,7 @@ function getTrustLevel(score) {
3969
3969
  }
3970
3970
 
3971
3971
  // src/version.ts
3972
- var SDK_VERSION = "5.14.0";
3972
+ var SDK_VERSION = "5.16.0";
3973
3973
 
3974
3974
  // src/http.ts
3975
3975
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4106,6 +4106,8 @@ function getCacheKey(request, counterpartyId) {
4106
4106
  request.durationRequired ?? "",
4107
4107
  request.invocationProtocol || "",
4108
4108
  request.enableRuntimeChallenge ? "1" : "0",
4109
+ // 5.16.0: route policy changes the verdict (owners / challenge).
4110
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
4109
4111
  // callerMetadata fields contribute to risk model; include the ones
4110
4112
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
4111
4113
  // so their inclusion effectively forces a re-check for any varying
@@ -4278,6 +4280,7 @@ async function callVerifyAccessAPI(config, request) {
4278
4280
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4279
4281
  if (requestData.enableRuntimeChallenge)
4280
4282
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4283
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4281
4284
  if (requestData.createSession) body.createSession = requestData.createSession;
4282
4285
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4283
4286
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -4288,6 +4291,7 @@ async function callVerifyAccessAPI(config, request) {
4288
4291
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
4289
4292
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
4290
4293
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
4294
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
4291
4295
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
4292
4296
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
4293
4297
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -4438,7 +4442,8 @@ async function verify(config, request, options) {
4438
4442
  "[VerificationGateway] minTrustScore / minTrustScoreForFull are deprecated in v2.3.0 and have no effect. Server is now the single source of truth for access decisions (verified ID + runtime challenge + PDLSS + trust score). To gate access to an endpoint, configure the endpoint's trust_score_requirement server-side."
4439
4443
  );
4440
4444
  }
4441
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
4445
+ const uncacheable = Boolean(request.commerceArtifacts);
4446
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4442
4447
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4443
4448
  if (cached) {
4444
4449
  if (mergedConfig.debug) {
@@ -4519,7 +4524,10 @@ async function verify(config, request, options) {
4519
4524
  // MERCHANT caller only (bridge callers strip it before the agent plane).
4520
4525
  settlementToken: apiResponse.settlementToken,
4521
4526
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4522
- fulfilment: apiResponse.fulfilment
4527
+ fulfilment: apiResponse.fulfilment,
4528
+ mandates: apiResponse.mandates,
4529
+ kyaToken: apiResponse.kyaToken,
4530
+ aep: apiResponse.aep
4523
4531
  };
4524
4532
  return result2;
4525
4533
  }
@@ -4529,7 +4537,10 @@ async function verify(config, request, options) {
4529
4537
  trustScore: apiResponse.agent.trustScore,
4530
4538
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
4531
4539
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
4532
- status: apiResponse.agent.agentStatus
4540
+ status: apiResponse.agent.agentStatus,
4541
+ ...apiResponse.agent.protocolIdentities && {
4542
+ protocolIdentities: apiResponse.agent.protocolIdentities
4543
+ }
4533
4544
  } : void 0;
4534
4545
  const developer = apiResponse.developer ? {
4535
4546
  astradId: apiResponse.developer.kyaOwnerId,
@@ -4580,7 +4591,11 @@ async function verify(config, request, options) {
4580
4591
  settlementOutcome: apiResponse.settlementOutcome,
4581
4592
  settlementToken: apiResponse.settlementToken,
4582
4593
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4583
- fulfilment: apiResponse.fulfilment
4594
+ fulfilment: apiResponse.fulfilment,
4595
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4596
+ mandates: apiResponse.mandates,
4597
+ kyaToken: apiResponse.kyaToken,
4598
+ aep: apiResponse.aep
4584
4599
  };
4585
4600
  if (result.recommendation === "deny") {
4586
4601
  result.policyAllowed = false;
@@ -4600,7 +4615,9 @@ async function verify(config, request, options) {
4600
4615
  }
4601
4616
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
4602
4617
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
4603
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4618
+ if (!uncacheable) {
4619
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4620
+ }
4604
4621
  }
4605
4622
  return result;
4606
4623
  }
@@ -4611,6 +4628,9 @@ var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
4611
4628
  // src/metadata-capture.ts
4612
4629
  var MAX_TOTAL_BYTES = 16 * 1024;
4613
4630
 
4631
+ // src/adapters/commerce-detect.ts
4632
+ var MAX_BODY_BYTES = 64 * 1024;
4633
+
4614
4634
  // src/edge-config.ts
4615
4635
  var DEFAULT_EDGE_CONFIG = Object.freeze({
4616
4636
  version: 1,
@@ -4923,6 +4943,43 @@ import { createHash as createHash3, webcrypto } from "crypto";
4923
4943
  // src/transport/registry/visa.ts
4924
4944
  import { createRemoteJWKSet } from "jose";
4925
4945
 
4946
+ // src/ucp/profile.ts
4947
+ var UCP_VERSION = "2026-08-25";
4948
+ var SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
4949
+ var SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
4950
+
4951
+ // src/ucp/signatures.ts
4952
+ import { httpbis as httpbis3, createSigner as createSigner2 } from "http-message-signatures";
4953
+
4954
+ // src/http-signatures/sign.ts
4955
+ import { httpbis as httpbis2, createSigner } from "http-message-signatures";
4956
+
4957
+ // src/ucp/checkout-kit.ts
4958
+ import { CompactSign as CompactSign2 } from "jose";
4959
+
4960
+ // src/mandates/sd-jwt.ts
4961
+ import {
4962
+ CompactSign,
4963
+ compactVerify,
4964
+ importJWK,
4965
+ decodeProtectedHeader
4966
+ } from "jose";
4967
+
4968
+ // src/idempotency/index.ts
4969
+ var DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
4970
+
4971
+ // src/payments/kyapay.ts
4972
+ import {
4973
+ createLocalJWKSet,
4974
+ createRemoteJWKSet as createRemoteJWKSet2,
4975
+ decodeProtectedHeader as decodeProtectedHeader2,
4976
+ jwtVerify
4977
+ } from "jose";
4978
+
4979
+ // src/aep/core.ts
4980
+ var ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
4981
+ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
4982
+
4926
4983
  // src/gateway/modes/online.ts
4927
4984
  function toGatewayConfig(config) {
4928
4985
  return {
@@ -5634,7 +5691,7 @@ async function sendHeartbeat(enrolment, request, timeoutMs = 1500) {
5634
5691
 
5635
5692
  // src/fleet/policy-verify.ts
5636
5693
  import { createHash as createHash4 } from "crypto";
5637
- import { compactVerify, createLocalJWKSet } from "jose";
5694
+ import { compactVerify as compactVerify2, createLocalJWKSet as createLocalJWKSet2 } from "jose";
5638
5695
 
5639
5696
  // src/fleet/types.ts
5640
5697
  var FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -5683,8 +5740,8 @@ async function verifyFleetPolicy(jws, jwks, options) {
5683
5740
  let payloadBytes;
5684
5741
  let header;
5685
5742
  try {
5686
- const keySet = createLocalJWKSet(jwks);
5687
- const result = await compactVerify(jws, keySet, { algorithms: ["ES256"] });
5743
+ const keySet = createLocalJWKSet2(jwks);
5744
+ const result = await compactVerify2(jws, keySet, { algorithms: ["ES256"] });
5688
5745
  payloadBytes = result.payload;
5689
5746
  header = result.protectedHeader;
5690
5747
  } catch (err) {
@@ -5730,9 +5787,9 @@ async function resolveFleetJwks(pinned, chain, ownerId) {
5730
5787
  let lastSeq = 0;
5731
5788
  for (const link of chain) {
5732
5789
  try {
5733
- const { payload, protectedHeader } = await compactVerify(
5790
+ const { payload, protectedHeader } = await compactVerify2(
5734
5791
  link,
5735
- createLocalJWKSet(trusted),
5792
+ createLocalJWKSet2(trusted),
5736
5793
  { algorithms: ["ES256"] }
5737
5794
  );
5738
5795
  if (protectedHeader.typ !== FLEET_KEYS_TYP) continue;