@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
@@ -4006,7 +4006,7 @@ function getTrustLevel(score) {
4006
4006
  }
4007
4007
 
4008
4008
  // src/version.ts
4009
- var SDK_VERSION = "5.14.0";
4009
+ var SDK_VERSION = "5.16.0";
4010
4010
 
4011
4011
  // src/http.ts
4012
4012
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -4143,6 +4143,8 @@ function getCacheKey(request, counterpartyId) {
4143
4143
  request.durationRequired ?? "",
4144
4144
  request.invocationProtocol || "",
4145
4145
  request.enableRuntimeChallenge ? "1" : "0",
4146
+ // 5.16.0: route policy changes the verdict (owners / challenge).
4147
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
4146
4148
  // callerMetadata fields contribute to risk model; include the ones
4147
4149
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
4148
4150
  // so their inclusion effectively forces a re-check for any varying
@@ -4315,6 +4317,7 @@ async function callVerifyAccessAPI(config, request) {
4315
4317
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
4316
4318
  if (requestData.enableRuntimeChallenge)
4317
4319
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
4320
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
4318
4321
  if (requestData.createSession) body.createSession = requestData.createSession;
4319
4322
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
4320
4323
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -4325,6 +4328,7 @@ async function callVerifyAccessAPI(config, request) {
4325
4328
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
4326
4329
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
4327
4330
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
4331
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
4328
4332
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
4329
4333
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
4330
4334
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -4475,7 +4479,8 @@ async function verify(config, request, options) {
4475
4479
  "[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."
4476
4480
  );
4477
4481
  }
4478
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
4482
+ const uncacheable = Boolean(request.commerceArtifacts);
4483
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
4479
4484
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
4480
4485
  if (cached) {
4481
4486
  if (mergedConfig.debug) {
@@ -4556,7 +4561,10 @@ async function verify(config, request, options) {
4556
4561
  // MERCHANT caller only (bridge callers strip it before the agent plane).
4557
4562
  settlementToken: apiResponse.settlementToken,
4558
4563
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4559
- fulfilment: apiResponse.fulfilment
4564
+ fulfilment: apiResponse.fulfilment,
4565
+ mandates: apiResponse.mandates,
4566
+ kyaToken: apiResponse.kyaToken,
4567
+ aep: apiResponse.aep
4560
4568
  };
4561
4569
  return result2;
4562
4570
  }
@@ -4566,7 +4574,10 @@ async function verify(config, request, options) {
4566
4574
  trustScore: apiResponse.agent.trustScore,
4567
4575
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
4568
4576
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
4569
- status: apiResponse.agent.agentStatus
4577
+ status: apiResponse.agent.agentStatus,
4578
+ ...apiResponse.agent.protocolIdentities && {
4579
+ protocolIdentities: apiResponse.agent.protocolIdentities
4580
+ }
4570
4581
  } : void 0;
4571
4582
  const developer = apiResponse.developer ? {
4572
4583
  astradId: apiResponse.developer.kyaOwnerId,
@@ -4617,7 +4628,11 @@ async function verify(config, request, options) {
4617
4628
  settlementOutcome: apiResponse.settlementOutcome,
4618
4629
  settlementToken: apiResponse.settlementToken,
4619
4630
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
4620
- fulfilment: apiResponse.fulfilment
4631
+ fulfilment: apiResponse.fulfilment,
4632
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
4633
+ mandates: apiResponse.mandates,
4634
+ kyaToken: apiResponse.kyaToken,
4635
+ aep: apiResponse.aep
4621
4636
  };
4622
4637
  if (result.recommendation === "deny") {
4623
4638
  result.policyAllowed = false;
@@ -4637,7 +4652,9 @@ async function verify(config, request, options) {
4637
4652
  }
4638
4653
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
4639
4654
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
4640
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4655
+ if (!uncacheable) {
4656
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
4657
+ }
4641
4658
  }
4642
4659
  return result;
4643
4660
  }
@@ -4648,6 +4665,9 @@ var FALLBACK_MAX_WAIT_MS = 5 * 60 * 1e3;
4648
4665
  // src/metadata-capture.ts
4649
4666
  var MAX_TOTAL_BYTES = 16 * 1024;
4650
4667
 
4668
+ // src/adapters/commerce-detect.ts
4669
+ var MAX_BODY_BYTES = 64 * 1024;
4670
+
4651
4671
  // src/edge-config.ts
4652
4672
  var DEFAULT_EDGE_CONFIG = Object.freeze({
4653
4673
  version: 1,
@@ -4960,6 +4980,43 @@ import { createHash as createHash3, webcrypto } from "crypto";
4960
4980
  // src/transport/registry/visa.ts
4961
4981
  import { createRemoteJWKSet } from "jose";
4962
4982
 
4983
+ // src/ucp/profile.ts
4984
+ var UCP_VERSION = "2026-08-25";
4985
+ var SPEC = `https://ucp.dev/${UCP_VERSION}/specification`;
4986
+ var SCHEMAS = `https://ucp.dev/${UCP_VERSION}/schemas`;
4987
+
4988
+ // src/ucp/signatures.ts
4989
+ import { httpbis as httpbis3, createSigner as createSigner2 } from "http-message-signatures";
4990
+
4991
+ // src/http-signatures/sign.ts
4992
+ import { httpbis as httpbis2, createSigner } from "http-message-signatures";
4993
+
4994
+ // src/ucp/checkout-kit.ts
4995
+ import { CompactSign as CompactSign2 } from "jose";
4996
+
4997
+ // src/mandates/sd-jwt.ts
4998
+ import {
4999
+ CompactSign,
5000
+ compactVerify,
5001
+ importJWK,
5002
+ decodeProtectedHeader
5003
+ } from "jose";
5004
+
5005
+ // src/idempotency/index.ts
5006
+ var DEFAULT_IDEMPOTENCY_TTL_MS = 24 * 60 * 60 * 1e3;
5007
+
5008
+ // src/payments/kyapay.ts
5009
+ import {
5010
+ createLocalJWKSet,
5011
+ createRemoteJWKSet as createRemoteJWKSet2,
5012
+ decodeProtectedHeader as decodeProtectedHeader2,
5013
+ jwtVerify
5014
+ } from "jose";
5015
+
5016
+ // src/aep/core.ts
5017
+ var ED25519_PKCS8_PREFIX = Buffer.from("302e020100300506032b657004220420", "hex");
5018
+ var ED25519_SPKI_PREFIX = Buffer.from("302a300506032b6570032100", "hex");
5019
+
4963
5020
  // src/gateway/modes/online.ts
4964
5021
  function toGatewayConfig(config) {
4965
5022
  return {
@@ -5697,7 +5754,7 @@ async function sendHeartbeat(enrolment, request, timeoutMs = 1500) {
5697
5754
 
5698
5755
  // src/fleet/policy-verify.ts
5699
5756
  import { createHash as createHash4 } from "crypto";
5700
- import { compactVerify, createLocalJWKSet } from "jose";
5757
+ import { compactVerify as compactVerify2, createLocalJWKSet as createLocalJWKSet2 } from "jose";
5701
5758
 
5702
5759
  // src/fleet/types.ts
5703
5760
  var FLEET_POLICY_TYP = "fleet-policy+jwt";
@@ -5746,8 +5803,8 @@ async function verifyFleetPolicy(jws, jwks, options) {
5746
5803
  let payloadBytes;
5747
5804
  let header;
5748
5805
  try {
5749
- const keySet = createLocalJWKSet(jwks);
5750
- const result = await compactVerify(jws, keySet, { algorithms: ["ES256"] });
5806
+ const keySet = createLocalJWKSet2(jwks);
5807
+ const result = await compactVerify2(jws, keySet, { algorithms: ["ES256"] });
5751
5808
  payloadBytes = result.payload;
5752
5809
  header = result.protectedHeader;
5753
5810
  } catch (err) {
@@ -5793,9 +5850,9 @@ async function resolveFleetJwks(pinned, chain, ownerId) {
5793
5850
  let lastSeq = 0;
5794
5851
  for (const link of chain) {
5795
5852
  try {
5796
- const { payload, protectedHeader } = await compactVerify(
5853
+ const { payload, protectedHeader } = await compactVerify2(
5797
5854
  link,
5798
- createLocalJWKSet(trusted),
5855
+ createLocalJWKSet2(trusted),
5799
5856
  { algorithms: ["ES256"] }
5800
5857
  );
5801
5858
  if (protectedHeader.typ !== FLEET_KEYS_TYP) continue;