@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
@@ -169,6 +169,30 @@ interface VerifiedAgent {
169
169
  blockchainAnchored: boolean;
170
170
  /** Agent status */
171
171
  status: 'active' | 'inactive' | 'suspended' | 'migrating' | 'terminated' | 'retired';
172
+ /**
173
+ * 5.15.0: the protocol identities the agent declared at registration (its
174
+ * shared signing key, UCP profile, Web Bot Auth key directory, x402 wallet,
175
+ * network agent ids). Bind incoming protocol requests to these — e.g.
176
+ * {@link checkUcpAgentBinding} rejects a `UCP-Agent` profile that isn't the
177
+ * agent's. Identities AstraSync failed to verify are never included.
178
+ */
179
+ protocolIdentities?: AgentProtocolIdentities;
180
+ }
181
+ interface AgentProtocolIdentities {
182
+ /** Shared signing key (AP2 / VI `cnf`, RFC 9421). `thumbprint` = RFC 7638. */
183
+ agentKey?: {
184
+ kid: string | null;
185
+ thumbprint: string | null;
186
+ jwk: Record<string, unknown>;
187
+ };
188
+ ucpProfile?: string;
189
+ webBotAuthKeyDirectory?: string;
190
+ a2aCard?: string;
191
+ x402Wallet?: string;
192
+ visaAgentId?: string;
193
+ mastercardAgentId?: string;
194
+ /** Protocols whose identity AstraSync checked successfully. */
195
+ verified: string[];
172
196
  }
173
197
  /**
174
198
  * Verified developer (KYD) information
@@ -253,6 +277,13 @@ interface GuidanceInfo {
253
277
  interface StepUpApprovalInfo {
254
278
  approvalId: string;
255
279
  pollUrl: string;
280
+ /**
281
+ * 5.15.0: absolute https URL of the buyer-facing approval page. A UCP
282
+ * merchant returns it as `continue_url` with status `requires_escalation`;
283
+ * after the buyer approves, complete the same checkout again and the
284
+ * approval is redeemed once. Absent from backends older than 27.9.
285
+ */
286
+ approvalUrl?: string;
256
287
  expiresAt: string;
257
288
  }
258
289
  /**
@@ -428,19 +459,19 @@ interface VerificationResult {
428
459
  /** Settlement voucher (present on clean merchant-mediated grants with a verified wallet). */
429
460
  settlement?: SettlementArtifact;
430
461
  /**
431
- * 5.3.0 (astra-pay): sanitized first-party settlement outcome. Present
432
- * INSTEAD of `settlement` when the counterparty is an AstraSync-operated
433
- * storefront and the request carried `commercePhase: 'confirm'` — the
434
- * backend redeemed the voucher and executed the charge server-side
435
- * (charge-at-redeem), so there is no artifact to deliver, only the result.
436
- * `no_instrument` = policy passed but the owner has no chargeable
437
- * instrument on file (steer the user to add one via onboarding).
462
+ * Sanitized order outcome for a purchase leg. 5.14.1: AstraSync never
463
+ * charges — every purchase grant records an order and hands YOU the
464
+ * settlement artifact, so the status is `pending_merchant` (with
465
+ * `orderId`): charge the `settlementToken` (card, first-party tenant) or
466
+ * redeem the `settlement` voucher (stablecoin), then `reportSettlement()`.
467
+ * `no_instrument` = policy passed but the owner has nothing usable on file
468
+ * (steer the user to add one via onboarding).
438
469
  */
439
470
  settlementOutcome?: SettlementOutcomeInfo;
440
471
  /**
441
- * 5.5.0 (astra-pay): interim merchant self-settlement token. Present ONLY
442
- * for firstParty merchants opted into settlement_mode='self_settle' on the
443
- * confirm leg — YOUR server charges with this material on the shared Stripe
472
+ * Card settlement token. Present on a card purchase at a first-party
473
+ * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
474
+ * mode. YOUR server charges with this material on the shared Stripe
444
475
  * account and reports the outcome via `client.reportSettlement()`.
445
476
  * MERCHANT-ONLY lane: never expose it to the agent plane, never log it,
446
477
  * never echo it back over the bridge handoff (the bridge strips it
@@ -461,6 +492,29 @@ interface VerificationResult {
461
492
  * confirm handoff body wins over `fulfilment.email` (the platform default).
462
493
  */
463
494
  fulfilment?: FulfilmentInfo;
495
+ /**
496
+ * 5.15.0: AP2 v0.2 mandates AstraSync issued for this purchase (merchant
497
+ * lane — never forward to the agent). `mode: 'closed'` on a purchase leg
498
+ * (Checkout + Payment, bound to your `checkoutJwt`), `'open'` on a quote
499
+ * leg for an agent with a registered key. Verify with `verifyAp2Mandate()`
500
+ * against AstraSync's JWKS (`kid`).
501
+ */
502
+ mandates?: AstraSyncMandates;
503
+ /**
504
+ * 5.15.0: a KYAPay `kya+jwt` identity token AstraSync issued for this agent
505
+ * at your endpoint (commerce legs; merchant lane). `hid.email` is where to
506
+ * send the receipt. Verify with `verifyKyaPayTokens()` (issuer = the
507
+ * AstraSync origin, audience = your ASTRAE-id).
508
+ */
509
+ kyaToken?: string;
510
+ /**
511
+ * 5.15.0: A-Comm Evidence Protocol (AEP v1.0.3-rc.2) artifact payloads for
512
+ * your AEP chain — present when your endpoint lists `aep`: `policy` (section 3.4),
513
+ * `delegation` (section 3.9 protocol_metadata: kya_identity, consumer_authorization)
514
+ * and, for AstraSync bridge traffic, platform-countersigned `intents` (section 8.7).
515
+ * Append them with `AepChain` (your Ed25519 key). Merchant lane only.
516
+ */
517
+ aep?: AstraSyncAepEvidence;
464
518
  /** Timestamp of verification */
465
519
  verifiedAt: Date;
466
520
  /** TTL for this result (seconds) */
@@ -612,6 +666,12 @@ interface VerificationRequest {
612
666
  * key charge the owner's card at most once. Omit for raw one-shot confirms.
613
667
  */
614
668
  checkoutSessionId?: string;
669
+ /**
670
+ * 5.15.0: your signed checkout as a compact JWS (AP2 `checkout_jwt`). At a
671
+ * merchant whose endpoint lists `ap2`, a granted purchase leg returns
672
+ * `mandates` — closed AP2 Checkout + Payment mandates bound to it.
673
+ */
674
+ checkoutJwt?: string;
615
675
  /**
616
676
  * 5.3.0 (astra-pay): the checkout's authoritative line items, forwarded on
617
677
  * the confirm leg for the ORDER plane (receipts + digital-goods fulfillment
@@ -655,6 +715,8 @@ interface VerificationRequest {
655
715
  callerMetadata?: CallerMetadata;
656
716
  /** Enable runtime challenge for this request */
657
717
  enableRuntimeChallenge?: boolean;
718
+ /** 5.16.0: the matched route's policy for verify-access to enforce. */
719
+ routePolicy?: RoutePolicy;
658
720
  /** Create a verification session (returns sessionId) */
659
721
  createSession?: boolean;
660
722
  /** Counterparty type */
@@ -848,6 +910,14 @@ interface CommerceArtifactsPayload {
848
910
  secret: string;
849
911
  };
850
912
  }
913
+ /**
914
+ * 5.16.0: the matched route's policy that verify-access enforces (forwarded
915
+ * by the middleware from the dashboard route). Tighten-only.
916
+ */
917
+ interface RoutePolicy {
918
+ allowedOwners?: string[];
919
+ requiresRuntimeChallenge?: boolean;
920
+ }
851
921
  /**
852
922
  * Token guidance returned from verify-access.
853
923
  *
@@ -875,5 +945,39 @@ interface TokenGuidance {
875
945
  scopeConvention: 'astrasync-canonical';
876
946
  };
877
947
  }
948
+ /** 5.15.0: AP2 mandates AstraSync issued (see VerificationResult.mandates). */
949
+ interface AstraSyncMandates {
950
+ kid: string;
951
+ mode: 'closed' | 'open';
952
+ /** Delegate SD-JWT: mandate.checkout.1 / mandate.checkout.open.1. */
953
+ checkout: string;
954
+ /** Delegate SD-JWT: mandate.payment.1 / mandate.payment.open.1. */
955
+ payment?: string;
956
+ }
957
+ /** 5.15.0: AstraSync's AEP evidence (see VerificationResult.aep). */
958
+ interface AstraSyncAepEvidence {
959
+ spec_version: string;
960
+ policy: {
961
+ artifact_type: 'policy';
962
+ actor_type: 'merchant';
963
+ payload: Record<string, unknown>;
964
+ };
965
+ delegation?: {
966
+ artifact_type: 'delegation';
967
+ actor_type: 'agent';
968
+ actor_id: string;
969
+ payload: {
970
+ protocol_metadata: Record<string, unknown>;
971
+ };
972
+ };
973
+ intents?: Array<{
974
+ artifact_type: 'intent';
975
+ actor_type: 'agent';
976
+ actor_id: string;
977
+ payload: Record<string, unknown>;
978
+ /** Compact JWS (ES256) over the canonical payload; key in AstraSync's JWKS. */
979
+ platform_countersignature: string;
980
+ }>;
981
+ }
878
982
 
879
983
  export type { AgentCredentials as A, CommerceArtifactsPayload as C, GatewayConfig as G, TokenGuidance as T, VerificationRequest as V, AttemptReport as a, CounterpartyType as b, VerificationResult as c };
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-BCkwBA84.mjs';
1
+ import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-Blz520bR.mjs';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
@@ -1,4 +1,4 @@
1
- import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-BCkwBA84.js';
1
+ import { V as VerificationInterstitialProps, d as VerificationResult, A as AgentCredentials, b as GuidanceInfo, T as TrustLevel } from '../types-Blz520bR.js';
2
2
 
3
3
  /**
4
4
  * AstraSync Verification Interstitial Component
package/dist/verify.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-DlshIIR-.mjs';
1
+ import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-DBe4hgfT.mjs';
2
2
  import { ObservedMetadata } from './metadata-capture.mjs';
3
3
 
4
4
  /**
package/dist/verify.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-C_b4QTyO.js';
1
+ import { A as AgentCredentials, G as GatewayConfig, a as AttemptReport, V as VerificationRequest, c as VerificationResult } from './types-Bm1QvGqI.js';
2
2
  import { ObservedMetadata } from './metadata-capture.js';
3
3
 
4
4
  /**
package/dist/verify.js CHANGED
@@ -37,7 +37,7 @@ __export(verify_exports, {
37
37
  module.exports = __toCommonJS(verify_exports);
38
38
 
39
39
  // src/version.ts
40
- var SDK_VERSION = "5.14.0";
40
+ var SDK_VERSION = "5.16.0";
41
41
 
42
42
  // src/http.ts
43
43
  var SDK_USER_AGENT = `astrasync-sdk/${SDK_VERSION}`;
@@ -200,6 +200,8 @@ function getCacheKey(request, counterpartyId) {
200
200
  request.durationRequired ?? "",
201
201
  request.invocationProtocol || "",
202
202
  request.enableRuntimeChallenge ? "1" : "0",
203
+ // 5.16.0: route policy changes the verdict (owners / challenge).
204
+ request.routePolicy ? JSON.stringify(request.routePolicy) : "",
203
205
  // callerMetadata fields contribute to risk model; include the ones
204
206
  // backend reads. sourceIp/userAgent/forwardedFor change per-request
205
207
  // so their inclusion effectively forces a re-check for any varying
@@ -412,6 +414,7 @@ async function callVerifyAccessAPI(config, request) {
412
414
  if (requestData.subAgentDepth !== void 0) body.subAgentDepth = requestData.subAgentDepth;
413
415
  if (requestData.enableRuntimeChallenge)
414
416
  body.enableRuntimeChallenge = requestData.enableRuntimeChallenge;
417
+ if (requestData.routePolicy) body.routePolicy = requestData.routePolicy;
415
418
  if (requestData.createSession) body.createSession = requestData.createSession;
416
419
  if (requestData.durationRequired) body.durationRequired = requestData.durationRequired;
417
420
  if (requestData.counterpartyType) body.counterpartyType = requestData.counterpartyType;
@@ -422,6 +425,7 @@ async function callVerifyAccessAPI(config, request) {
422
425
  if (requestData.invocationProtocol) body.invocationProtocol = requestData.invocationProtocol;
423
426
  if (requestData.commercePhase) body.commercePhase = requestData.commercePhase;
424
427
  if (requestData.checkoutSessionId) body.checkoutSessionId = requestData.checkoutSessionId;
428
+ if (requestData.checkoutJwt) body.checkoutJwt = requestData.checkoutJwt;
425
429
  if (requestData.checkoutItems) body.checkoutItems = requestData.checkoutItems;
426
430
  if (requestData.buyerEmail) body.buyerEmail = requestData.buyerEmail;
427
431
  if (requestData.commerceArtifacts) body.commerceArtifacts = requestData.commerceArtifacts;
@@ -572,7 +576,8 @@ async function verify(config, request, options) {
572
576
  "[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."
573
577
  );
574
578
  }
575
- if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache) {
579
+ const uncacheable = Boolean(request.commerceArtifacts);
580
+ if (mergedConfig.cacheTtl !== 0 && !options?.bypassCache && !uncacheable) {
576
581
  const cached = getCachedResult(request, mergedConfig.counterpartyId);
577
582
  if (cached) {
578
583
  if (mergedConfig.debug) {
@@ -653,7 +658,10 @@ async function verify(config, request, options) {
653
658
  // MERCHANT caller only (bridge callers strip it before the agent plane).
654
659
  settlementToken: apiResponse.settlementToken,
655
660
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
656
- fulfilment: apiResponse.fulfilment
661
+ fulfilment: apiResponse.fulfilment,
662
+ mandates: apiResponse.mandates,
663
+ kyaToken: apiResponse.kyaToken,
664
+ aep: apiResponse.aep
657
665
  };
658
666
  return result2;
659
667
  }
@@ -663,7 +671,10 @@ async function verify(config, request, options) {
663
671
  trustScore: apiResponse.agent.trustScore,
664
672
  trustLevel: getTrustLevel(apiResponse.agent.trustScore),
665
673
  blockchainAnchored: apiResponse.agent.blockchainStatus === "anchored",
666
- status: apiResponse.agent.agentStatus
674
+ status: apiResponse.agent.agentStatus,
675
+ ...apiResponse.agent.protocolIdentities && {
676
+ protocolIdentities: apiResponse.agent.protocolIdentities
677
+ }
667
678
  } : void 0;
668
679
  const developer = apiResponse.developer ? {
669
680
  astradId: apiResponse.developer.kyaOwnerId,
@@ -714,7 +725,11 @@ async function verify(config, request, options) {
714
725
  settlementOutcome: apiResponse.settlementOutcome,
715
726
  settlementToken: apiResponse.settlementToken,
716
727
  // 5.6.0: fulfilment contact — merchant-only lane, same strip rule.
717
- fulfilment: apiResponse.fulfilment
728
+ fulfilment: apiResponse.fulfilment,
729
+ // 5.15.0: merchant-lane AP2 mandates + KYAPay identity token.
730
+ mandates: apiResponse.mandates,
731
+ kyaToken: apiResponse.kyaToken,
732
+ aep: apiResponse.aep
718
733
  };
719
734
  if (result.recommendation === "deny") {
720
735
  result.policyAllowed = false;
@@ -734,7 +749,9 @@ async function verify(config, request, options) {
734
749
  }
735
750
  const escalates = result.requiresStepUp === true || result.requiresApproval === true || result.recommendation === "step_up_required";
736
751
  if (mergedConfig.cacheTtl !== 0 && result.recommendation !== "deny" && !escalates) {
737
- cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
752
+ if (!uncacheable) {
753
+ cacheResult(request, result, mergedConfig.cacheTtl, mergedConfig.counterpartyId);
754
+ }
738
755
  }
739
756
  return result;
740
757
  }