@agent-score/commerce 2.5.0 → 2.6.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 (80) hide show
  1. package/README.md +19 -17
  2. package/dist/challenge/index.d.mts +26 -2
  3. package/dist/challenge/index.d.ts +26 -2
  4. package/dist/challenge/index.js +14 -5
  5. package/dist/challenge/index.js.map +1 -1
  6. package/dist/challenge/index.mjs +14 -5
  7. package/dist/challenge/index.mjs.map +1 -1
  8. package/dist/{checkout-McfNpZJf.d.ts → checkout-C4RD7M0Z.d.ts} +46 -13
  9. package/dist/{checkout-o17dIxHi.d.mts → checkout-CzB9f_jf.d.mts} +46 -13
  10. package/dist/core.d.mts +20 -9
  11. package/dist/core.d.ts +20 -9
  12. package/dist/core.js +35 -24
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +35 -24
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/discovery/index.d.mts +17 -2
  17. package/dist/discovery/index.d.ts +17 -2
  18. package/dist/discovery/index.js +36 -12
  19. package/dist/discovery/index.js.map +1 -1
  20. package/dist/discovery/index.mjs +35 -12
  21. package/dist/discovery/index.mjs.map +1 -1
  22. package/dist/{gate-CWP10xPQ.d.mts → gate-D2RP6bZg.d.ts} +109 -141
  23. package/dist/{gate-CWP10xPQ.d.ts → gate-GCXy4FHI.d.mts} +109 -141
  24. package/dist/identity/express.d.mts +3 -1
  25. package/dist/identity/express.d.ts +3 -1
  26. package/dist/identity/express.js +164 -55
  27. package/dist/identity/express.js.map +1 -1
  28. package/dist/identity/express.mjs +164 -55
  29. package/dist/identity/express.mjs.map +1 -1
  30. package/dist/identity/fastify.d.mts +3 -1
  31. package/dist/identity/fastify.d.ts +3 -1
  32. package/dist/identity/fastify.js +171 -57
  33. package/dist/identity/fastify.js.map +1 -1
  34. package/dist/identity/fastify.mjs +171 -57
  35. package/dist/identity/fastify.mjs.map +1 -1
  36. package/dist/identity/hono.d.mts +3 -1
  37. package/dist/identity/hono.d.ts +3 -1
  38. package/dist/identity/hono.js +159 -59
  39. package/dist/identity/hono.js.map +1 -1
  40. package/dist/identity/hono.mjs +159 -59
  41. package/dist/identity/hono.mjs.map +1 -1
  42. package/dist/identity/nextjs.d.mts +3 -1
  43. package/dist/identity/nextjs.d.ts +3 -1
  44. package/dist/identity/nextjs.js +153 -56
  45. package/dist/identity/nextjs.js.map +1 -1
  46. package/dist/identity/nextjs.mjs +153 -56
  47. package/dist/identity/nextjs.mjs.map +1 -1
  48. package/dist/identity/policy.d.mts +21 -2
  49. package/dist/identity/policy.d.ts +21 -2
  50. package/dist/identity/policy.js +22 -1
  51. package/dist/identity/policy.js.map +1 -1
  52. package/dist/identity/policy.mjs +21 -1
  53. package/dist/identity/policy.mjs.map +1 -1
  54. package/dist/identity/web.d.mts +3 -1
  55. package/dist/identity/web.d.ts +3 -1
  56. package/dist/identity/web.js +153 -56
  57. package/dist/identity/web.js.map +1 -1
  58. package/dist/identity/web.mjs +153 -56
  59. package/dist/identity/web.mjs.map +1 -1
  60. package/dist/index.d.mts +55 -10
  61. package/dist/index.d.ts +55 -10
  62. package/dist/index.js +2211 -500
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +2203 -500
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/payment/index.d.mts +1 -1
  67. package/dist/payment/index.d.ts +1 -1
  68. package/dist/payment/index.js +10 -2
  69. package/dist/payment/index.js.map +1 -1
  70. package/dist/payment/index.mjs +10 -2
  71. package/dist/payment/index.mjs.map +1 -1
  72. package/dist/stripe-multichain/index.js +1614 -266
  73. package/dist/stripe-multichain/index.js.map +1 -1
  74. package/dist/stripe-multichain/index.mjs +1614 -266
  75. package/dist/stripe-multichain/index.mjs.map +1 -1
  76. package/dist/types-D1slMt0H.d.mts +137 -0
  77. package/dist/types-D1slMt0H.d.ts +137 -0
  78. package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
  79. package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
  80. package/package.json +23 -18
package/dist/index.d.mts CHANGED
@@ -1,17 +1,19 @@
1
1
  import { VerifyWalletSignerResult, DenialReason } from './core.mjs';
2
2
  export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.mjs';
3
3
  export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.mjs';
4
- import { q as UCPSigningKey, n as UCPProfile } from './checkout-o17dIxHi.mjs';
5
- export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-o17dIxHi.mjs';
4
+ import { q as UCPSigningKey, n as UCPProfile } from './checkout-CzB9f_jf.mjs';
5
+ export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-CzB9f_jf.mjs';
6
6
  export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.mjs';
7
7
  import { H as HeadersLike } from './network_kind-C0EMkdzz.mjs';
8
8
  export { c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer } from './network_kind-C0EMkdzz.mjs';
9
9
  import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-BFZmW9RN.mjs';
10
10
  export { c as TempoSessionRailSpec } from './rail_spec-BFZmW9RN.mjs';
11
11
  import { Context } from 'hono';
12
- import { o as VerifyRequestContext } from './gate-CWP10xPQ.mjs';
13
- export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as AipGateOptions, c as AipGateResult, d as AitHeader, e as AitPayload, f as AitValidationResult, g as AmrValue, H as HARD_MAX_CACHE_SECONDS, I as IdentityClaim, h as IntentClaim, J as JWKS_WELL_KNOWN_PATH, i as JwksCache, j as JwksCacheOptions, k as JwksLookupResult, T as TrustLevel, V as VerifiedAit, l as VerifyAitFailure, m as VerifyAitOptions, n as VerifyAitResult, p as aipErrorCode, q as aipErrorStatus, r as buildAipErrorBody, s as canonicalizeIssuer, t as isAitShape, v as validateAitPayload, u as verifyAit, w as verifyAitRequest } from './gate-CWP10xPQ.mjs';
12
+ import { l as VerifyRequestContext } from './gate-GCXy4FHI.mjs';
13
+ export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as AipErrorRequirements, c as AipGateEvaluation, d as AipGateOptions, e as AipGateResult, H as HARD_MAX_CACHE_SECONDS, J as JWKS_WELL_KNOWN_PATH, f as JwksCache, g as JwksCacheOptions, h as JwksLookupResult, V as VerifiedAit, i as VerifyAitFailure, j as VerifyAitOptions, k as VerifyAitResult, m as aipErrorCode, n as aipErrorStatus, o as buildAipErrorBody, p as buildAipWeakAuthBody, q as canonicalizeIssuer, r as checkTrustRequirements, s as evaluateAipParts, t as evaluateAipRequest, v as verifyAit, u as verifyAitRequest } from './gate-GCXy4FHI.mjs';
14
14
  import { JWK } from 'jose';
15
+ export { A as AitHeader, a as AitPayload, b as AitValidationResult, c as AmrValue, I as IdentityClaim, d as IntentClaim, T as TrustLevel, i as isAitShape, v as validateAitPayload } from './types-D1slMt0H.mjs';
16
+ import '@agent-score/sdk';
15
17
  import './pricing-KHDqMLd7.mjs';
16
18
  import './x402_server-Ciz2mls2.mjs';
17
19
 
@@ -210,6 +212,9 @@ declare function denialReasonToBody(reason: DenialReason): Record<string, unknow
210
212
  * `capabilities.extensions[]` to detect UCP support on the agent card. Pinned
211
213
  * to the 2026-04-08 spec snapshot. */
212
214
  declare const UCP_A2A_EXTENSION_URI = "https://ucp.dev/2026-04-08/specification/reference";
215
+ /** Canonical URI for the AIP (Agentic Identity Protocol) A2A agent-card extension — points at the
216
+ * issuer-discovery well-known so a reader can resolve the protocol. */
217
+ declare const AIP_A2A_EXTENSION_URI = "https://www.agentscore.com/.well-known/agent-identity";
213
218
  /** One transport+URL combination the agent exposes. Lives in `AgentCard.additionalInterfaces[]`
214
219
  * for multi-binding agents; the PRIMARY transport+URL pair lives on `AgentCard.url` +
215
220
  * `AgentCard.preferredTransport`. */
@@ -265,6 +270,17 @@ declare function ucpA2AExtension(capabilities?: Record<string, Array<{
265
270
  }>>, options?: {
266
271
  required?: boolean;
267
272
  }): A2AAgentCardExtension;
273
+ /** Build the AIP entry for an A2A agent card's `capabilities.extensions[]`. Advertises that the
274
+ * agent accepts an Agent Identity Token (JWT) in an `Agent-Identity` header plus an RFC 9421
275
+ * proof-of-possession signature — so an agent discovering via the agent-card learns it can present
276
+ * an AIT (matching what the merchant's mpp.json / llms.txt / skill.md already advertise). Optional
277
+ * `requiredTrustLevel` / `requiredAmr` surface a gate's human-presence requirement. */
278
+ declare function aipA2AExtension(opts?: {
279
+ trustedIssuers?: string[];
280
+ requiredTrustLevel?: 'autonomous' | 'human_present' | 'human_confirmed';
281
+ requiredAmr?: string[];
282
+ required?: boolean;
283
+ }): A2AAgentCardExtension;
268
284
  /** Optional capabilities the agent supports. */
269
285
  interface A2AAgentCardCapabilities {
270
286
  extensions?: A2AAgentCardExtension[];
@@ -565,6 +581,8 @@ declare function loadUCPSigningKeyFromEnv({ envJwkVar, envKidVar, envAlgVar, def
565
581
  defaultAlg?: 'EdDSA' | 'ES256';
566
582
  }): Promise<GeneratedUCPKey>;
567
583
 
584
+ declare const normalizeAddress: (address: string) => string;
585
+
568
586
  /**
569
587
  * Operator-token hashing.
570
588
  *
@@ -589,9 +607,14 @@ type OwnerScope = {
589
607
  /**
590
608
  * Pull the canonical owner identity from request headers so caller-scoped
591
609
  * lookups never see the plaintext operator token. Reads `X-Wallet-Address` and
592
- * `X-Operator-Token`; returns the wallet address verbatim and the
610
+ * `X-Operator-Token`; returns the network-normalized wallet address and the
593
611
  * sha256 hash of the token. Either or both may be undefined.
594
612
  *
613
+ * The wallet address is normalized via `normalizeAddress` (EVM lowercased,
614
+ * Solana base58 preserved) so it matches the stored `orders.wallet_address`
615
+ * column, which persists the lowercased signer. Without normalization, a
616
+ * checksummed (EIP-55) `X-Wallet-Address` would miss its own order rows (404).
617
+ *
595
618
  * Use at owner-scoped resource queries (`GET /orders/:id`, `GET /receipts/:id`,
596
619
  * ...) so persistence + lookup agree on the hashed column shape and plaintext
597
620
  * tokens never leave the request.
@@ -959,6 +982,15 @@ declare function defaultReadOnlyOnDenied(reason: DenialReason): DefaultOnDeniedR
959
982
  declare const AIP_COVERED_COMPONENTS: readonly ["@method", "@authority", "@path", "agent-identity"];
960
983
  /** Tag that identifies the AIP signature among coexisting RFC 9421 signatures. */
961
984
  declare const AIP_SIGNATURE_TAG = "agent-identity";
985
+ /** Hard ceiling on the PoP signature's own declared lifetime (`expires - created`), in seconds.
986
+ * Requiring `created`+`expires` bounds replay to the declared window — but with no ceiling a
987
+ * malicious trusted-issuer agent could set `expires = created + (AIT lifetime)` and replay for the
988
+ * full window. Cap it tightly so every accepted PoP is short-lived. First-party `pay` signs a 60s
989
+ * window, so it passes; this only bites a signer that declares an over-long PoP. Matches the
990
+ * authoritative API verifier's `MAX_POP_WINDOW_SECONDS` (the AgentScore API verifier) so the
991
+ * edge (standalone `aipGate`) and the API can't drift. (Distinct from the AIT JWT's `exp - iat`
992
+ * ceiling in verify.ts — this is the HTTP-signature layer.) */
993
+ declare const MAX_POP_WINDOW_SECONDS = 120;
962
994
  /** Parameters parsed from (or used to build) a `Signature-Input` member. */
963
995
  interface SignatureParams {
964
996
  components: string[];
@@ -990,7 +1022,7 @@ interface VerifyMessageSignatureInput {
990
1022
  /** Extra covered-component values, keyed by component name (for components beyond the AIP minimum). */
991
1023
  extraComponents?: Record<string, string>;
992
1024
  }
993
- type VerifyFailureReason = 'no_aip_signature' | 'malformed_signature_input' | 'malformed_signature' | 'unsupported_alg' | 'missing_keyid' | 'keyid_mismatch' | 'missing_covered_component' | 'created_in_future' | 'expired' | 'unsupported_cnf_key' | 'signature_invalid';
1025
+ type VerifyFailureReason = 'no_aip_signature' | 'malformed_signature_input' | 'malformed_signature' | 'unsupported_alg' | 'missing_keyid' | 'keyid_mismatch' | 'missing_covered_component' | 'created_missing' | 'expires_missing' | 'pop_window_too_long' | 'created_in_future' | 'expired' | 'unsupported_cnf_key' | 'signature_invalid';
994
1026
  type VerifyMessageSignatureResult = {
995
1027
  ok: true;
996
1028
  params: SignatureParams;
@@ -1002,9 +1034,21 @@ type VerifyMessageSignatureResult = {
1002
1034
  * Verify an AIP HTTP Message Signature. Performs the full check:
1003
1035
  * 1. select the AIP-tagged member of `Signature-Input`
1004
1036
  * 2. confirm the AIP minimum covered components are present
1005
- * 3. enforce `created`/`expires` against `now` with skew tolerance
1037
+ * 3. REQUIRE both `created` and `expires`, reject an over-long declared window
1038
+ * (`expires - created` > MAX_POP_WINDOW_SECONDS → `pop_window_too_long`), then enforce them
1039
+ * against `now` with skew tolerance. Both are mandatory: an optional time bound is no time
1040
+ * bound — without `expires` a captured `(token, Signature-Input, Signature)` triple is
1041
+ * replayable for the whole AIT lifetime. A signature omitting either is rejected
1042
+ * (`created_missing` / `expires_missing`). This matches the authoritative API verifier
1043
+ * (the AgentScore API verifier) so a merchant running `aipGate` STANDALONE (the
1044
+ * crypto-identity-only deployment with no `/v1/assess`) gets the same replay defense.
1006
1045
  * 4. confirm `keyid` equals the RFC 7638 thumbprint of `cnf.jwk`
1007
1046
  * 5. reconstruct the signature base and verify Ed25519 over it
1047
+ *
1048
+ * NOTE: this is a STATELESS verifier — it bounds the replay WINDOW but does not dedupe within it.
1049
+ * A captured triple can still be replayed until `expires` (≤ MAX_POP_WINDOW_SECONDS + skew from
1050
+ * `created`). A stateful seen-signature cache (as in the authoritative API) is out of scope for the
1051
+ * SDK edge; the tight window bound is the meaningful mitigation here.
1008
1052
  */
1009
1053
  declare const verifyMessageSignature: (input: VerifyMessageSignatureInput) => Promise<VerifyMessageSignatureResult>;
1010
1054
  interface SignMessageInput {
@@ -1038,9 +1082,10 @@ declare const signMessage: (input: SignMessageInput) => Promise<{
1038
1082
  * rules (authority derivation, multiple `Agent-Identity` headers) live in one place.
1039
1083
  */
1040
1084
 
1041
- /** Build the framework-agnostic verify context from a standard `Request`. */
1042
- declare const buildVerifyContextFromRequest: (req: Request) => VerifyRequestContext;
1085
+ /** Build the framework-agnostic verify context from a standard `Request`. A configured
1086
+ * `authority` pin (e.g. `AipGateOptions.authority`) wins over the inbound `Host` header. */
1087
+ declare const buildVerifyContextFromRequest: (req: Request, authority?: string) => VerifyRequestContext;
1043
1088
  /** True when the request carries an AIP credential (at least one `Agent-Identity` header). */
1044
1089
  declare const hasAgentIdentityHeader: (req: Request) => boolean;
1045
1090
 
1046
- export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, A2A_DEFAULT_TRANSPORT, A2A_PROTOCOL_VERSION, AIP_COVERED_COMPONENTS, AIP_SIGNATURE_TAG, type CachedQuote, CheckoutValidationError, type ComputeFirstHandler, type ComputeFirstMintContext, type ComputeFirstMppContext, type ComputeFirstOptions, type ComputeFirstRails, type ComputeFirstSettledContext, type ComputeFirstWorkContext, type CreateDefaultOnDeniedOptions, type DefaultOnDeniedResult, DenialReason, FIXABLE_DENIAL_REASONS, type GeneratedUCPKey, type JWKSResponse, type MintedRecipients, type OwnerScope, type QuoteCache, type QuoteCacheOptions, type SignMessageInput, type SignedUCPProfile, SolanaMppRailSpec, StripeRailSpec, type SuccessBodyArgs, TempoRailSpec, UCPProfile, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type VerifyFailureReason, type VerifyMessageSignatureInput, type VerifyMessageSignatureResult, VerifyRequestContext, VerifyWalletSignerResult, type WorkOutcome, X402BaseRailSpec, buildA2AAgentCard, buildContactSupportNextSteps, buildJWKSResponse, buildSignerMismatchBody, buildVerificationRequiredBody, buildVerifyContextFromRequest, computeFirstCheckout, createDefaultOnDenied, createQuoteCache, defaultReadOnlyOnDenied, denialReasonStatus, denialReasonToBody, extractOwnerScope, generateUCPSigningKey, hasAgentIdentityHeader, hashOperatorToken, isFixableDenial, loadUCPSigningKeyFromEnv, signMessage, signUCPProfile, ucpA2AExtension, verificationAgentInstructions, verifyMessageSignature, verifyUCPProfile };
1091
+ export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, A2A_DEFAULT_TRANSPORT, A2A_PROTOCOL_VERSION, AIP_A2A_EXTENSION_URI, AIP_COVERED_COMPONENTS, AIP_SIGNATURE_TAG, type CachedQuote, CheckoutValidationError, type ComputeFirstHandler, type ComputeFirstMintContext, type ComputeFirstMppContext, type ComputeFirstOptions, type ComputeFirstRails, type ComputeFirstSettledContext, type ComputeFirstWorkContext, type CreateDefaultOnDeniedOptions, type DefaultOnDeniedResult, DenialReason, FIXABLE_DENIAL_REASONS, type GeneratedUCPKey, type JWKSResponse, MAX_POP_WINDOW_SECONDS, type MintedRecipients, type OwnerScope, type QuoteCache, type QuoteCacheOptions, type SignMessageInput, type SignedUCPProfile, SolanaMppRailSpec, StripeRailSpec, type SuccessBodyArgs, TempoRailSpec, UCPProfile, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type VerifyFailureReason, type VerifyMessageSignatureInput, type VerifyMessageSignatureResult, VerifyRequestContext, VerifyWalletSignerResult, type WorkOutcome, X402BaseRailSpec, aipA2AExtension, buildA2AAgentCard, buildContactSupportNextSteps, buildJWKSResponse, buildSignerMismatchBody, buildVerificationRequiredBody, buildVerifyContextFromRequest, computeFirstCheckout, createDefaultOnDenied, createQuoteCache, defaultReadOnlyOnDenied, denialReasonStatus, denialReasonToBody, extractOwnerScope, generateUCPSigningKey, hasAgentIdentityHeader, hashOperatorToken, isFixableDenial, loadUCPSigningKeyFromEnv, normalizeAddress, signMessage, signUCPProfile, ucpA2AExtension, verificationAgentInstructions, verifyMessageSignature, verifyUCPProfile };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  import { VerifyWalletSignerResult, DenialReason } from './core.js';
2
2
  export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.js';
3
3
  export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.js';
4
- import { q as UCPSigningKey, n as UCPProfile } from './checkout-McfNpZJf.js';
5
- export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-McfNpZJf.js';
4
+ import { q as UCPSigningKey, n as UCPProfile } from './checkout-C4RD7M0Z.js';
5
+ export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-C4RD7M0Z.js';
6
6
  export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.js';
7
7
  import { H as HeadersLike } from './network_kind-BIJM2peR.js';
8
8
  export { c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer } from './network_kind-BIJM2peR.js';
9
9
  import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-BFZmW9RN.js';
10
10
  export { c as TempoSessionRailSpec } from './rail_spec-BFZmW9RN.js';
11
11
  import { Context } from 'hono';
12
- import { o as VerifyRequestContext } from './gate-CWP10xPQ.js';
13
- export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as AipGateOptions, c as AipGateResult, d as AitHeader, e as AitPayload, f as AitValidationResult, g as AmrValue, H as HARD_MAX_CACHE_SECONDS, I as IdentityClaim, h as IntentClaim, J as JWKS_WELL_KNOWN_PATH, i as JwksCache, j as JwksCacheOptions, k as JwksLookupResult, T as TrustLevel, V as VerifiedAit, l as VerifyAitFailure, m as VerifyAitOptions, n as VerifyAitResult, p as aipErrorCode, q as aipErrorStatus, r as buildAipErrorBody, s as canonicalizeIssuer, t as isAitShape, v as validateAitPayload, u as verifyAit, w as verifyAitRequest } from './gate-CWP10xPQ.js';
12
+ import { l as VerifyRequestContext } from './gate-D2RP6bZg.js';
13
+ export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as AipErrorRequirements, c as AipGateEvaluation, d as AipGateOptions, e as AipGateResult, H as HARD_MAX_CACHE_SECONDS, J as JWKS_WELL_KNOWN_PATH, f as JwksCache, g as JwksCacheOptions, h as JwksLookupResult, V as VerifiedAit, i as VerifyAitFailure, j as VerifyAitOptions, k as VerifyAitResult, m as aipErrorCode, n as aipErrorStatus, o as buildAipErrorBody, p as buildAipWeakAuthBody, q as canonicalizeIssuer, r as checkTrustRequirements, s as evaluateAipParts, t as evaluateAipRequest, v as verifyAit, u as verifyAitRequest } from './gate-D2RP6bZg.js';
14
14
  import { JWK } from 'jose';
15
+ export { A as AitHeader, a as AitPayload, b as AitValidationResult, c as AmrValue, I as IdentityClaim, d as IntentClaim, T as TrustLevel, i as isAitShape, v as validateAitPayload } from './types-D1slMt0H.js';
16
+ import '@agent-score/sdk';
15
17
  import './pricing-CytRwhC2.js';
16
18
  import './x402_server-Ciz2mls2.js';
17
19
 
@@ -210,6 +212,9 @@ declare function denialReasonToBody(reason: DenialReason): Record<string, unknow
210
212
  * `capabilities.extensions[]` to detect UCP support on the agent card. Pinned
211
213
  * to the 2026-04-08 spec snapshot. */
212
214
  declare const UCP_A2A_EXTENSION_URI = "https://ucp.dev/2026-04-08/specification/reference";
215
+ /** Canonical URI for the AIP (Agentic Identity Protocol) A2A agent-card extension — points at the
216
+ * issuer-discovery well-known so a reader can resolve the protocol. */
217
+ declare const AIP_A2A_EXTENSION_URI = "https://www.agentscore.com/.well-known/agent-identity";
213
218
  /** One transport+URL combination the agent exposes. Lives in `AgentCard.additionalInterfaces[]`
214
219
  * for multi-binding agents; the PRIMARY transport+URL pair lives on `AgentCard.url` +
215
220
  * `AgentCard.preferredTransport`. */
@@ -265,6 +270,17 @@ declare function ucpA2AExtension(capabilities?: Record<string, Array<{
265
270
  }>>, options?: {
266
271
  required?: boolean;
267
272
  }): A2AAgentCardExtension;
273
+ /** Build the AIP entry for an A2A agent card's `capabilities.extensions[]`. Advertises that the
274
+ * agent accepts an Agent Identity Token (JWT) in an `Agent-Identity` header plus an RFC 9421
275
+ * proof-of-possession signature — so an agent discovering via the agent-card learns it can present
276
+ * an AIT (matching what the merchant's mpp.json / llms.txt / skill.md already advertise). Optional
277
+ * `requiredTrustLevel` / `requiredAmr` surface a gate's human-presence requirement. */
278
+ declare function aipA2AExtension(opts?: {
279
+ trustedIssuers?: string[];
280
+ requiredTrustLevel?: 'autonomous' | 'human_present' | 'human_confirmed';
281
+ requiredAmr?: string[];
282
+ required?: boolean;
283
+ }): A2AAgentCardExtension;
268
284
  /** Optional capabilities the agent supports. */
269
285
  interface A2AAgentCardCapabilities {
270
286
  extensions?: A2AAgentCardExtension[];
@@ -565,6 +581,8 @@ declare function loadUCPSigningKeyFromEnv({ envJwkVar, envKidVar, envAlgVar, def
565
581
  defaultAlg?: 'EdDSA' | 'ES256';
566
582
  }): Promise<GeneratedUCPKey>;
567
583
 
584
+ declare const normalizeAddress: (address: string) => string;
585
+
568
586
  /**
569
587
  * Operator-token hashing.
570
588
  *
@@ -589,9 +607,14 @@ type OwnerScope = {
589
607
  /**
590
608
  * Pull the canonical owner identity from request headers so caller-scoped
591
609
  * lookups never see the plaintext operator token. Reads `X-Wallet-Address` and
592
- * `X-Operator-Token`; returns the wallet address verbatim and the
610
+ * `X-Operator-Token`; returns the network-normalized wallet address and the
593
611
  * sha256 hash of the token. Either or both may be undefined.
594
612
  *
613
+ * The wallet address is normalized via `normalizeAddress` (EVM lowercased,
614
+ * Solana base58 preserved) so it matches the stored `orders.wallet_address`
615
+ * column, which persists the lowercased signer. Without normalization, a
616
+ * checksummed (EIP-55) `X-Wallet-Address` would miss its own order rows (404).
617
+ *
595
618
  * Use at owner-scoped resource queries (`GET /orders/:id`, `GET /receipts/:id`,
596
619
  * ...) so persistence + lookup agree on the hashed column shape and plaintext
597
620
  * tokens never leave the request.
@@ -959,6 +982,15 @@ declare function defaultReadOnlyOnDenied(reason: DenialReason): DefaultOnDeniedR
959
982
  declare const AIP_COVERED_COMPONENTS: readonly ["@method", "@authority", "@path", "agent-identity"];
960
983
  /** Tag that identifies the AIP signature among coexisting RFC 9421 signatures. */
961
984
  declare const AIP_SIGNATURE_TAG = "agent-identity";
985
+ /** Hard ceiling on the PoP signature's own declared lifetime (`expires - created`), in seconds.
986
+ * Requiring `created`+`expires` bounds replay to the declared window — but with no ceiling a
987
+ * malicious trusted-issuer agent could set `expires = created + (AIT lifetime)` and replay for the
988
+ * full window. Cap it tightly so every accepted PoP is short-lived. First-party `pay` signs a 60s
989
+ * window, so it passes; this only bites a signer that declares an over-long PoP. Matches the
990
+ * authoritative API verifier's `MAX_POP_WINDOW_SECONDS` (the AgentScore API verifier) so the
991
+ * edge (standalone `aipGate`) and the API can't drift. (Distinct from the AIT JWT's `exp - iat`
992
+ * ceiling in verify.ts — this is the HTTP-signature layer.) */
993
+ declare const MAX_POP_WINDOW_SECONDS = 120;
962
994
  /** Parameters parsed from (or used to build) a `Signature-Input` member. */
963
995
  interface SignatureParams {
964
996
  components: string[];
@@ -990,7 +1022,7 @@ interface VerifyMessageSignatureInput {
990
1022
  /** Extra covered-component values, keyed by component name (for components beyond the AIP minimum). */
991
1023
  extraComponents?: Record<string, string>;
992
1024
  }
993
- type VerifyFailureReason = 'no_aip_signature' | 'malformed_signature_input' | 'malformed_signature' | 'unsupported_alg' | 'missing_keyid' | 'keyid_mismatch' | 'missing_covered_component' | 'created_in_future' | 'expired' | 'unsupported_cnf_key' | 'signature_invalid';
1025
+ type VerifyFailureReason = 'no_aip_signature' | 'malformed_signature_input' | 'malformed_signature' | 'unsupported_alg' | 'missing_keyid' | 'keyid_mismatch' | 'missing_covered_component' | 'created_missing' | 'expires_missing' | 'pop_window_too_long' | 'created_in_future' | 'expired' | 'unsupported_cnf_key' | 'signature_invalid';
994
1026
  type VerifyMessageSignatureResult = {
995
1027
  ok: true;
996
1028
  params: SignatureParams;
@@ -1002,9 +1034,21 @@ type VerifyMessageSignatureResult = {
1002
1034
  * Verify an AIP HTTP Message Signature. Performs the full check:
1003
1035
  * 1. select the AIP-tagged member of `Signature-Input`
1004
1036
  * 2. confirm the AIP minimum covered components are present
1005
- * 3. enforce `created`/`expires` against `now` with skew tolerance
1037
+ * 3. REQUIRE both `created` and `expires`, reject an over-long declared window
1038
+ * (`expires - created` > MAX_POP_WINDOW_SECONDS → `pop_window_too_long`), then enforce them
1039
+ * against `now` with skew tolerance. Both are mandatory: an optional time bound is no time
1040
+ * bound — without `expires` a captured `(token, Signature-Input, Signature)` triple is
1041
+ * replayable for the whole AIT lifetime. A signature omitting either is rejected
1042
+ * (`created_missing` / `expires_missing`). This matches the authoritative API verifier
1043
+ * (the AgentScore API verifier) so a merchant running `aipGate` STANDALONE (the
1044
+ * crypto-identity-only deployment with no `/v1/assess`) gets the same replay defense.
1006
1045
  * 4. confirm `keyid` equals the RFC 7638 thumbprint of `cnf.jwk`
1007
1046
  * 5. reconstruct the signature base and verify Ed25519 over it
1047
+ *
1048
+ * NOTE: this is a STATELESS verifier — it bounds the replay WINDOW but does not dedupe within it.
1049
+ * A captured triple can still be replayed until `expires` (≤ MAX_POP_WINDOW_SECONDS + skew from
1050
+ * `created`). A stateful seen-signature cache (as in the authoritative API) is out of scope for the
1051
+ * SDK edge; the tight window bound is the meaningful mitigation here.
1008
1052
  */
1009
1053
  declare const verifyMessageSignature: (input: VerifyMessageSignatureInput) => Promise<VerifyMessageSignatureResult>;
1010
1054
  interface SignMessageInput {
@@ -1038,9 +1082,10 @@ declare const signMessage: (input: SignMessageInput) => Promise<{
1038
1082
  * rules (authority derivation, multiple `Agent-Identity` headers) live in one place.
1039
1083
  */
1040
1084
 
1041
- /** Build the framework-agnostic verify context from a standard `Request`. */
1042
- declare const buildVerifyContextFromRequest: (req: Request) => VerifyRequestContext;
1085
+ /** Build the framework-agnostic verify context from a standard `Request`. A configured
1086
+ * `authority` pin (e.g. `AipGateOptions.authority`) wins over the inbound `Host` header. */
1087
+ declare const buildVerifyContextFromRequest: (req: Request, authority?: string) => VerifyRequestContext;
1043
1088
  /** True when the request carries an AIP credential (at least one `Agent-Identity` header). */
1044
1089
  declare const hasAgentIdentityHeader: (req: Request) => boolean;
1045
1090
 
1046
- export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, A2A_DEFAULT_TRANSPORT, A2A_PROTOCOL_VERSION, AIP_COVERED_COMPONENTS, AIP_SIGNATURE_TAG, type CachedQuote, CheckoutValidationError, type ComputeFirstHandler, type ComputeFirstMintContext, type ComputeFirstMppContext, type ComputeFirstOptions, type ComputeFirstRails, type ComputeFirstSettledContext, type ComputeFirstWorkContext, type CreateDefaultOnDeniedOptions, type DefaultOnDeniedResult, DenialReason, FIXABLE_DENIAL_REASONS, type GeneratedUCPKey, type JWKSResponse, type MintedRecipients, type OwnerScope, type QuoteCache, type QuoteCacheOptions, type SignMessageInput, type SignedUCPProfile, SolanaMppRailSpec, StripeRailSpec, type SuccessBodyArgs, TempoRailSpec, UCPProfile, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type VerifyFailureReason, type VerifyMessageSignatureInput, type VerifyMessageSignatureResult, VerifyRequestContext, VerifyWalletSignerResult, type WorkOutcome, X402BaseRailSpec, buildA2AAgentCard, buildContactSupportNextSteps, buildJWKSResponse, buildSignerMismatchBody, buildVerificationRequiredBody, buildVerifyContextFromRequest, computeFirstCheckout, createDefaultOnDenied, createQuoteCache, defaultReadOnlyOnDenied, denialReasonStatus, denialReasonToBody, extractOwnerScope, generateUCPSigningKey, hasAgentIdentityHeader, hashOperatorToken, isFixableDenial, loadUCPSigningKeyFromEnv, signMessage, signUCPProfile, ucpA2AExtension, verificationAgentInstructions, verifyMessageSignature, verifyUCPProfile };
1091
+ export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, A2A_DEFAULT_TRANSPORT, A2A_PROTOCOL_VERSION, AIP_A2A_EXTENSION_URI, AIP_COVERED_COMPONENTS, AIP_SIGNATURE_TAG, type CachedQuote, CheckoutValidationError, type ComputeFirstHandler, type ComputeFirstMintContext, type ComputeFirstMppContext, type ComputeFirstOptions, type ComputeFirstRails, type ComputeFirstSettledContext, type ComputeFirstWorkContext, type CreateDefaultOnDeniedOptions, type DefaultOnDeniedResult, DenialReason, FIXABLE_DENIAL_REASONS, type GeneratedUCPKey, type JWKSResponse, MAX_POP_WINDOW_SECONDS, type MintedRecipients, type OwnerScope, type QuoteCache, type QuoteCacheOptions, type SignMessageInput, type SignedUCPProfile, SolanaMppRailSpec, StripeRailSpec, type SuccessBodyArgs, TempoRailSpec, UCPProfile, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type VerifyFailureReason, type VerifyMessageSignatureInput, type VerifyMessageSignatureResult, VerifyRequestContext, VerifyWalletSignerResult, type WorkOutcome, X402BaseRailSpec, aipA2AExtension, buildA2AAgentCard, buildContactSupportNextSteps, buildJWKSResponse, buildSignerMismatchBody, buildVerificationRequiredBody, buildVerifyContextFromRequest, computeFirstCheckout, createDefaultOnDenied, createQuoteCache, defaultReadOnlyOnDenied, denialReasonStatus, denialReasonToBody, extractOwnerScope, generateUCPSigningKey, hasAgentIdentityHeader, hashOperatorToken, isFixableDenial, loadUCPSigningKeyFromEnv, normalizeAddress, signMessage, signUCPProfile, ucpA2AExtension, verificationAgentInstructions, verifyMessageSignature, verifyUCPProfile };