@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
package/dist/index.d.mts CHANGED
@@ -1,7 +1,8 @@
1
- import { RequestHandler, Request, Response as Response$1 } from 'express';
1
+ import { RequestHandler, Request as Request$1, Response as Response$1 } from 'express';
2
2
  import * as next_server from 'next/server';
3
3
  import { NextRequest } from 'next/server';
4
- import { JWK } from 'jose';
4
+ import { JWK, KeyLike, JWTPayload } from 'jose';
5
+ import { KeyObject } from 'crypto';
5
6
 
6
7
  /**
7
8
  * Maximal metadata capture — the shared, edge-safe sanitiser.
@@ -358,6 +359,30 @@ interface VerifiedAgent {
358
359
  blockchainAnchored: boolean;
359
360
  /** Agent status */
360
361
  status: 'active' | 'inactive' | 'suspended' | 'migrating' | 'terminated' | 'retired';
362
+ /**
363
+ * 5.15.0: the protocol identities the agent declared at registration (its
364
+ * shared signing key, UCP profile, Web Bot Auth key directory, x402 wallet,
365
+ * network agent ids). Bind incoming protocol requests to these — e.g.
366
+ * {@link checkUcpAgentBinding} rejects a `UCP-Agent` profile that isn't the
367
+ * agent's. Identities AstraSync failed to verify are never included.
368
+ */
369
+ protocolIdentities?: AgentProtocolIdentities;
370
+ }
371
+ interface AgentProtocolIdentities {
372
+ /** Shared signing key (AP2 / VI `cnf`, RFC 9421). `thumbprint` = RFC 7638. */
373
+ agentKey?: {
374
+ kid: string | null;
375
+ thumbprint: string | null;
376
+ jwk: Record<string, unknown>;
377
+ };
378
+ ucpProfile?: string;
379
+ webBotAuthKeyDirectory?: string;
380
+ a2aCard?: string;
381
+ x402Wallet?: string;
382
+ visaAgentId?: string;
383
+ mastercardAgentId?: string;
384
+ /** Protocols whose identity AstraSync checked successfully. */
385
+ verified: string[];
361
386
  }
362
387
  /**
363
388
  * Verified developer (KYD) information
@@ -498,6 +523,13 @@ interface GuidanceInfo {
498
523
  interface StepUpApprovalInfo {
499
524
  approvalId: string;
500
525
  pollUrl: string;
526
+ /**
527
+ * 5.15.0: absolute https URL of the buyer-facing approval page. A UCP
528
+ * merchant returns it as `continue_url` with status `requires_escalation`;
529
+ * after the buyer approves, complete the same checkout again and the
530
+ * approval is redeemed once. Absent from backends older than 27.9.
531
+ */
532
+ approvalUrl?: string;
501
533
  expiresAt: string;
502
534
  }
503
535
  /**
@@ -673,19 +705,19 @@ interface VerificationResult {
673
705
  /** Settlement voucher (present on clean merchant-mediated grants with a verified wallet). */
674
706
  settlement?: SettlementArtifact;
675
707
  /**
676
- * 5.3.0 (astra-pay): sanitized first-party settlement outcome. Present
677
- * INSTEAD of `settlement` when the counterparty is an AstraSync-operated
678
- * storefront and the request carried `commercePhase: 'confirm'` — the
679
- * backend redeemed the voucher and executed the charge server-side
680
- * (charge-at-redeem), so there is no artifact to deliver, only the result.
681
- * `no_instrument` = policy passed but the owner has no chargeable
682
- * instrument on file (steer the user to add one via onboarding).
708
+ * Sanitized order outcome for a purchase leg. 5.14.1: AstraSync never
709
+ * charges — every purchase grant records an order and hands YOU the
710
+ * settlement artifact, so the status is `pending_merchant` (with
711
+ * `orderId`): charge the `settlementToken` (card, first-party tenant) or
712
+ * redeem the `settlement` voucher (stablecoin), then `reportSettlement()`.
713
+ * `no_instrument` = policy passed but the owner has nothing usable on file
714
+ * (steer the user to add one via onboarding).
683
715
  */
684
716
  settlementOutcome?: SettlementOutcomeInfo;
685
717
  /**
686
- * 5.5.0 (astra-pay): interim merchant self-settlement token. Present ONLY
687
- * for firstParty merchants opted into settlement_mode='self_settle' on the
688
- * confirm leg — YOUR server charges with this material on the shared Stripe
718
+ * Card settlement token. Present on a card purchase at a first-party
719
+ * storefront (our Stripe tenant) — 5.14.1: always, there is no charge-here
720
+ * mode. YOUR server charges with this material on the shared Stripe
689
721
  * account and reports the outcome via `client.reportSettlement()`.
690
722
  * MERCHANT-ONLY lane: never expose it to the agent plane, never log it,
691
723
  * never echo it back over the bridge handoff (the bridge strips it
@@ -706,6 +738,29 @@ interface VerificationResult {
706
738
  * confirm handoff body wins over `fulfilment.email` (the platform default).
707
739
  */
708
740
  fulfilment?: FulfilmentInfo;
741
+ /**
742
+ * 5.15.0: AP2 v0.2 mandates AstraSync issued for this purchase (merchant
743
+ * lane — never forward to the agent). `mode: 'closed'` on a purchase leg
744
+ * (Checkout + Payment, bound to your `checkoutJwt`), `'open'` on a quote
745
+ * leg for an agent with a registered key. Verify with `verifyAp2Mandate()`
746
+ * against AstraSync's JWKS (`kid`).
747
+ */
748
+ mandates?: AstraSyncMandates;
749
+ /**
750
+ * 5.15.0: a KYAPay `kya+jwt` identity token AstraSync issued for this agent
751
+ * at your endpoint (commerce legs; merchant lane). `hid.email` is where to
752
+ * send the receipt. Verify with `verifyKyaPayTokens()` (issuer = the
753
+ * AstraSync origin, audience = your ASTRAE-id).
754
+ */
755
+ kyaToken?: string;
756
+ /**
757
+ * 5.15.0: A-Comm Evidence Protocol (AEP v1.0.3-rc.2) artifact payloads for
758
+ * your AEP chain — present when your endpoint lists `aep`: `policy` (section 3.4),
759
+ * `delegation` (section 3.9 protocol_metadata: kya_identity, consumer_authorization)
760
+ * and, for AstraSync bridge traffic, platform-countersigned `intents` (section 8.7).
761
+ * Append them with `AepChain` (your Ed25519 key). Merchant lane only.
762
+ */
763
+ aep?: AstraSyncAepEvidence;
709
764
  /** Timestamp of verification */
710
765
  verifiedAt: Date;
711
766
  /** TTL for this result (seconds) */
@@ -857,6 +912,12 @@ interface VerificationRequest {
857
912
  * key charge the owner's card at most once. Omit for raw one-shot confirms.
858
913
  */
859
914
  checkoutSessionId?: string;
915
+ /**
916
+ * 5.15.0: your signed checkout as a compact JWS (AP2 `checkout_jwt`). At a
917
+ * merchant whose endpoint lists `ap2`, a granted purchase leg returns
918
+ * `mandates` — closed AP2 Checkout + Payment mandates bound to it.
919
+ */
920
+ checkoutJwt?: string;
860
921
  /**
861
922
  * 5.3.0 (astra-pay): the checkout's authoritative line items, forwarded on
862
923
  * the confirm leg for the ORDER plane (receipts + digital-goods fulfillment
@@ -900,6 +961,8 @@ interface VerificationRequest {
900
961
  callerMetadata?: CallerMetadata;
901
962
  /** Enable runtime challenge for this request */
902
963
  enableRuntimeChallenge?: boolean;
964
+ /** 5.16.0: the matched route's policy for verify-access to enforce. */
965
+ routePolicy?: RoutePolicy;
903
966
  /** Create a verification session (returns sessionId) */
904
967
  createSession?: boolean;
905
968
  /** Counterparty type */
@@ -1144,7 +1207,29 @@ interface RouteAccessConfig {
1144
1207
  */
1145
1208
  purpose?: string;
1146
1209
  action?: string;
1210
+ /**
1211
+ * 5.16.0: only agents owned by these organisations (ASTRAO- / ASTRAD- /
1212
+ * ASTRAI-ids) pass this route. Enforced by verify-access, which resolves
1213
+ * the agent's owner itself — the owner is never disclosed to you.
1214
+ */
1215
+ allowedOwners?: string[];
1216
+ /**
1217
+ * 5.16.0: require the runtime challenge on this route only (the endpoint
1218
+ * setting applies it to every route). An agent without a live callback is
1219
+ * denied here; other routes are unaffected.
1220
+ */
1221
+ requiresRuntimeChallenge?: boolean;
1222
+ }
1223
+ /**
1224
+ * 5.16.0: the matched route's policy that verify-access enforces (forwarded
1225
+ * by the middleware from the dashboard route). Tighten-only.
1226
+ */
1227
+ interface RoutePolicy {
1228
+ allowedOwners?: string[];
1229
+ requiresRuntimeChallenge?: boolean;
1147
1230
  }
1231
+ /** The forwardable route policy of a matched route, or undefined when it has none. */
1232
+ declare function routePolicyOf(route: Pick<RouteAccessConfig, 'allowedOwners' | 'requiresRuntimeChallenge'> | null | undefined): RoutePolicy | undefined;
1148
1233
  /**
1149
1234
  * Express middleware options.
1150
1235
  *
@@ -1194,7 +1279,7 @@ interface ExpressMiddlewareOptions extends GatewayConfig {
1194
1279
  onDenied?: (result: VerificationResult, req: unknown, res: unknown) => void;
1195
1280
  /** Automatically create sessions and record grant/deny decisions (default: true) */
1196
1281
  recordDecisions?: boolean;
1197
- /** Enable runtime challenge for all verify-access calls (default: true) */
1282
+ /** Ask for a runtime challenge on every verify-access call (default: false — opt-in, round 27.8) */
1198
1283
  enableRuntimeChallenge?: boolean;
1199
1284
  /**
1200
1285
  * Refresh interval (ms) for the remote-fetched route policy. Default:
@@ -1291,7 +1376,7 @@ interface NextJsMiddlewareOptions extends GatewayConfig {
1291
1376
  message?: string;
1292
1377
  allowGuestAccess?: boolean;
1293
1378
  };
1294
- /** Enable runtime challenge for all verify-access calls (default: true) */
1379
+ /** Ask for a runtime challenge on every verify-access call (default: false — opt-in, round 27.8) */
1295
1380
  enableRuntimeChallenge?: boolean;
1296
1381
  /**
1297
1382
  * Emit a fire-and-forget beacon for bot- and agent-shaped traffic that
@@ -1430,6 +1515,40 @@ interface VerificationInterstitialProps {
1430
1515
  }
1431
1516
  /** @deprecated Renamed VerificationInterstitialProps in 4.1.0; alias removed next major. */
1432
1517
  type CommerceShieldProps = VerificationInterstitialProps;
1518
+ /** 5.15.0: AP2 mandates AstraSync issued (see VerificationResult.mandates). */
1519
+ interface AstraSyncMandates {
1520
+ kid: string;
1521
+ mode: 'closed' | 'open';
1522
+ /** Delegate SD-JWT: mandate.checkout.1 / mandate.checkout.open.1. */
1523
+ checkout: string;
1524
+ /** Delegate SD-JWT: mandate.payment.1 / mandate.payment.open.1. */
1525
+ payment?: string;
1526
+ }
1527
+ /** 5.15.0: AstraSync's AEP evidence (see VerificationResult.aep). */
1528
+ interface AstraSyncAepEvidence {
1529
+ spec_version: string;
1530
+ policy: {
1531
+ artifact_type: 'policy';
1532
+ actor_type: 'merchant';
1533
+ payload: Record<string, unknown>;
1534
+ };
1535
+ delegation?: {
1536
+ artifact_type: 'delegation';
1537
+ actor_type: 'agent';
1538
+ actor_id: string;
1539
+ payload: {
1540
+ protocol_metadata: Record<string, unknown>;
1541
+ };
1542
+ };
1543
+ intents?: Array<{
1544
+ artifact_type: 'intent';
1545
+ actor_type: 'agent';
1546
+ actor_id: string;
1547
+ payload: Record<string, unknown>;
1548
+ /** Compact JWS (ES256) over the canonical payload; key in AstraSync's JWKS. */
1549
+ platform_countersignature: string;
1550
+ }>;
1551
+ }
1433
1552
 
1434
1553
  /**
1435
1554
  * AstraSync Universal Verification Gateway — Trust Level helpers.
@@ -1786,7 +1905,7 @@ declare global {
1786
1905
  * Extract extended AstraSync credentials (X-Astra-* headers) from Express request.
1787
1906
  * Returns null if no AstraSync headers are present.
1788
1907
  */
1789
- declare function extractAstraSyncCredentials(req: Request): AstraSyncCredentials | null;
1908
+ declare function extractAstraSyncCredentials(req: Request$1): AstraSyncCredentials | null;
1790
1909
  /**
1791
1910
  * Create Express middleware for agent verification.
1792
1911
  *
@@ -1936,6 +2055,8 @@ declare class VerificationGatewayClient {
1936
2055
  currency?: string;
1937
2056
  checkoutSessionId?: string;
1938
2057
  checkoutItems?: VerificationRequest['checkoutItems'];
2058
+ /** 5.15.0: your signed checkout (AP2 checkout_jwt) — returns `mandates` at AP2 merchants. */
2059
+ checkoutJwt?: string;
1939
2060
  /** 5.12.0: the `att_…` attempt-chain id from the bridge handoff body. */
1940
2061
  attemptId?: string;
1941
2062
  /** 5.6.0: alternate receipt/delivery email (transit-only) — omit to let
@@ -1945,21 +2066,27 @@ declare class VerificationGatewayClient {
1945
2066
  counterpartyType?: string;
1946
2067
  }): Promise<VerificationResult>;
1947
2068
  /**
1948
- * 5.5.0 (astra-pay): report a self-settled charge outcome back to the
1949
- * platform — the other half of the `settlementToken` contract. Call after
1950
- * your PaymentIntent reaches a terminal state so the buyer's dashboard,
1951
- * /orders and the agent's poll surface reconcile. Authenticated with this
1952
- * client's api key (must be the merchant's own). Amounts must match the
1953
- * order EXACTLY (integer minor units) or the report is rejected whole
1954
- * (409 amount_mismatch). Replays of the same terminal state are safe.
2069
+ * Report a settlement outcome back to the platform. 5.14.1: AstraSync never
2070
+ * charges — EVERY merchant settles the orders it is handed (card token,
2071
+ * stablecoin voucher, or a protocol-native credential) and reports here, so
2072
+ * the buyer's dashboard, /orders and the agent's poll surface reconcile.
2073
+ * Identify the order by the confirm's `sessionId` or the `orderId` from
2074
+ * `settlementOutcome`. A settled card charge carries `processorRef` (pi_…);
2075
+ * a settled stablecoin transfer carries `txHash` (+ `chainId`). Amounts must
2076
+ * match the order EXACTLY (integer minor units) or the report is rejected
2077
+ * whole (409 amount_mismatch). Replays of the same terminal state are safe.
1955
2078
  */
1956
2079
  reportSettlement(options: {
1957
- sessionId: string;
2080
+ sessionId?: string;
2081
+ orderId?: string;
1958
2082
  status: 'settled' | 'declined' | 'failed';
1959
2083
  amountMinor: number;
1960
2084
  currency: string;
1961
- /** Stripe PaymentIntent id — REQUIRED when status is 'settled'. */
2085
+ /** Stripe PaymentIntent id (card) — this or `txHash` is required when settled. */
1962
2086
  processorRef?: string;
2087
+ /** Stablecoin transfer transaction hash (0x…, 32 bytes). */
2088
+ txHash?: string;
2089
+ chainId?: number;
1963
2090
  failureCode?: string;
1964
2091
  }): Promise<{
1965
2092
  orderId: string;
@@ -2230,7 +2357,7 @@ interface ParsedRFC9421 {
2230
2357
  */
2231
2358
  declare function parseRFC9421(headers: Record<string, string | string[] | undefined>): ParsedRFC9421 | null;
2232
2359
 
2233
- type RegistryName = 'mastercard' | 'visa' | 'web-bot-auth';
2360
+ type RegistryName = 'mastercard' | 'visa' | 'web-bot-auth' | 'astrasync';
2234
2361
  interface RegistryResolver {
2235
2362
  readonly name: RegistryName;
2236
2363
  resolve(kid: string, context?: ResolveContext): Promise<JWK | null>;
@@ -2971,9 +3098,11 @@ declare function verifyMPP(input: MPPVerifyInput): MPPVerifyResult;
2971
3098
  * superset of x402; this module normalizes x402 output to MPP-shape so
2972
3099
  * downstream pipeline code is uniform.
2973
3100
  *
2974
- * Where x402 lives on the wire:
2975
- * - 402 response body (v2) OR `X-PAYMENT-REQUIRED` header (v1) — PaymentRequired
2976
- * - Request body (v2) OR `X-PAYMENT` header (v1, base64) — PaymentPayload
3101
+ * Where x402 lives on the wire (x402 Foundation transports-v2/http.md):
3102
+ * - v2: `PAYMENT-REQUIRED` header (402, base64 JSON) — PaymentRequired;
3103
+ * `PAYMENT-SIGNATURE` request header (base64 JSON) — PaymentPayload.
3104
+ * Bodies are a server concern; a JSON body is accepted as a fallback.
3105
+ * - v1: `X-PAYMENT-REQUIRED` / `X-PAYMENT` headers (and a 402 JSON body).
2977
3106
  */
2978
3107
  type X402Kind = 'required' | 'payload' | 'error' | 'unknown';
2979
3108
  interface X402RequirementsSummary {
@@ -3209,7 +3338,7 @@ interface CommerceContext {
3209
3338
  };
3210
3339
  paymentToken?: {
3211
3340
  present: boolean;
3212
- type: 'stripe-spt' | 'acp-vt' | 'tempo-tx' | 'other' | null;
3341
+ type: 'stripe-spt' | 'acp-vt' | 'tempo-tx' | 'x402-payload' | 'ap2-payment-mandate' | 'other' | null;
3213
3342
  };
3214
3343
  mppMethodsOffered?: string[];
3215
3344
  constraints?: ConstraintEvalResult;
@@ -3764,7 +3893,7 @@ interface McpMiddlewareOptions extends GatewayConfig {
3764
3893
  /** Skip verification + dedupe entirely. For testing. */
3765
3894
  skip?: boolean;
3766
3895
  /** Custom denied handler. Defaults to a structured JSON-RPC error response. */
3767
- onDenied?: (result: VerificationResult, req: Request, res: Response$1) => void;
3896
+ onDenied?: (result: VerificationResult, req: Request$1, res: Response$1) => void;
3768
3897
  /**
3769
3898
  * If `true`, trust an inbound `X-Astra-Verified-Hop` header to skip
3770
3899
  * verify-access when it carries a recent marker for the resolved agent.
@@ -3897,7 +4026,7 @@ interface AstraSyncConfig {
3897
4026
  * Multi-protocol declarations the agent participates in.
3898
4027
  * Promoted from `metadata.protocols[]` to a first-class field in agent-registration v1.0.0.
3899
4028
  */
3900
- type AgentProtocol = 'a2a' | 'acp' | 'ap2' | 'ucp' | 'mpp' | 'x402' | 'erc8004' | 'vi' | 'agentpay' | 'tap' | 'other';
4029
+ type AgentProtocol = 'a2a' | 'acp' | 'ap2' | 'ucp' | 'mpp' | 'x402' | 'erc8004' | 'vi' | 'agentpay' | 'tap' | 'webbotauth' | 'other';
3901
4030
  /** PDLSS purpose configuration. */
3902
4031
  interface PDLSSPurpose {
3903
4032
  categories: string[];
@@ -4284,6 +4413,32 @@ declare class RegistrationTimeoutError extends AstraSyncError {
4284
4413
  readonly requestId: string;
4285
4414
  constructor(requestId: string);
4286
4415
  }
4416
+ /**
4417
+ * 5.15.0: thrown by `client.reportSettlement()`. `statusCode` is the HTTP
4418
+ * status (0 = the request never got a response: network error / timeout);
4419
+ * `code` is the platform's error code (e.g. `amount_mismatch`,
4420
+ * `conflicting_report`, `conflicting_reference`, `not_your_merchant`,
4421
+ * `unknown_session`, `unknown_order`, `VALIDATION`, `api_key_expired`).
4422
+ * `retryable` is the safe retry decision — see isRetryableSettlementError.
4423
+ */
4424
+ declare class SettlementReportError extends AstraSyncError {
4425
+ readonly issues?: Array<{
4426
+ field: string;
4427
+ message: string;
4428
+ }>;
4429
+ readonly retryable: boolean;
4430
+ constructor(message: string, statusCode: number, code?: string, issues?: Array<{
4431
+ field: string;
4432
+ message: string;
4433
+ }>);
4434
+ }
4435
+ /**
4436
+ * Retry a settlement report only on a network error / timeout (statusCode
4437
+ * 0), 429 or 5xx. Every 4xx is a decision about this report (wrong amount,
4438
+ * not your order, conflicting outcome …) and replaying it can't succeed.
4439
+ * Replaying the SAME terminal outcome is always safe (200 alreadySettled).
4440
+ */
4441
+ declare function isRetryableSettlementError(err: unknown): boolean;
4287
4442
 
4288
4443
  /**
4289
4444
  * Guidance envelope for credentials-required cases.
@@ -4360,6 +4515,61 @@ interface BuildGuidanceParams {
4360
4515
  */
4361
4516
  declare function buildGuidance(params: BuildGuidanceParams): GuidanceEnvelope;
4362
4517
 
4518
+ /**
4519
+ * ChallengeHandler — Agent-Side Runtime Challenge Responder
4520
+ *
4521
+ * Handles incoming runtime challenges from AstraSync's verification service.
4522
+ * Agents register pending counterparties before initiating contact,
4523
+ * then this handler validates and responds to challenges.
4524
+ */
4525
+ interface ChallengeResponse {
4526
+ status: number;
4527
+ body: {
4528
+ challengeId: string;
4529
+ acknowledged: boolean;
4530
+ pendingCounterparties: string[];
4531
+ respondedAt: string;
4532
+ error?: string;
4533
+ };
4534
+ }
4535
+ interface ChallengeHandlerConfig {
4536
+ agentId: string;
4537
+ }
4538
+ declare class ChallengeHandler {
4539
+ private agentId;
4540
+ /** Counterparty → in-flight interactions (two concurrent calls to one counterparty both count). */
4541
+ private pendingCounterparties;
4542
+ constructor(config: ChallengeHandlerConfig);
4543
+ /**
4544
+ * Register a counterparty as pending (before initiating contact).
4545
+ */
4546
+ registerPending(counterpartyId: string): void;
4547
+ /**
4548
+ * Remove a counterparty from pending list (after interaction complete).
4549
+ */
4550
+ removePending(counterpartyId: string): void;
4551
+ /**
4552
+ * Get current pending counterparties list.
4553
+ */
4554
+ getPendingList(): string[];
4555
+ /**
4556
+ * Express middleware for the challenge endpoint.
4557
+ * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4558
+ */
4559
+ expressMiddleware(): (req: {
4560
+ body: unknown;
4561
+ }, res: {
4562
+ status: (code: number) => {
4563
+ json: (body: unknown) => void;
4564
+ };
4565
+ }) => void;
4566
+ /**
4567
+ * Generic handler (framework-agnostic).
4568
+ * Returns { status, body } for the caller to send.
4569
+ */
4570
+ handleChallenge(body: unknown): ChallengeResponse;
4571
+ }
4572
+
4363
4573
  /**
4364
4574
  * AgentClient — Credential Presentation
4365
4575
  *
@@ -4376,15 +4586,29 @@ interface AgentClientConfig {
4376
4586
  apiBaseUrl?: string;
4377
4587
  /** API key used to authenticate ownership check + other authenticated calls. */
4378
4588
  apiKey?: string;
4589
+ /**
4590
+ * 5.16.0: the agent's runtime-challenge responder. When set, fetch()
4591
+ * registers each call's counterparty as pending while the call is in
4592
+ * flight, so the destination's runtime challenge passes for calls this
4593
+ * agent is really making — and only those.
4594
+ */
4595
+ challengeHandler?: ChallengeHandler;
4379
4596
  }
4380
4597
  interface FetchOptions extends RequestInit {
4381
4598
  purpose?: string;
4382
4599
  action?: string;
4600
+ /**
4601
+ * 5.16.0: the destination's ASTRAE-id, when known. Its runtime challenge
4602
+ * names the endpoint by ASTRAE-id (else by URL), so pass it for endpoints
4603
+ * that require the challenge.
4604
+ */
4605
+ counterpartyId?: string;
4383
4606
  }
4384
4607
  declare class AgentClient {
4385
4608
  private credentials;
4386
4609
  private apiBaseUrl;
4387
4610
  private apiKey;
4611
+ private challengeHandler;
4388
4612
  constructor(config: AgentClientConfig);
4389
4613
  /**
4390
4614
  * Async factory that validates the API key's account owns the configured
@@ -4430,60 +4654,6 @@ declare class AgentClient {
4430
4654
  private buildCredentials;
4431
4655
  }
4432
4656
 
4433
- /**
4434
- * ChallengeHandler — Agent-Side Runtime Challenge Responder
4435
- *
4436
- * Handles incoming runtime challenges from AstraSync's verification service.
4437
- * Agents register pending counterparties before initiating contact,
4438
- * then this handler validates and responds to challenges.
4439
- */
4440
- interface ChallengeResponse {
4441
- status: number;
4442
- body: {
4443
- challengeId: string;
4444
- acknowledged: boolean;
4445
- pendingCounterparties: string[];
4446
- respondedAt: string;
4447
- error?: string;
4448
- };
4449
- }
4450
- interface ChallengeHandlerConfig {
4451
- agentId: string;
4452
- }
4453
- declare class ChallengeHandler {
4454
- private agentId;
4455
- private pendingCounterparties;
4456
- constructor(config: ChallengeHandlerConfig);
4457
- /**
4458
- * Register a counterparty as pending (before initiating contact).
4459
- */
4460
- registerPending(counterpartyId: string): void;
4461
- /**
4462
- * Remove a counterparty from pending list (after interaction complete).
4463
- */
4464
- removePending(counterpartyId: string): void;
4465
- /**
4466
- * Get current pending counterparties list.
4467
- */
4468
- getPendingList(): string[];
4469
- /**
4470
- * Express middleware for the challenge endpoint.
4471
- * Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
4472
- */
4473
- expressMiddleware(): (req: {
4474
- body: unknown;
4475
- }, res: {
4476
- status: (code: number) => {
4477
- json: (body: unknown) => void;
4478
- };
4479
- }) => void;
4480
- /**
4481
- * Generic handler (framework-agnostic).
4482
- * Returns { status, body } for the caller to send.
4483
- */
4484
- handleChallenge(body: unknown): ChallengeResponse;
4485
- }
4486
-
4487
4657
  /**
4488
4658
  * PDLSS Formatter — Transport Format Conversion
4489
4659
  *
@@ -4605,6 +4775,28 @@ declare namespace index {
4605
4775
  export { index_AgentClient as AgentClient, index_AstraSyncSdkError as AstraSyncSdkError, index_ChallengeHandler as ChallengeHandler, index_OwnershipMismatchError as OwnershipMismatchError, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
4606
4776
  }
4607
4777
 
4778
+ /**
4779
+ * Route pattern compiler shared by every matcher of endpoint route policy:
4780
+ * the express and Next.js middleware, the edge config and the AstraSync
4781
+ * bridge (round 27.9 — they each had their own copy, and none understood
4782
+ * path parameters).
4783
+ *
4784
+ * Pattern syntax:
4785
+ * - `*` any characters, including `/` (unchanged since v1)
4786
+ * - `:name` exactly one path segment (no `/`), e.g.
4787
+ * `/ucp/v1/checkout-sessions/:id/complete`
4788
+ * - anything else is literal — `.`, `?`, `+`, `(`… are escaped (they used
4789
+ * to be live regex syntax, so `/robots.txt` also matched `/robotsXtxt`).
4790
+ * Anchored `^…$`. Case-sensitive unless `caseInsensitive` is set.
4791
+ */
4792
+ declare function routePatternToRegExp(pattern: string, opts?: {
4793
+ caseInsensitive?: boolean;
4794
+ }): RegExp | null;
4795
+ /** True when `path` matches `pattern` (see routePatternToRegExp). */
4796
+ declare function matchRoutePattern(pattern: string, path: string, opts?: {
4797
+ caseInsensitive?: boolean;
4798
+ }): boolean;
4799
+
4608
4800
  /**
4609
4801
  * Edge verification config — the per-endpoint policy the Trusted Agent
4610
4802
  * Gateway edge adapters (e.g. `@astrasyncai/adapter-lambda`) fetch from the
@@ -4704,6 +4896,13 @@ interface EdgeConfig {
4704
4896
  * endpoint owner explicitly configures this.
4705
4897
  */
4706
4898
  queryValueAllowlist?: string[];
4899
+ /**
4900
+ * 5.15.0: minimum TLS version for AGENT traffic (UCP 2026-08-25 requires
4901
+ * TLS 1.3). Read from CloudFront-Viewer-TLS; follows the path's mode —
4902
+ * enforce answers 426 Upgrade Required, observe only logs. Human browsers
4903
+ * are never gated, and an unknown version never blocks. ABSENT = no check.
4904
+ */
4905
+ minTls?: '1.2' | '1.3';
4707
4906
  /**
4708
4907
  * 4.5.0: the EFFECTIVE failure posture is derived from the effective
4709
4908
  * mode — fail posture follows success posture. Observe fails open
@@ -4935,7 +5134,7 @@ declare function detectRuntime(userAgent: string | undefined | null): string | u
4935
5134
  * silently (never throwing), so this is a no-op there — which is correct:
4936
5135
  * in a browser the page's real UA is the honest identity.
4937
5136
  */
4938
- declare const SDK_USER_AGENT = "astrasync-sdk/5.14.0";
5137
+ declare const SDK_USER_AGENT = "astrasync-sdk/5.16.0";
4939
5138
  declare const sdkFetch: typeof fetch;
4940
5139
 
4941
5140
  interface LocalPolicy {
@@ -5053,6 +5252,1126 @@ declare function parseYaml(yamlContent: string): ParseResult;
5053
5252
  * is fine — bumping both in the release-ceremony commit keeps them
5054
5253
  * lockstep.
5055
5254
  */
5056
- declare const SDK_VERSION = "5.14.0";
5255
+ declare const SDK_VERSION = "5.16.0";
5256
+
5257
+ /**
5258
+ * 5.15.0 — the `UCP-Agent` request header (UCP 2026-08-25): an RFC 8941
5259
+ * structured-field dictionary whose `profile` member is the URL of the calling
5260
+ * platform's UCP profile, e.g.
5261
+ *
5262
+ * UCP-Agent: profile="https://agent.example/.well-known/ucp"
5263
+ *
5264
+ * A UCP merchant behind AstraSync binds it to the verified agent: the profile
5265
+ * must be the one the agent registered (gadget D, round 27.9). Without the
5266
+ * binding, any caller could present a verified agent's id with someone
5267
+ * else's profile and capabilities.
5268
+ */
5269
+
5270
+ /** The `profile` URL from a `UCP-Agent` header, or null when absent/malformed. */
5271
+ declare function parseUcpAgentHeader(header: string | string[] | null | undefined): string | null;
5272
+ type UcpAgentBinding = {
5273
+ ok: true;
5274
+ profile: string | null;
5275
+ } | {
5276
+ ok: false;
5277
+ code: 'invalid_ucp_agent' | 'ucp_agent_mismatch';
5278
+ message: string;
5279
+ };
5280
+ /**
5281
+ * Check a request's `UCP-Agent` header against the verified agent's registered
5282
+ * UCP profile. Rules:
5283
+ * - header absent and agent has no registered profile → ok (not a UCP caller)
5284
+ * - header absent but agent registered one → ok, profile = the registered one
5285
+ * - header present but malformed / not https → `invalid_ucp_agent`
5286
+ * - header present and agent registered a DIFFERENT profile → `ucp_agent_mismatch`
5287
+ * - header present, agent registered none → `ucp_agent_mismatch` (unbound
5288
+ * profiles are refused; register it in the agent's protocol step)
5289
+ */
5290
+ declare function checkUcpAgentBinding(header: string | string[] | null | undefined, identities: AgentProtocolIdentities | undefined): UcpAgentBinding;
5291
+
5292
+ /**
5293
+ * 5.15.0 — the business profile at `/.well-known/ucp` (UCP 2026-08-25,
5294
+ * docs/specification/overview). `ucp.version`, `ucp.services` and
5295
+ * `ucp.payment_handlers` are required even when empty; signing keys are the
5296
+ * TOP-LEVEL `keys[]` (a JWK Set). Served over HTTPS, never redirected, with
5297
+ * `Cache-Control: public, max-age >= 60`.
5298
+ */
5299
+
5300
+ declare const UCP_VERSION = "2026-08-25";
5301
+ interface UcpServiceEntry {
5302
+ version: string;
5303
+ spec: string;
5304
+ transport: 'rest' | 'mcp' | 'a2a' | 'embedded';
5305
+ endpoint: string;
5306
+ schema?: string;
5307
+ }
5308
+ interface UcpCapabilityEntry {
5309
+ version: string;
5310
+ spec: string;
5311
+ schema: string;
5312
+ extends?: string;
5313
+ config?: Record<string, unknown>;
5314
+ }
5315
+ interface UcpPaymentHandlerEntry {
5316
+ id: string;
5317
+ version: string;
5318
+ spec: string;
5319
+ schema: string;
5320
+ available_instruments?: Array<{
5321
+ type: string;
5322
+ constraints?: Record<string, unknown>;
5323
+ }>;
5324
+ config?: Record<string, unknown>;
5325
+ }
5326
+ interface UcpProfile {
5327
+ ucp: {
5328
+ version: string;
5329
+ services: Record<string, UcpServiceEntry[]>;
5330
+ capabilities?: Record<string, UcpCapabilityEntry[]>;
5331
+ payment_handlers: Record<string, UcpPaymentHandlerEntry[]>;
5332
+ };
5333
+ keys?: JWK[];
5334
+ }
5335
+ /** AstraSync payment handler declarations (spec pages hosted on astrasync.ai). */
5336
+ declare function astrasyncPaymentHandlers(handlers: string[], specBase?: string): Record<string, UcpPaymentHandlerEntry[]>;
5337
+ interface BuildProfileOptions {
5338
+ /** REST base, e.g. https://shop.example/ucp/v1 */
5339
+ endpoint: string;
5340
+ /** Public signing keys (JWKs with kid). */
5341
+ keys?: JWK[];
5342
+ /** Payment handler ids you accept (see the endpoint's paymentHandlers). */
5343
+ paymentHandlers?: string[];
5344
+ /** Accept AP2 mandates (adds dev.ucp.common.payment.ap2_mandate). */
5345
+ ap2Mandates?: boolean;
5346
+ /** Extra capabilities beyond checkout (e.g. order). */
5347
+ capabilities?: Record<string, UcpCapabilityEntry[]>;
5348
+ }
5349
+ declare function buildUcpProfile(opts: BuildProfileOptions): UcpProfile;
5350
+ /** A fetch-style handler for GET /.well-known/ucp. */
5351
+ declare function ucpProfileHandler(profile: UcpProfile, maxAgeSec?: number): () => Promise<Response>;
5352
+
5353
+ type UcpDiscoveryError = {
5354
+ ok: false;
5355
+ status: 400 | 422 | 424;
5356
+ code: 'invalid_profile_url' | 'profile_unreachable' | 'profile_malformed' | 'version_unsupported';
5357
+ content: string;
5358
+ };
5359
+ type UcpProfileResult = {
5360
+ ok: true;
5361
+ profile: UcpProfile;
5362
+ } | UcpDiscoveryError;
5363
+ /** True for loopback / private / link-local / CGNAT / multicast / reserved addresses. */
5364
+ declare function isSpecialUseIp(ip: string): boolean;
5365
+ interface FetchProfileOptions {
5366
+ timeoutMs?: number;
5367
+ fetch?: typeof fetch;
5368
+ /** Skip DNS resolution checks (tests only). */
5369
+ skipDnsCheck?: boolean;
5370
+ /** Bypass the cache (unknown signing key → refresh once per TTL). */
5371
+ fresh?: boolean;
5372
+ }
5373
+ declare function fetchUcpProfile(url: string, opts?: FetchProfileOptions): Promise<UcpProfileResult>;
5374
+ interface NegotiationResult {
5375
+ ok: boolean;
5376
+ version: string;
5377
+ /** Capability names both sides support (extensions only with their base). */
5378
+ capabilities: Record<string, UcpCapabilityEntry[]>;
5379
+ error?: UcpDiscoveryError;
5380
+ }
5381
+ /**
5382
+ * Intersect the business's and platform's profiles. `supportedVersions` is
5383
+ * every protocol version the business still serves (current first).
5384
+ */
5385
+ declare function negotiateUcp(business: UcpProfile, platform: UcpProfile, supportedVersions?: string[]): NegotiationResult;
5386
+
5387
+ /**
5388
+ * 5.15.0 — UCP `messages[]` and response envelopes (UCP 2026-08-25
5389
+ * shopping/checkout). Error severities: recoverable, requires_buyer_input,
5390
+ * requires_buyer_review, unrecoverable — `requires_*` contribute to
5391
+ * `status: 'requires_escalation'`, which MUST carry an absolute https
5392
+ * `continue_url`.
5393
+ */
5394
+ type UcpSeverity = 'recoverable' | 'requires_buyer_input' | 'requires_buyer_review' | 'unrecoverable';
5395
+ type UcpMessage = {
5396
+ type: 'error';
5397
+ code: string;
5398
+ content: string;
5399
+ severity: UcpSeverity;
5400
+ path?: string;
5401
+ content_type?: 'plain' | 'markdown';
5402
+ } | {
5403
+ type: 'warning';
5404
+ code: string;
5405
+ content: string;
5406
+ presentation?: 'notice' | 'disclosure';
5407
+ url?: string;
5408
+ } | {
5409
+ type: 'info';
5410
+ content: string;
5411
+ code?: string;
5412
+ };
5413
+ declare const ucpError: (code: string, content: string, severity?: UcpSeverity, path?: string) => UcpMessage;
5414
+ /**
5415
+ * The AstraSync step-up → UCP escalation: the buyer approves on AstraSync's
5416
+ * approval page (`approvalUrl`), then the platform completes again.
5417
+ */
5418
+ declare function ucpEscalation(approvalUrl: string, content?: string): {
5419
+ status: "requires_escalation";
5420
+ continue_url: string;
5421
+ messages: UcpMessage[];
5422
+ };
5423
+ /** A failed-operation envelope: `{ ucp: { version, status: 'error' }, messages, continue_url? }`. */
5424
+ declare function ucpFailure(version: string, messages: UcpMessage[], continueUrl?: string): {
5425
+ continue_url?: string | undefined;
5426
+ ucp: {
5427
+ version: string;
5428
+ status: "error";
5429
+ };
5430
+ messages: UcpMessage[];
5431
+ };
5432
+
5433
+ /**
5434
+ * 5.15.0 — UCP message signatures (UCP 2026-08-25 signatures.md): RFC 9421
5435
+ * with
5436
+ * covered: "@method" "@authority" "@path" (+ "@query" when present)
5437
+ * + "ucp-agent" / "signature-agent" when those headers are sent
5438
+ * + "idempotency-key" on POST / PUT / PATCH / DELETE
5439
+ * + "content-digest" "content-type" when there is a body
5440
+ * params: keyid (created optional; `alg` NOT included — the JWK's
5441
+ * kty/crv decides). ECDSA signatures are raw r||s.
5442
+ * `keyid` resolves to a `kid` in the signer's profile `keys[]` (keys with
5443
+ * `use: 'enc'` are skipped); an unknown kid forces one profile refresh.
5444
+ * Responses sign ("@status" "content-digest" "content-type").
5445
+ * Errors: signature_missing / signature_invalid / key_not_found (401),
5446
+ * digest_mismatch / algorithm_unsupported (400).
5447
+ */
5448
+
5449
+ interface UcpSignableRequest {
5450
+ method: string;
5451
+ url: string;
5452
+ headers: Record<string, string>;
5453
+ body?: string;
5454
+ }
5455
+ /** The components UCP requires for this request. */
5456
+ declare function ucpRequiredComponents(req: UcpSignableRequest): string[];
5457
+ /** Sign a UCP request (platform → business, or business → platform webhook). */
5458
+ declare function signUcpRequest(req: UcpSignableRequest, key: {
5459
+ privateKey: KeyObject | string;
5460
+ keyId: string;
5461
+ }): Promise<Record<string, string>>;
5462
+ /** Sign a UCP response: ("@status" "content-digest" "content-type"). */
5463
+ declare function signUcpResponse(res: {
5464
+ status: number;
5465
+ headers: Record<string, string>;
5466
+ body: string;
5467
+ }, key: {
5468
+ privateKey: KeyObject | string;
5469
+ keyId: string;
5470
+ }): Promise<Record<string, string>>;
5471
+ type UcpSignatureResult = {
5472
+ ok: true;
5473
+ keyId: string;
5474
+ } | {
5475
+ ok: false;
5476
+ status: 400 | 401;
5477
+ code: 'signature_missing' | 'signature_invalid' | 'key_not_found' | 'digest_mismatch' | 'algorithm_unsupported';
5478
+ content: string;
5479
+ };
5480
+ /**
5481
+ * Verify a signed UCP request against the signer's profile keys.
5482
+ * `getKeys(fresh)` returns the signer profile's `keys[]` (refreshed once on
5483
+ * an unknown kid).
5484
+ */
5485
+ declare function verifyUcpRequest(req: UcpSignableRequest, getKeys: (fresh: boolean) => Promise<JWK[]>): Promise<UcpSignatureResult>;
5486
+ interface UcpWebhookOptions {
5487
+ url: string;
5488
+ /** The order event body (JSON). */
5489
+ body: unknown;
5490
+ privateKey: KeyObject | string;
5491
+ keyId: string;
5492
+ /** Your business profile URL (sent as UCP-Agent). */
5493
+ businessProfileUrl: string;
5494
+ attempts?: number;
5495
+ fetch?: typeof fetch;
5496
+ }
5497
+ /** Send a signed UCP order webhook with retry/backoff on network errors, 429 and 5xx. */
5498
+ declare function sendUcpWebhook(opts: UcpWebhookOptions): Promise<{
5499
+ ok: boolean;
5500
+ status: number;
5501
+ attempts: number;
5502
+ }>;
5503
+
5504
+ interface IdempotencyRecord {
5505
+ state: 'in_progress' | 'done';
5506
+ requestHash: string;
5507
+ status?: number;
5508
+ headers?: Record<string, string>;
5509
+ body?: string;
5510
+ }
5511
+ interface IdempotencyStore {
5512
+ get(key: string): Promise<IdempotencyRecord | null>;
5513
+ /** Store only when absent (the lock). Returns false when the key exists. */
5514
+ create(key: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;
5515
+ set(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
5516
+ delete(key: string): Promise<void>;
5517
+ }
5518
+ /** In-process store (single instance / tests). */
5519
+ declare class MemoryIdempotencyStore implements IdempotencyStore {
5520
+ private now;
5521
+ private map;
5522
+ constructor(now?: () => number);
5523
+ private live;
5524
+ get(key: string): Promise<IdempotencyRecord | null>;
5525
+ create(key: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;
5526
+ set(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
5527
+ delete(key: string): Promise<void>;
5528
+ }
5529
+ /** The subset of a Redis client this store needs (ioredis / node-redis v4 compatible). */
5530
+ interface RedisLike {
5531
+ get(key: string): Promise<string | null>;
5532
+ set(key: string, value: string, ...args: Array<string | number>): Promise<unknown>;
5533
+ del(key: string): Promise<unknown>;
5534
+ }
5535
+ /** Shared store across instances. */
5536
+ declare class RedisIdempotencyStore implements IdempotencyStore {
5537
+ private redis;
5538
+ private prefix;
5539
+ constructor(redis: RedisLike, prefix?: string);
5540
+ get(key: string): Promise<IdempotencyRecord | null>;
5541
+ create(key: string, record: IdempotencyRecord, ttlMs: number): Promise<boolean>;
5542
+ set(key: string, record: IdempotencyRecord, ttlMs: number): Promise<void>;
5543
+ delete(key: string): Promise<void>;
5544
+ }
5545
+ interface IdempotencyOptions {
5546
+ store: IdempotencyStore;
5547
+ /** 'ucp' (default) or 'acp' — see the module comment. */
5548
+ profile?: 'ucp' | 'acp';
5549
+ /** Default 24 h. */
5550
+ ttlMs?: number;
5551
+ /** Default `idempotency-key`. */
5552
+ header?: string;
5553
+ /** Methods covered. Default POST, PUT, PATCH, DELETE. */
5554
+ methods?: string[];
5555
+ /** Require the header on covered methods (400 when missing). Default false. */
5556
+ required?: boolean;
5557
+ }
5558
+ declare const DEFAULT_IDEMPOTENCY_TTL_MS: number;
5559
+ type IdempotencyDecision = {
5560
+ kind: 'skip';
5561
+ } | {
5562
+ kind: 'proceed';
5563
+ storeKey: string;
5564
+ requestHash: string;
5565
+ } | {
5566
+ kind: 'replay';
5567
+ status: number;
5568
+ headers: Record<string, string>;
5569
+ body: string;
5570
+ } | {
5571
+ kind: 'reject';
5572
+ status: number;
5573
+ code: string;
5574
+ message: string;
5575
+ retryAfterSec?: number;
5576
+ };
5577
+ /**
5578
+ * SHA-256 of the request body: raw bytes for 'ucp', canonical JSON (when it
5579
+ * parses) for 'acp'.
5580
+ */
5581
+ declare function requestFingerprint(body: string, profile?: 'ucp' | 'acp'): string;
5582
+ /** Platform-neutral core: decide before handling a request. */
5583
+ declare function beginIdempotent(opts: IdempotencyOptions, req: {
5584
+ method: string;
5585
+ path: string;
5586
+ body: string;
5587
+ key: string | undefined;
5588
+ auth?: string;
5589
+ }): Promise<IdempotencyDecision>;
5590
+ /** Platform-neutral core: record the outcome after handling. */
5591
+ declare function finishIdempotent(opts: IdempotencyOptions, decision: Extract<IdempotencyDecision, {
5592
+ kind: 'proceed';
5593
+ }>, response: {
5594
+ status: number;
5595
+ headers: Record<string, string>;
5596
+ body: string;
5597
+ }): Promise<void>;
5598
+ interface ExpressReq {
5599
+ method: string;
5600
+ originalUrl?: string;
5601
+ url: string;
5602
+ body?: unknown;
5603
+ headers: Record<string, string | string[] | undefined>;
5604
+ }
5605
+ interface ExpressRes {
5606
+ statusCode: number;
5607
+ status(code: number): ExpressRes;
5608
+ setHeader(name: string, value: string): unknown;
5609
+ getHeader(name: string): unknown;
5610
+ send(body: unknown): unknown;
5611
+ json(body: unknown): unknown;
5612
+ end(...args: unknown[]): unknown;
5613
+ }
5614
+ /** Express middleware. Mount after body parsing, before the checkout routes. */
5615
+ declare function idempotencyMiddleware(opts: IdempotencyOptions): (req: ExpressReq, res: ExpressRes, next: (err?: unknown) => void) => Promise<void>;
5616
+ /** Next.js / fetch-style route handler wrapper. */
5617
+ declare function withIdempotency(opts: IdempotencyOptions, handler: (req: Request) => Promise<Response>): (req: Request) => Promise<Response>;
5618
+
5619
+ interface CatalogItem {
5620
+ id: string;
5621
+ title: string;
5622
+ /** Minor units. */
5623
+ price: number;
5624
+ }
5625
+ interface CheckoutLine {
5626
+ id: string;
5627
+ item: CatalogItem;
5628
+ quantity: number;
5629
+ totals: Array<{
5630
+ type: string;
5631
+ amount: number;
5632
+ }>;
5633
+ }
5634
+ interface CheckoutSession {
5635
+ id: string;
5636
+ status: 'incomplete' | 'requires_escalation' | 'ready_for_complete' | 'complete_in_progress' | 'completed' | 'canceled';
5637
+ currency: string;
5638
+ line_items: CheckoutLine[];
5639
+ totals: Array<{
5640
+ type: string;
5641
+ amount: number;
5642
+ }>;
5643
+ buyer?: Record<string, unknown>;
5644
+ messages?: UcpMessage[];
5645
+ continue_url?: string;
5646
+ order?: {
5647
+ id: string;
5648
+ permalink_url?: string;
5649
+ };
5650
+ /** Kit state (never serialised). */
5651
+ _platformProfile?: string;
5652
+ _ap2?: boolean;
5653
+ _platformKeys?: JWK[];
5654
+ _astraOrderId?: string;
5655
+ _attemptId?: string;
5656
+ /** The AstraSync cart id the platform sent (X-Astra-Checkout-Session). */
5657
+ _astraCheckoutSessionId?: string;
5658
+ /** The attached checkout JWS behind the last merchant_authorization sent. */
5659
+ _checkoutJwt?: string;
5660
+ }
5661
+ interface CheckoutStore {
5662
+ get(id: string): Promise<CheckoutSession | null>;
5663
+ put(s: CheckoutSession): Promise<void>;
5664
+ }
5665
+ declare class MemoryCheckoutStore implements CheckoutStore {
5666
+ private m;
5667
+ get(id: string): Promise<CheckoutSession | null>;
5668
+ put(s: CheckoutSession): Promise<void>;
5669
+ }
5670
+ type SettleResult = {
5671
+ status: 'settled';
5672
+ processorRef?: string;
5673
+ txHash?: string;
5674
+ chainId?: number;
5675
+ } | {
5676
+ status: 'pending';
5677
+ } | {
5678
+ status: 'failed';
5679
+ failureCode?: string;
5680
+ };
5681
+ interface UcpCheckoutKitOptions {
5682
+ /** Profile inputs (endpoint, keys, paymentHandlers, ap2Mandates). */
5683
+ profile: BuildProfileOptions;
5684
+ currency: string;
5685
+ /** Your catalog: the item, or null when unknown. */
5686
+ catalog: (itemId: string) => Promise<CatalogItem | null>;
5687
+ /** AstraSync verification of the purchase (e.g. `client.confirmCheckout`). */
5688
+ verifyPurchase: (ctx: {
5689
+ session: CheckoutSession;
5690
+ /**
5691
+ * Pass as `checkoutSessionId` to AstraSync: the platform's cart id when
5692
+ * it sent one (an owner approval is bound to that cart), else this
5693
+ * checkout's id.
5694
+ */
5695
+ checkoutSessionId: string;
5696
+ astraId?: string;
5697
+ attemptId?: string;
5698
+ checkoutJwt?: string;
5699
+ valueMajor: number;
5700
+ }) => Promise<VerificationResult>;
5701
+ /** Charge / redeem with YOUR processor using the artifact AstraSync handed you. */
5702
+ settle: (ctx: {
5703
+ session: CheckoutSession;
5704
+ result: VerificationResult;
5705
+ instrument?: Record<string, unknown>;
5706
+ }) => Promise<SettleResult>;
5707
+ /** Report the outcome to AstraSync (e.g. `client.reportSettlement`). */
5708
+ reportSettlement?: (r: Parameters<VerificationGatewayClient['reportSettlement']>[0]) => Promise<unknown>;
5709
+ /** Create your order once paid. */
5710
+ fulfil: (ctx: {
5711
+ session: CheckoutSession;
5712
+ result: VerificationResult;
5713
+ }) => Promise<{
5714
+ id: string;
5715
+ permalink_url?: string;
5716
+ }>;
5717
+ /** Merchant key for ap2.merchant_authorization (when ap2Mandates). */
5718
+ signingKey?: {
5719
+ privateKey: KeyLike | KeyObject;
5720
+ kid: string;
5721
+ };
5722
+ /** Resolve an AP2 mandate signer key by kid (default: the platform profile keys). */
5723
+ mandateKey?: (kid: string | undefined, session: CheckoutSession) => Promise<JWK | null>;
5724
+ store?: CheckoutStore;
5725
+ idempotencyStore?: IdempotencyStore;
5726
+ /** Require RFC 9421 signatures on platform requests. Default false. */
5727
+ requireSignedRequests?: boolean;
5728
+ /** Where to send a buyer when nothing better exists (continue_url). */
5729
+ fallbackContinueUrl?: string;
5730
+ /** Profile fetch override (tests). */
5731
+ fetchProfile?: (url: string, fresh: boolean) => Promise<UcpProfile | UcpDiscoveryError>;
5732
+ }
5733
+ declare function createUcpCheckoutKit(opts: UcpCheckoutKitOptions): {
5734
+ handle: (req: Request) => Promise<Response>;
5735
+ profile: UcpProfile;
5736
+ profileHandler: () => Response;
5737
+ };
5738
+
5739
+ /** RFC 8785-style canonical JSON (sorted keys, no whitespace). */
5740
+ declare function canonicalJson(value: unknown): string;
5741
+
5742
+ /**
5743
+ * 5.15.0 — x402 v2 (x402 Foundation, specs/transports-v2/http.md) helpers for
5744
+ * a MERCHANT. The merchant's own facilitator verifies and settles; AstraSync
5745
+ * never facilitates or touches the funds. All protocol data travels in
5746
+ * headers as standard base64 JSON:
5747
+ * PAYMENT-REQUIRED (server → client, with HTTP 402) PaymentRequired
5748
+ * PAYMENT-SIGNATURE (client → server) PaymentPayload
5749
+ * PAYMENT-RESPONSE (server → client) SettlementResponse
5750
+ */
5751
+ interface X402ResourceInfo {
5752
+ url: string;
5753
+ description?: string;
5754
+ mimeType?: string;
5755
+ /** ≤ 32 characters. */
5756
+ serviceName?: string;
5757
+ /** ≤ 5 entries. */
5758
+ tags?: string[];
5759
+ iconUrl?: string;
5760
+ }
5761
+ interface X402PaymentRequirements {
5762
+ scheme: string;
5763
+ /** CAIP-2, e.g. `eip155:8453`. */
5764
+ network: string;
5765
+ /** Atomic token units, as a string. */
5766
+ amount: string;
5767
+ /** Token contract address, or ISO 4217 code for fiat. */
5768
+ asset: string;
5769
+ payTo: string;
5770
+ maxTimeoutSeconds: number;
5771
+ extra?: Record<string, unknown>;
5772
+ }
5773
+ interface X402PaymentRequired {
5774
+ x402Version: 2;
5775
+ error?: string;
5776
+ resource: X402ResourceInfo;
5777
+ accepts: X402PaymentRequirements[];
5778
+ extensions?: Record<string, {
5779
+ info: unknown;
5780
+ schema?: unknown;
5781
+ }>;
5782
+ }
5783
+ interface X402PaymentPayload {
5784
+ x402Version: number;
5785
+ resource?: X402ResourceInfo;
5786
+ accepted: X402PaymentRequirements;
5787
+ payload: Record<string, unknown>;
5788
+ extensions?: Record<string, unknown>;
5789
+ }
5790
+ interface X402SettlementResponse {
5791
+ success: boolean;
5792
+ errorReason?: string;
5793
+ payer?: string;
5794
+ /** Empty string when settlement failed. */
5795
+ transaction: string;
5796
+ network: string;
5797
+ amount?: string;
5798
+ extensions?: Record<string, unknown>;
5799
+ }
5800
+ /** A 402 answer: status, the PAYMENT-REQUIRED header, and an empty JSON body. */
5801
+ declare function buildX402Challenge(input: Omit<X402PaymentRequired, 'x402Version'>): {
5802
+ status: 402;
5803
+ headers: Record<string, string>;
5804
+ body: Record<string, never>;
5805
+ };
5806
+ /** Decode the client's PAYMENT-SIGNATURE header (null when absent/malformed). */
5807
+ declare function parseX402Payment(header: string | null | undefined): X402PaymentPayload | null;
5808
+ /** Decode a PAYMENT-REQUIRED header (agent side / tests). */
5809
+ declare function parseX402Challenge(header: string | null | undefined): X402PaymentRequired | null;
5810
+ /** The PAYMENT-RESPONSE header value for your facilitator's settlement result. */
5811
+ declare function encodeX402SettlementResponse(r: X402SettlementResponse): string;
5812
+ /**
5813
+ * The chosen requirement must be one you offered (scheme, network, asset,
5814
+ * payTo, amount) — check before handing the payload to your facilitator.
5815
+ */
5816
+ declare function x402PaymentMatchesOffer(payment: X402PaymentPayload, offered: X402PaymentRequirements[]): boolean;
5817
+
5818
+ interface MppChallenge {
5819
+ id: string;
5820
+ realm: string;
5821
+ /** Lowercase ASCII, e.g. `stripe`, `tempo`. */
5822
+ method: string;
5823
+ /** e.g. `charge`, `session`, `subscription`. */
5824
+ intent: string;
5825
+ /** base64url (no padding) of the method request JSON. */
5826
+ request: string;
5827
+ expires?: string;
5828
+ digest?: string;
5829
+ description?: string;
5830
+ opaque?: string;
5831
+ header?: 'Payment-Authorization';
5832
+ }
5833
+ interface MppCredential {
5834
+ challenge: MppChallenge;
5835
+ source?: string;
5836
+ payload: Record<string, unknown>;
5837
+ }
5838
+ interface MppReceipt {
5839
+ status: 'success';
5840
+ method: string;
5841
+ timestamp: string;
5842
+ reference: string;
5843
+ }
5844
+ /**
5845
+ * One `WWW-Authenticate: Payment …` value. Offer several methods by sending
5846
+ * one header per method. `request` is the method's request object
5847
+ * (e.g. stripe: `{ amount: '5000', currency: 'usd', … }`).
5848
+ */
5849
+ declare function buildMppChallenge(input: Omit<MppChallenge, 'id' | 'request'> & {
5850
+ request: Record<string, unknown>;
5851
+ }, hmacSecret: string): {
5852
+ challenge: MppChallenge;
5853
+ header: string;
5854
+ };
5855
+ /** Decode `Authorization: Payment <…>` (or Payment-Authorization). */
5856
+ declare function parseMppCredential(header: string | null | undefined): MppCredential | null;
5857
+ /** True when the echoed challenge is one this server issued (and isn't expired). */
5858
+ declare function verifyMppChallenge(challenge: MppChallenge, hmacSecret: string, now?: Date): boolean;
5859
+ /** The decoded method request from a challenge. */
5860
+ declare function decodeMppRequest(challenge: MppChallenge): Record<string, unknown> | null;
5861
+ /** `Payment-Receipt` header value — 2xx responses only. */
5862
+ declare function encodeMppReceipt(r: MppReceipt): string;
5863
+
5864
+ /**
5865
+ * 5.15.0 — KYAPay token verification for a seller
5866
+ * (draft-skyfire-oauth-kyapay-token; header `KYAPay-Token`, comma-separated
5867
+ * JWTs). AstraSync's use is IDENTITY: by default only `kya+jwt` tokens are
5868
+ * accepted. `pay+jwt` / `kya-pay+jwt` carry payment value (settled by the
5869
+ * issuer, never AstraSync) and are refused unless you opt in.
5870
+ *
5871
+ * Validation per the draft: signature by the issuer's key (`kid`, JWKS at
5872
+ * `{iss}/.well-known/jwks.json`), `iss`, `exp`/`iat` with 30 s skew, `jti` a
5873
+ * UUID, `aud` = you, `env` when configured; `alg: none` refused. Issuer
5874
+ * values differ between Skyfire's docs and examples, so `issuer` is
5875
+ * configuration (production `https://app.skyfire.xyz` per docs.skyfire.xyz).
5876
+ * When the token carries `cnf`, the request must also be RFC 9421-signed by
5877
+ * that key — returned as `requiresSignatureKey` for the caller to enforce.
5878
+ */
5879
+
5880
+ type KyaPayTokenType = 'kya+jwt' | 'pay+jwt' | 'kya-pay+jwt';
5881
+ interface KyaPayVerifyOptions {
5882
+ issuer: string;
5883
+ /** Your seller id (the token's `aud`). */
5884
+ audience: string;
5885
+ /** Defaults to `${issuer}/.well-known/jwks.json`. */
5886
+ jwksUrl?: string;
5887
+ /** Pinned issuer keys instead of fetching the JWKS. */
5888
+ keys?: JWK[];
5889
+ /** Default ['kya+jwt'] — identity only. */
5890
+ acceptTypes?: KyaPayTokenType[];
5891
+ env?: 'production' | 'sandbox';
5892
+ clockToleranceSec?: number;
5893
+ }
5894
+ interface KyaPayIdentity {
5895
+ type: KyaPayTokenType;
5896
+ jti: string;
5897
+ subject: string;
5898
+ /** Human identity (`hid`): email + any verified names. Treat as PII. */
5899
+ human?: Record<string, unknown>;
5900
+ /** Agent platform (`apd`). */
5901
+ platform?: Record<string, unknown>;
5902
+ /** Agent (`aid`). */
5903
+ agent?: Record<string, unknown>;
5904
+ /** The key the request must be RFC 9421-signed with (`cnf.jwk`), if any. */
5905
+ requiresSignatureKey?: JWK;
5906
+ claims: JWTPayload;
5907
+ }
5908
+ type KyaPayResult = {
5909
+ ok: true;
5910
+ tokens: KyaPayIdentity[];
5911
+ } | {
5912
+ ok: false;
5913
+ error: string;
5914
+ };
5915
+ declare function verifyKyaPayTokens(header: string | null | undefined, opts: KyaPayVerifyOptions): Promise<KyaPayResult>;
5916
+
5917
+ /**
5918
+ * 5.15.0 — A-Comm Evidence Protocol (AEP) v1.0.3-rc.2 core
5919
+ * (github.com/A-Comm-Tech/a-comm-evidence-protocol, spec section 4).
5920
+ *
5921
+ * AEP is an evidence layer beside the transaction ("parallel to the
5922
+ * transaction, never gating it"): a sequential, tamper-evident hash chain of
5923
+ * typed artifacts, each signed Ed25519 by the implementing party. This module
5924
+ * is the byte-level core, verified against the published conformance vectors:
5925
+ *
5926
+ * - Section 4.1 canonical JSON: RFC 8785 (JCS) + NFC normalization of member names
5927
+ * and string values; member names sorted by UTF-16 code unit at every
5928
+ * level; numbers MUST be integers.
5929
+ * - current_hash = "sha256:" + hex(SHA-256(canonical(hash_input))), where the
5930
+ * hash input is exactly {actor_id, actor_type, artifact_type,
5931
+ * interaction_channel, metadata, payload, previous_hash, timestamp};
5932
+ * previous_hash is inside it (null for genesis).
5933
+ * - Section 4.3 server_signature = Ed25519 over the RAW 32 digest bytes (base64).
5934
+ * - timestamps are RFC 3339 UTC 'Z', whole seconds.
5935
+ */
5936
+
5937
+ declare const AEP_SPEC_VERSION = "aep-1.0.3-rc.2";
5938
+ type AepArtifactType = 'discovery' | 'referral' | 'intent' | 'delegation' | 'policy' | 'cart' | 'authorization' | 'fulfillment' | 'refund';
5939
+ type AepActorType = 'user' | 'agent' | 'merchant' | 'psp' | 'fulfillment_provider' | 'credentials_provider' | 'identity_verifier';
5940
+ interface AepHashInput {
5941
+ actor_id: string;
5942
+ actor_type: AepActorType;
5943
+ artifact_type: AepArtifactType;
5944
+ interaction_channel: 'voice' | 'text_chat' | 'voice_and_text' | null;
5945
+ metadata: Record<string, unknown> | null;
5946
+ payload: Record<string, unknown>;
5947
+ previous_hash: string | null;
5948
+ timestamp: string;
5949
+ }
5950
+ /** AEP section 4.1 canonical JSON (JCS + NFC + UTF-16 key order + integer-only numbers). */
5951
+ declare function aepCanonicalJson(value: unknown): string;
5952
+ /** "sha256:<64 lowercase hex>" of a hash input (or any canonicalizable value). */
5953
+ declare function aepHash(input: AepHashInput | unknown): string;
5954
+ /** AEP timestamp: RFC 3339 UTC 'Z', whole seconds. */
5955
+ declare function aepTimestamp(d?: Date): string;
5956
+ /** An Ed25519 private key from a 32-byte seed (base64). */
5957
+ declare function aepPrivateKeyFromSeed(seedBase64: string): KeyObject;
5958
+ /** An Ed25519 public key from its raw 32 bytes (base64). */
5959
+ declare function aepPublicKeyFromBase64(raw: string): KeyObject;
5960
+ /** The raw 32-byte public key (base64) of an Ed25519 key. */
5961
+ declare function aepRawPublicKey(key: KeyObject): string;
5962
+ /** Section 4.3: Ed25519 over the RAW 32 digest bytes; base64. */
5963
+ declare function aepSign(currentHash: string, privateKey: KeyObject): string;
5964
+ declare function aepVerifySignature(currentHash: string, signature: string, publicKey: KeyObject): boolean;
5965
+ interface AepArtifactRecord {
5966
+ sequence_number: number;
5967
+ artifact_type: AepArtifactType;
5968
+ hash_input: AepHashInput;
5969
+ current_hash: string;
5970
+ server_signature: string;
5971
+ }
5972
+ interface AepChainVerification {
5973
+ ok: boolean;
5974
+ /** The first failing artifact's sequence number and why. */
5975
+ failure?: {
5976
+ sequence_number: number;
5977
+ reason: string;
5978
+ };
5979
+ /** current_hash of the authorization artifact (the seal, section 2.5), if present. */
5980
+ sealedHash?: string;
5981
+ }
5982
+ /** Section 4.3 verification steps for every artifact, in order. */
5983
+ declare function verifyAepChain(records: AepArtifactRecord[], publicKey: KeyObject): AepChainVerification;
5984
+ interface AepChainOptions {
5985
+ privateKey: KeyObject;
5986
+ /** Your published key id (signing_key_id at chain level). */
5987
+ keyId: string;
5988
+ merchantId: string;
5989
+ chainId?: string;
5990
+ /** Section 2.7 HMAC-SHA256 of your session token with a per-merchant salt. */
5991
+ sessionIdHash?: string;
5992
+ /** Extra hash-input metadata on every artifact (protocol, sdk_version…). */
5993
+ metadata?: Record<string, unknown>;
5994
+ }
5995
+ /**
5996
+ * An AEP chain for one transaction. Append artifacts in order; each gets
5997
+ * previous_hash, current_hash and server_signature. After the
5998
+ * authorization artifact (the seal) only fulfillment / refund may follow.
5999
+ */
6000
+ declare class AepChain {
6001
+ private opts;
6002
+ readonly records: AepArtifactRecord[];
6003
+ readonly chainId: string;
6004
+ private sealed;
6005
+ constructor(opts: AepChainOptions);
6006
+ append(a: {
6007
+ artifact_type: AepArtifactType;
6008
+ actor_type: AepActorType;
6009
+ actor_id: string;
6010
+ interaction_channel?: AepHashInput['interaction_channel'];
6011
+ payload: Record<string, unknown>;
6012
+ timestamp?: string;
6013
+ }): AepArtifactRecord;
6014
+ /** Chain-level fields (section 2.7) + records, for export. */
6015
+ toBundle(): {
6016
+ artifacts: AepArtifactRecord[];
6017
+ session_id_hash?: string | undefined;
6018
+ chain_id: string;
6019
+ merchant_id: string;
6020
+ spec_version: string;
6021
+ signing_key_id: string;
6022
+ };
6023
+ }
6024
+ /**
6025
+ * The document to serve at /.well-known/aep-public-key (section 4.3: "tagged with a
6026
+ * key_id"; keep a replaced key ≥ 90 days; list revocations). AEP rc.2 fixes
6027
+ * no field names for it — this shape is AstraSync's.
6028
+ */
6029
+ declare function aepPublicKeyDocument(keys: Array<{
6030
+ keyId: string;
6031
+ publicKey: KeyObject;
6032
+ notBefore?: string;
6033
+ notAfter?: string;
6034
+ }>, revocations?: Array<{
6035
+ keyId: string;
6036
+ revokedAt: string;
6037
+ }>): {
6038
+ spec_version: string;
6039
+ keys: {
6040
+ not_after?: string | undefined;
6041
+ not_before?: string | undefined;
6042
+ key_id: string;
6043
+ alg: string;
6044
+ public_key_base64: string;
6045
+ }[];
6046
+ revocations: {
6047
+ key_id: string;
6048
+ revoked_at: string;
6049
+ }[];
6050
+ };
6051
+
6052
+ declare const ACP_API_VERSION = "2026-04-17";
6053
+ type AcpStatus = 'not_ready_for_payment' | 'ready_for_payment' | 'pending_approval' | 'complete_in_progress' | 'completed' | 'canceled';
6054
+ interface AcpMessage {
6055
+ type: 'error' | 'info' | 'warning';
6056
+ code?: string;
6057
+ content: string;
6058
+ severity?: 'info' | 'low' | 'medium' | 'high' | 'critical';
6059
+ resolution?: 'recoverable' | 'requires_buyer_input' | 'requires_buyer_review';
6060
+ param?: string | null;
6061
+ }
6062
+ interface AcpCheckoutSession {
6063
+ id: string;
6064
+ status: AcpStatus;
6065
+ currency: string;
6066
+ line_items: Array<{
6067
+ id: string;
6068
+ item: {
6069
+ id: string;
6070
+ name: string;
6071
+ unit_amount: number;
6072
+ };
6073
+ quantity: number;
6074
+ name: string;
6075
+ unit_amount: number;
6076
+ totals: Array<{
6077
+ type: string;
6078
+ amount: number;
6079
+ }>;
6080
+ }>;
6081
+ totals: Array<{
6082
+ type: string;
6083
+ amount: number;
6084
+ }>;
6085
+ messages: AcpMessage[];
6086
+ continue_url?: string;
6087
+ order?: Record<string, unknown>;
6088
+ _caller?: string;
6089
+ _astraCheckoutSessionId?: string;
6090
+ }
6091
+ interface AcpCheckoutKitOptions {
6092
+ currency: string;
6093
+ /** Payment handlers you accept (endpoint paymentHandlers), e.g. ['ai.astrasync.voucher']. */
6094
+ paymentHandlers: string[];
6095
+ catalog: (itemId: string) => Promise<CatalogItem | null>;
6096
+ verifyPurchase: (ctx: {
6097
+ session: AcpCheckoutSession;
6098
+ /** Pass as `checkoutSessionId` to AstraSync (the platform's cart id when sent). */
6099
+ checkoutSessionId: string;
6100
+ astraId?: string;
6101
+ attemptId?: string;
6102
+ valueMajor: number;
6103
+ }) => Promise<VerificationResult>;
6104
+ settle: (ctx: {
6105
+ session: AcpCheckoutSession;
6106
+ result: VerificationResult;
6107
+ paymentData?: Record<string, unknown>;
6108
+ }) => Promise<SettleResult>;
6109
+ reportSettlement?: (r: Parameters<VerificationGatewayClient['reportSettlement']>[0]) => Promise<unknown>;
6110
+ fulfil: (ctx: {
6111
+ session: AcpCheckoutSession;
6112
+ result: VerificationResult;
6113
+ }) => Promise<{
6114
+ id: string;
6115
+ permalink_url?: string;
6116
+ }>;
6117
+ /** Base path the kit is mounted at (default ''). */
6118
+ basePath?: string;
6119
+ store?: {
6120
+ get(id: string): Promise<AcpCheckoutSession | null>;
6121
+ put(s: AcpCheckoutSession): Promise<void>;
6122
+ };
6123
+ idempotencyStore?: IdempotencyStore;
6124
+ fallbackContinueUrl?: string;
6125
+ }
6126
+ declare function createAcpCheckoutKit(opts: AcpCheckoutKitOptions): {
6127
+ handle: (req: Request) => Promise<Response>;
6128
+ };
6129
+
6130
+ interface IssueDelegateOptions {
6131
+ /** The mandate object (e.g. `{ vct: 'mandate.checkout.1', … }`). */
6132
+ mandate: Record<string, unknown>;
6133
+ /** Top-level mandate fields to make selectively disclosable (e.g. ['checkout_jwt']). */
6134
+ sdFields?: string[];
6135
+ privateKey: KeyLike;
6136
+ kid: string;
6137
+ alg?: 'ES256' | 'ES384';
6138
+ /** Header `typ`. AP2 leaves the root's unspecified; omitted by default. */
6139
+ typ?: string;
6140
+ /** Extra signed claims on the token (KB hops: iat / aud / nonce / sd_hash). */
6141
+ claims?: Record<string, unknown>;
6142
+ }
6143
+ /** Sign a delegate SD-JWT; returns `jwt~disclosure~…~`. */
6144
+ declare function issueDelegateSdJwt(opts: IssueDelegateOptions): Promise<string>;
6145
+ type RootKeyResolver = (kid: string | undefined, header: Record<string, unknown>) => Promise<JWK | null>;
6146
+ interface VerifiedChain {
6147
+ /** Mandates of the LAST hop (what was finally authorised). */
6148
+ mandates: Record<string, unknown>[];
6149
+ /** Mandates of every hop, root first. */
6150
+ hops: Array<{
6151
+ header: Record<string, unknown>;
6152
+ payload: Record<string, unknown>;
6153
+ mandates: Record<string, unknown>[];
6154
+ }>;
6155
+ }
6156
+ /**
6157
+ * Verify an AP2 delegate chain: the root against `resolveRootKey(kid)`, each
6158
+ * KB hop against the previous hop's `cnf.jwk` with its `sd_hash` /
6159
+ * `issuer_jwt_hash` binding; terminal hops carry no `cnf`.
6160
+ */
6161
+ declare function verifyDelegateChain(chain: string, resolveRootKey: RootKeyResolver, opts?: {
6162
+ expectedAud?: string;
6163
+ expectedNonce?: string;
6164
+ }): Promise<VerifiedChain>;
6165
+
6166
+ declare const AP2_VCT: {
6167
+ readonly checkout: "mandate.checkout.1";
6168
+ readonly checkoutOpen: "mandate.checkout.open.1";
6169
+ readonly payment: "mandate.payment.1";
6170
+ readonly paymentOpen: "mandate.payment.open.1";
6171
+ };
6172
+ interface Ap2Party {
6173
+ id: string;
6174
+ name?: string;
6175
+ website?: string;
6176
+ }
6177
+ /** b64url(SHA-256(ascii(checkout_jwt))) — also the payment mandate's transaction_id. */
6178
+ declare function checkoutHash(checkoutJwt: string): string;
6179
+ declare function closedCheckoutMandate(checkoutJwt: string, ttlSec?: number, now?: number): {
6180
+ vct: "mandate.checkout.1";
6181
+ checkout_jwt: string;
6182
+ checkout_hash: string;
6183
+ iat: number;
6184
+ exp: number;
6185
+ };
6186
+ declare function closedPaymentMandate(input: {
6187
+ transactionId: string;
6188
+ payee: Ap2Party;
6189
+ amountMinor: number;
6190
+ currency: string;
6191
+ instrument: {
6192
+ id: string;
6193
+ type: string;
6194
+ description?: string;
6195
+ };
6196
+ ttlSec?: number;
6197
+ }, now?: number): {
6198
+ vct: "mandate.payment.1";
6199
+ transaction_id: string;
6200
+ payee: Ap2Party;
6201
+ payment_amount: {
6202
+ amount: number;
6203
+ currency: string;
6204
+ };
6205
+ payment_instrument: {
6206
+ id: string;
6207
+ type: string;
6208
+ description?: string;
6209
+ };
6210
+ iat: number;
6211
+ exp: number;
6212
+ };
6213
+ declare function openCheckoutMandate(input: {
6214
+ agentJwk: JWK;
6215
+ merchants: Ap2Party[];
6216
+ lineItems: Array<{
6217
+ id: string;
6218
+ acceptableItems: Array<{
6219
+ id: string;
6220
+ title?: string;
6221
+ }>;
6222
+ quantity: number;
6223
+ }>;
6224
+ ttlSec?: number;
6225
+ }, now?: number): {
6226
+ vct: "mandate.checkout.open.1";
6227
+ constraints: ({
6228
+ type: string;
6229
+ items: {
6230
+ id: string;
6231
+ acceptable_items: {
6232
+ id: string;
6233
+ title?: string;
6234
+ }[];
6235
+ quantity: number;
6236
+ }[];
6237
+ allowed?: undefined;
6238
+ } | {
6239
+ type: string;
6240
+ allowed: Ap2Party[];
6241
+ items?: undefined;
6242
+ })[];
6243
+ cnf: {
6244
+ jwk: JWK;
6245
+ };
6246
+ iat: number;
6247
+ exp: number;
6248
+ };
6249
+ declare function openPaymentMandate(input: {
6250
+ agentJwk: JWK;
6251
+ payees: Ap2Party[];
6252
+ currency: string;
6253
+ maxMinor: number;
6254
+ /** Digest binding this to the open checkout mandate (payment.reference). */
6255
+ conditionalTransactionId: string;
6256
+ ttlSec?: number;
6257
+ }, now?: number): {
6258
+ vct: "mandate.payment.open.1";
6259
+ constraints: ({
6260
+ type: string;
6261
+ currency: string;
6262
+ max: number;
6263
+ min: number;
6264
+ allowed?: undefined;
6265
+ conditional_transaction_id?: undefined;
6266
+ } | {
6267
+ type: string;
6268
+ allowed: Ap2Party[];
6269
+ currency?: undefined;
6270
+ max?: undefined;
6271
+ min?: undefined;
6272
+ conditional_transaction_id?: undefined;
6273
+ } | {
6274
+ type: string;
6275
+ conditional_transaction_id: string;
6276
+ currency?: undefined;
6277
+ max?: undefined;
6278
+ min?: undefined;
6279
+ allowed?: undefined;
6280
+ })[];
6281
+ cnf: {
6282
+ jwk: JWK;
6283
+ };
6284
+ iat: number;
6285
+ exp: number;
6286
+ };
6287
+ /** Sign a root mandate (AstraSync as trusted agent provider). */
6288
+ declare function signRootMandate(mandate: Record<string, unknown>, key: {
6289
+ privateKey: KeyLike;
6290
+ kid: string;
6291
+ }): Promise<string>;
6292
+ /**
6293
+ * The digest of a root mandate's delegate disclosure — used as the open
6294
+ * payment mandate's `payment.reference.conditional_transaction_id`.
6295
+ */
6296
+ declare function rootMandateDigest(rootToken: string): string;
6297
+ /**
6298
+ * Agent side: close an open mandate with a KB hop signed by the agent key in
6299
+ * its `cnf` (terminal: the closed mandate carries no cnf).
6300
+ */
6301
+ declare function createKbHop(prevToken: string, closedMandate: Record<string, unknown>, agentKey: {
6302
+ privateKey: KeyLike;
6303
+ kid?: string;
6304
+ }, aud: string, nonce?: string): Promise<string>;
6305
+ interface VerifyAp2Options {
6306
+ /** Resolve the root signer's key (e.g. AstraSync's JWKS by kid). */
6307
+ resolveRootKey: RootKeyResolver;
6308
+ /** The vct you expect in the final hop. */
6309
+ expectedVct: string;
6310
+ /** For closed checkout mandates: the checkout JWT you signed. */
6311
+ checkoutJwt?: string;
6312
+ /** For closed payment mandates: the checkout hash it must reference. */
6313
+ transactionId?: string;
6314
+ expectedAud?: string;
6315
+ expectedNonce?: string;
6316
+ now?: number;
6317
+ }
6318
+ type Ap2VerifyResult = {
6319
+ ok: true;
6320
+ mandate: Record<string, unknown>;
6321
+ chainLength: number;
6322
+ } | {
6323
+ ok: false;
6324
+ code: 'mandate_invalid_signature' | 'mandate_expired' | 'mandate_scope_mismatch';
6325
+ error: string;
6326
+ };
6327
+ /** Verify an AP2 mandate (root or chain) end to end. */
6328
+ declare function verifyAp2Mandate(token: string, opts: VerifyAp2Options): Promise<Ap2VerifyResult>;
6329
+
6330
+ /**
6331
+ * 5.15.0 — RFC 9421 HTTP Message Signatures: signing.
6332
+ *
6333
+ * Signs an outbound request (agent → merchant, platform → merchant webhook)
6334
+ * with an ES256 or Ed25519 private key. Covered components default to
6335
+ * `@method`, `@authority`, `@path` (+ `content-digest` when there's a body,
6336
+ * computed per RFC 9530). Protocol profiles (Web Bot Auth, Visa TAP,
6337
+ * Mastercard Agent Pay, UCP) pass their own `components`, `tag` and
6338
+ * parameters. Verification is transport/rfc9421-verify.
6339
+ */
6340
+
6341
+ type HttpSignatureAlgorithm = 'ecdsa-p256-sha256' | 'ed25519';
6342
+ interface SignHttpRequestOptions {
6343
+ /** Private key (Node KeyObject / PEM). */
6344
+ privateKey: KeyObject | string;
6345
+ keyId: string;
6346
+ alg?: HttpSignatureAlgorithm;
6347
+ /** Covered components. Default @method @authority @path (+ content-digest with a body). */
6348
+ components?: string[];
6349
+ /** Signature label. Default `sig1`. */
6350
+ label?: string;
6351
+ /** `tag` parameter (profile name, e.g. a Web Bot Auth or TAP tag). */
6352
+ tag?: string;
6353
+ /** `nonce` parameter: a value, or true for 32 random bytes (base64url). */
6354
+ nonce?: string | true;
6355
+ /** Lifetime in seconds (expires = created + this). Default 300. */
6356
+ expiresInSec?: number;
6357
+ /** Include the `alg` parameter. Default false (key type implies it). */
6358
+ includeAlg?: boolean;
6359
+ /** Include `expires`. Default true (UCP: keyid only, created optional). */
6360
+ includeExpires?: boolean;
6361
+ now?: () => Date;
6362
+ }
6363
+ interface SignableRequest {
6364
+ method: string;
6365
+ url: string;
6366
+ headers: Record<string, string>;
6367
+ body?: string;
6368
+ }
6369
+ /** RFC 9530 Content-Digest (sha-256) of a body. */
6370
+ declare function contentDigest(body: string): string;
6371
+ /**
6372
+ * Returns the request's headers plus `Signature-Input`, `Signature` (and
6373
+ * `Content-Digest` when a body is covered). Never mutates the input.
6374
+ */
6375
+ declare function signHttpRequest(req: SignableRequest, opts: SignHttpRequestOptions): Promise<Record<string, string>>;
5057
6376
 
5058
- export { AgentClient, type AgentCredentials, type AgentProtocol, type AgentRecord, AstraSync, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, KYDRequiredError, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, type MerchantSettlementToken, type ModelConfig, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RouteAccessConfig, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, type SettlementRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, _resetEdgeConfigCache, index as agent, authorizeSettlement, awaitStepUpApproval, buildGuidance, buildSdkObservedMetadata, buildVerificationUnavailableBody, clearCache, createMcpMiddleware, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, isEdgeConfig, isRejectedIdentityClaim, isVerificationUnavailable, isVerifiedHopValidFor, matchEdgePathRule, matchPlatformSignature, nextjs, normalizeDeclaredSource, parseYaml as parseLocalPolicyYaml, parseVerifiedHop, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, sanitizeHeaders, sdk, sdkFetch, serializeVerifiedHop, setMcpMeta, index$1 as transport, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify };
6377
+ export { ACP_API_VERSION, AEP_SPEC_VERSION, AP2_VCT, type AcpCheckoutKitOptions, type AcpCheckoutSession, type AepActorType, type AepArtifactRecord, type AepArtifactType, AepChain, type AepChainOptions, type AepChainVerification, type AepHashInput, AgentClient, type AgentCredentials, type AgentProtocol, type AgentProtocolIdentities, type AgentRecord, type Ap2Party, type Ap2VerifyResult, AstraSync, type AstraSyncAepEvidence, type AstraSyncConfig, type AstraSyncCredentials, AstraSyncError, type AstraSyncMandates, type AttemptOutcome, type AttemptReport, AuthenticationError, type BuildGuidanceParams, CAPTURE_SCHEMA_VERSION, type CallerMetadata, ChallengeHandler, type CommerceArtifactsPayload, type CommerceContext, type CommercePipelineInput, type CommerceShieldProps, type ConsiderationItem, type ConsiderationSet, type CounterpartyType, DECLARED_SOURCE_MAX, DEFAULT_EDGE_CONFIG, DEFAULT_IDEMPOTENCY_TTL_MS, type DynamicPlatformFingerprint, type EdgeConfig, type EdgeMode, type EdgePathRule, type EdgeVerificationDepth, type EnhancedVerificationResult, type ExpressMiddlewareOptions, type FetchEdgeConfigResult, type FetchEdgeConfigSuccess, type FiatSettlementBinding, type FrameworkConfig, type FulfilmentInfo, type GatewayConfig, type GuidanceEnvelope, type GuidanceInfo, type HealthResponse, type HttpSignatureAlgorithm, type IdempotencyOptions, type IdempotencyRecord, type IdempotencyStore, KYDRequiredError, type KyaPayIdentity, type KyaPayResult, type KyaPayTokenType, type KyaPayVerifyOptions, type ParseResult as LocalPolicyParseResult, type ValidationError as LocalPolicyValidationError, type ValidationResult as LocalPolicyValidationResult, MAX_HEADERS, MAX_HEADER_VALUE_BYTES, MAX_TOTAL_BYTES, MCP_VERIFIED_HOP_HEADER, MCP_VERIFIED_HOP_MAX_AGE_MS, type McpMiddlewareOptions, MemoryCheckoutStore, MemoryIdempotencyStore, type MerchantSettlementToken, type ModelConfig, type MppChallenge, type MppCredential, type MppReceipt, type NegotiationResult, type NextJsMiddlewareOptions, type ObservedMetadata, type PDLSSConfig$1 as PDLSSConfig, type PDLSSDuration, type PDLSSInfo, type PDLSSLimits, type PDLSSPurpose, type PDLSSScope, type PDLSSSelfInstantiation, PLATFORM_AGENT_SIGNATURES, type PendingRegistrationResponse, type PlatformAgentVendor, type PlatformDetectionInput, type PlatformFingerprint, type PlatformSignatureDef, type PollRegistrationResult, type ProtocolTransport, RUNTIME_SIGNATURES, RedisIdempotencyStore, type RedisLike, type RegisterOptions, type RegisterResult, RegistrationDeniedError, RegistrationExpiredError, type RegistrationResponse, RegistrationTimeoutError, type ReportAttemptOptions, type RootKeyResolver, type RouteAccessConfig, type RoutePolicy, type RuntimeChallengeResult, type RuntimeSignature, type SDKOptions, SDK_USER_AGENT, type SanitizeHeadersResult, type SettlementArtifact, type SettlementArtifactBinding, type SettlementArtifactBindingBase, type SettlementDecision, type SettlementOutcomeInfo, SettlementReportError, type SettlementRequest, type SignHttpRequestOptions, type SignableRequest, type StablecoinSettlementBinding, type StepUpApprovalInfo, type StepUpApprovalStatus, type StepUpOutcome, TRUST_LEVEL_RANGES, type TokenGuidance, type ToolGate, type ToolGateConfig, type TrustLevel, UCP_VERSION, type UcpAgentBinding, type CatalogItem as UcpCatalogItem, type UcpCheckoutKitOptions, type CheckoutSession as UcpCheckoutSession, type CheckoutStore as UcpCheckoutStore, type UcpMessage, type UcpProfile, type UcpProfileResult, type SettleResult as UcpSettleResult, type UcpSeverity, type UcpSignatureResult, VERIFICATION_STATUS_HEADER, SDK_VERSION as VERSION, type VerificationInterstitialProps, type VerificationRequest, type VerificationResult, type VerifiedAgent, type VerifiedDeveloper, type VerifiedHopMarker, type VerifiedOrganization, type VerifyAp2Options, type VerifyOptions, type VerifyResponse, type WaitForApprovalOptions, type WellKnownAgenticCommerce, type X402PaymentPayload, type X402PaymentRequired, type X402PaymentRequirements, type X402ResourceInfo, type X402SettlementResponse, _resetEdgeConfigCache, aepCanonicalJson, aepHash, aepPrivateKeyFromSeed, aepPublicKeyDocument, aepPublicKeyFromBase64, aepRawPublicKey, aepSign, aepTimestamp, aepVerifySignature, index as agent, astrasyncPaymentHandlers, authorizeSettlement, awaitStepUpApproval, beginIdempotent, buildGuidance, buildMppChallenge, buildSdkObservedMetadata, buildUcpProfile, buildVerificationUnavailableBody, buildX402Challenge, canonicalJson, checkUcpAgentBinding, checkoutHash, clearCache, closedCheckoutMandate, closedPaymentMandate, contentDigest, createAcpCheckoutKit, createKbHop, createMcpMiddleware, createUcpCheckoutKit, decodeMppRequest, degradeToObserve, denyStatusFor, deriveConnectionFromHeaders, detectPlatformFingerprint, detectRuntime, encodeMppReceipt, encodeX402SettlementResponse, express, extractApiKeyFormat, extractCredentials, extractMcpCredentials, extractPlatformHeaders, fetchEdgeConfig, fetchRoutes, fetchUcpProfile, finishIdempotent, getCachedWellKnownUrls, getEdgeConfig, getTrustLevel, getWellKnownUrls, hasCredentials, idempotencyMiddleware, isEdgeConfig, isRejectedIdentityClaim, isRetryableSettlementError, isSpecialUseIp, isVerificationUnavailable, isVerifiedHopValidFor, issueDelegateSdJwt, matchEdgePathRule, matchPlatformSignature, matchRoutePattern, negotiateUcp, nextjs, normalizeDeclaredSource, openCheckoutMandate, openPaymentMandate, parseYaml as parseLocalPolicyYaml, parseMppCredential, parseUcpAgentHeader, parseVerifiedHop, parseX402Challenge, parseX402Payment, pollStepUpStatus, prefetchWellKnown, quickVerify, recordDecision, reportAttempt, reportUnregisteredAttempt, requestFingerprint, rootMandateDigest, routePatternToRegExp, routePolicyOf, sanitizeHeaders, sdk, sdkFetch, sendUcpWebhook, serializeVerifiedHop, setMcpMeta, signHttpRequest, signRootMandate, signUcpRequest, signUcpResponse, index$1 as transport, ucpError, ucpEscalation, ucpFailure, ucpProfileHandler, ucpRequiredComponents, unavailableRetryAfterSeconds, validatePolicy as validateLocalPolicy, verify, verifyAepChain, verifyAp2Mandate, verifyDelegateChain, verifyKyaPayTokens, verifyMppChallenge, verifyUcpRequest, withIdempotency, x402PaymentMatchesOffer };