@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.
- package/README.md +19 -17
- package/dist/challenge/index.d.mts +26 -2
- package/dist/challenge/index.d.ts +26 -2
- package/dist/challenge/index.js +14 -5
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +14 -5
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-McfNpZJf.d.ts → checkout-C4RD7M0Z.d.ts} +46 -13
- package/dist/{checkout-o17dIxHi.d.mts → checkout-CzB9f_jf.d.mts} +46 -13
- package/dist/core.d.mts +20 -9
- package/dist/core.d.ts +20 -9
- package/dist/core.js +35 -24
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +35 -24
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +17 -2
- package/dist/discovery/index.d.ts +17 -2
- package/dist/discovery/index.js +36 -12
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +35 -12
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/{gate-CWP10xPQ.d.mts → gate-D2RP6bZg.d.ts} +109 -141
- package/dist/{gate-CWP10xPQ.d.ts → gate-GCXy4FHI.d.mts} +109 -141
- package/dist/identity/express.d.mts +3 -1
- package/dist/identity/express.d.ts +3 -1
- package/dist/identity/express.js +164 -55
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +164 -55
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +3 -1
- package/dist/identity/fastify.d.ts +3 -1
- package/dist/identity/fastify.js +171 -57
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +171 -57
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +3 -1
- package/dist/identity/hono.d.ts +3 -1
- package/dist/identity/hono.js +159 -59
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +159 -59
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +3 -1
- package/dist/identity/nextjs.d.ts +3 -1
- package/dist/identity/nextjs.js +153 -56
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +153 -56
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.d.mts +21 -2
- package/dist/identity/policy.d.ts +21 -2
- package/dist/identity/policy.js +22 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +21 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +3 -1
- package/dist/identity/web.d.ts +3 -1
- package/dist/identity/web.js +153 -56
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +153 -56
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +55 -10
- package/dist/index.d.ts +55 -10
- package/dist/index.js +2211 -500
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2203 -500
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +1 -1
- package/dist/payment/index.d.ts +1 -1
- package/dist/payment/index.js +10 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +10 -2
- package/dist/payment/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +1614 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1614 -266
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/types-D1slMt0H.d.mts +137 -0
- package/dist/types-D1slMt0H.d.ts +137 -0
- package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
- package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
- 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-
|
|
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-
|
|
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 {
|
|
13
|
-
export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as
|
|
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
|
|
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.
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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 {
|
|
13
|
-
export { A as AGENTSCORE_CANONICAL_ISSUER, a as AGENT_IDENTITY_HEADER, b as
|
|
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
|
|
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.
|
|
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
|
-
|
|
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 };
|