@agent-score/commerce 2.3.0 → 2.5.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 +6 -6
- package/dist/challenge/index.d.mts +9 -5
- package/dist/challenge/index.d.ts +9 -5
- package/dist/challenge/index.js +11 -4
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +11 -4
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-ChyOi7aU.d.ts → checkout-McfNpZJf.d.ts} +80 -12
- package/dist/{checkout-Ceo1_rVJ.d.mts → checkout-o17dIxHi.d.mts} +80 -12
- package/dist/core.d.mts +27 -7
- package/dist/core.d.ts +27 -7
- package/dist/core.js +25 -11
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +25 -11
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +26 -10
- package/dist/discovery/index.d.ts +26 -10
- package/dist/discovery/index.js +58 -10
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +58 -10
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/gate-CWP10xPQ.d.mts +339 -0
- package/dist/gate-CWP10xPQ.d.ts +339 -0
- package/dist/identity/express.d.mts +26 -1
- package/dist/identity/express.d.ts +26 -1
- package/dist/identity/express.js +599 -25
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +595 -24
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +12 -2
- package/dist/identity/fastify.d.ts +12 -2
- package/dist/identity/fastify.js +607 -25
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +603 -24
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +26 -1
- package/dist/identity/hono.d.ts +26 -1
- package/dist/identity/hono.js +588 -25
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +584 -24
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +3 -0
- package/dist/identity/nextjs.d.ts +3 -0
- package/dist/identity/nextjs.js +593 -25
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +589 -24
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +24 -1
- package/dist/identity/web.d.ts +24 -1
- package/dist/identity/web.js +593 -25
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +589 -24
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +129 -14
- package/dist/index.d.ts +129 -14
- package/dist/index.js +978 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +956 -99
- package/dist/index.mjs.map +1 -1
- package/dist/{default_rails-DtR_E9N9.d.ts → network_kind-BIJM2peR.d.ts} +22 -8
- package/dist/{default_rails-K25PtWrL.d.mts → network_kind-C0EMkdzz.d.mts} +22 -8
- package/dist/payment/index.d.mts +16 -26
- package/dist/payment/index.d.ts +16 -26
- package/dist/payment/index.js +62 -57
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +62 -57
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{pricing-B3-aKxSz.d.ts → pricing-CytRwhC2.d.ts} +1 -1
- package/dist/{pricing-BReyZiqN.d.mts → pricing-KHDqMLd7.d.mts} +1 -1
- package/dist/{rail_spec-B1239jPp.d.mts → rail_spec-BFZmW9RN.d.mts} +3 -4
- package/dist/{rail_spec-B1239jPp.d.ts → rail_spec-BFZmW9RN.d.ts} +3 -4
- package/dist/stripe-multichain/index.d.mts +2 -9
- package/dist/stripe-multichain/index.d.ts +2 -9
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/{wwwauthenticate-D_FMnPgU.d.mts → wwwauthenticate-CVaGUMjU.d.mts} +8 -6
- package/dist/{wwwauthenticate-D_FMnPgU.d.ts → wwwauthenticate-CVaGUMjU.d.ts} +8 -6
- package/package.json +14 -13
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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
|
|
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';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.mjs';
|
|
7
|
-
import { H as HeadersLike } from './
|
|
8
|
-
export { c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, l as loadSolanaFeePayer } from './
|
|
9
|
-
import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-
|
|
10
|
-
export { c as TempoSessionRailSpec } from './rail_spec-
|
|
7
|
+
import { H as HeadersLike } from './network_kind-C0EMkdzz.mjs';
|
|
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
|
+
import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-BFZmW9RN.mjs';
|
|
10
|
+
export { c as TempoSessionRailSpec } from './rail_spec-BFZmW9RN.mjs';
|
|
11
11
|
import { Context } from 'hono';
|
|
12
|
-
import './
|
|
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';
|
|
14
|
+
import { JWK } from 'jose';
|
|
15
|
+
import './pricing-KHDqMLd7.mjs';
|
|
13
16
|
import './x402_server-Ciz2mls2.mjs';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -163,7 +166,7 @@ declare function verificationAgentInstructions({ userAction, retryStep, extraSte
|
|
|
163
166
|
* status: 403,
|
|
164
167
|
* body: buildVerificationRequiredBody(reason, {
|
|
165
168
|
* message: 'Identity verification is required to call this endpoint.',
|
|
166
|
-
* agentInstructions: VERIFICATION_AGENT_INSTRUCTIONS,
|
|
169
|
+
* agentInstructions: JSON.stringify(VERIFICATION_AGENT_INSTRUCTIONS),
|
|
167
170
|
* }),
|
|
168
171
|
* };
|
|
169
172
|
* }
|
|
@@ -599,9 +602,8 @@ declare function extractOwnerScope(input: Request | HeadersLike): OwnerScope;
|
|
|
599
602
|
* Cross-module typed errors.
|
|
600
603
|
*
|
|
601
604
|
* Lives in its own module so `payment/` and `stripe-multichain/` helpers can
|
|
602
|
-
* throw `CheckoutValidationError` without importing from `checkout.ts
|
|
603
|
-
*
|
|
604
|
-
* node it sidesteps tsup's per-entry class duplication.)
|
|
605
|
+
* throw `CheckoutValidationError` without importing from `checkout.ts` — this
|
|
606
|
+
* also sidesteps tsup's per-entry class duplication.
|
|
605
607
|
*
|
|
606
608
|
* Re-exported from `checkout.ts` and the top-level entry to preserve the
|
|
607
609
|
* public import path.
|
|
@@ -866,8 +868,8 @@ interface ComputeFirstHandler {
|
|
|
866
868
|
declare function computeFirstCheckout(opts: ComputeFirstOptions): ComputeFirstHandler;
|
|
867
869
|
|
|
868
870
|
/** Factory for the standard `onDenied` callback shape used by Checkout's
|
|
869
|
-
* gate config. Replaces the
|
|
870
|
-
*
|
|
871
|
+
* gate config. Replaces the denial-mapping switch a merchant would otherwise
|
|
872
|
+
* hand-write.
|
|
871
873
|
*
|
|
872
874
|
* The shape is framework-neutral (`{status, body, headers?}`) — matches
|
|
873
875
|
* `Checkout`'s `onDenied` signature directly. For per-framework gate
|
|
@@ -928,4 +930,117 @@ declare function createDefaultOnDenied(opts: CreateDefaultOnDeniedOptions): (rea
|
|
|
928
930
|
*/
|
|
929
931
|
declare function defaultReadOnlyOnDenied(reason: DenialReason): DefaultOnDeniedResult;
|
|
930
932
|
|
|
931
|
-
|
|
933
|
+
/**
|
|
934
|
+
* RFC 9421 HTTP Message Signatures — the AIP-constrained subset.
|
|
935
|
+
*
|
|
936
|
+
* AIP (Agentic Identity Protocol) binds an Agent Identity Token (AIT) to the
|
|
937
|
+
* agent that presents it: the agent signs each HTTP request with the private key whose
|
|
938
|
+
* public half is carried in the AIT's `cnf.jwk` (RFC 7800). A verifier reconstructs the
|
|
939
|
+
* RFC 9421 signature base, verifies it against `cnf.jwk`, and confirms the signature's
|
|
940
|
+
* `keyid` equals the JWK thumbprint (RFC 7638) of that key. A stolen AIT is then useless
|
|
941
|
+
* without the bound private key.
|
|
942
|
+
*
|
|
943
|
+
* This module implements ONLY the shape AIP uses, not the full RFC 9421 grammar:
|
|
944
|
+
*
|
|
945
|
+
* - Covered components: the derived components `@method`, `@authority`, `@path`, plus the
|
|
946
|
+
* `agent-identity` header field. (The AIP "minimum required" set.) Extra components in a
|
|
947
|
+
* presented signature are accepted and covered if the caller supplies their values.
|
|
948
|
+
* - One labeled signature per request, tagged `tag="agent-identity"`. Web Bot Auth
|
|
949
|
+
* signatures (`tag="web-bot-auth"`) may coexist on the same request under a different
|
|
950
|
+
* label; we select ours by tag, ignoring the rest.
|
|
951
|
+
* - Algorithm: Ed25519 (EdDSA over OKP/Ed25519). AIP's default and only signing curve.
|
|
952
|
+
*
|
|
953
|
+
* The structured-field parsing here is deliberately narrow: it parses the AIP member of the
|
|
954
|
+
* `Signature-Input` / `Signature` dictionaries (a parenthesized inner list + integer/string
|
|
955
|
+
* params, and a single byte-sequence value). It is not a general RFC 8941 parser.
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
/** The AIP "minimum required" covered components, in canonical order. */
|
|
959
|
+
declare const AIP_COVERED_COMPONENTS: readonly ["@method", "@authority", "@path", "agent-identity"];
|
|
960
|
+
/** Tag that identifies the AIP signature among coexisting RFC 9421 signatures. */
|
|
961
|
+
declare const AIP_SIGNATURE_TAG = "agent-identity";
|
|
962
|
+
/** Parameters parsed from (or used to build) a `Signature-Input` member. */
|
|
963
|
+
interface SignatureParams {
|
|
964
|
+
components: string[];
|
|
965
|
+
created?: number;
|
|
966
|
+
expires?: number;
|
|
967
|
+
keyid?: string;
|
|
968
|
+
tag?: string;
|
|
969
|
+
alg?: string;
|
|
970
|
+
}
|
|
971
|
+
interface VerifyMessageSignatureInput {
|
|
972
|
+
/** HTTP method, e.g. `POST`. Case-insensitive; normalized to upper. */
|
|
973
|
+
method: string;
|
|
974
|
+
/** Authority (host[:port]), e.g. `wine-merchant.com`. Lowercased; default ports dropped. */
|
|
975
|
+
authority: string;
|
|
976
|
+
/** Request path (no query), e.g. `/checkout`. */
|
|
977
|
+
path: string;
|
|
978
|
+
/** Raw value of the `Agent-Identity` header the signature covers. */
|
|
979
|
+
agentIdentity: string;
|
|
980
|
+
/** Raw `Signature-Input` header value. */
|
|
981
|
+
signatureInput: string;
|
|
982
|
+
/** Raw `Signature` header value. */
|
|
983
|
+
signature: string;
|
|
984
|
+
/** The agent's public key from the AIT's `cnf.jwk`. */
|
|
985
|
+
cnfJwk: JWK;
|
|
986
|
+
/** Wall-clock seconds; defaults to now. Injectable for tests. */
|
|
987
|
+
now?: number;
|
|
988
|
+
/** Skew tolerance for created/expires. Defaults to {@link DEFAULT_MAX_SKEW_SECONDS}. */
|
|
989
|
+
maxSkewSeconds?: number;
|
|
990
|
+
/** Extra covered-component values, keyed by component name (for components beyond the AIP minimum). */
|
|
991
|
+
extraComponents?: Record<string, string>;
|
|
992
|
+
}
|
|
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';
|
|
994
|
+
type VerifyMessageSignatureResult = {
|
|
995
|
+
ok: true;
|
|
996
|
+
params: SignatureParams;
|
|
997
|
+
} | {
|
|
998
|
+
ok: false;
|
|
999
|
+
reason: VerifyFailureReason;
|
|
1000
|
+
};
|
|
1001
|
+
/**
|
|
1002
|
+
* Verify an AIP HTTP Message Signature. Performs the full check:
|
|
1003
|
+
* 1. select the AIP-tagged member of `Signature-Input`
|
|
1004
|
+
* 2. confirm the AIP minimum covered components are present
|
|
1005
|
+
* 3. enforce `created`/`expires` against `now` with skew tolerance
|
|
1006
|
+
* 4. confirm `keyid` equals the RFC 7638 thumbprint of `cnf.jwk`
|
|
1007
|
+
* 5. reconstruct the signature base and verify Ed25519 over it
|
|
1008
|
+
*/
|
|
1009
|
+
declare const verifyMessageSignature: (input: VerifyMessageSignatureInput) => Promise<VerifyMessageSignatureResult>;
|
|
1010
|
+
interface SignMessageInput {
|
|
1011
|
+
method: string;
|
|
1012
|
+
authority: string;
|
|
1013
|
+
path: string;
|
|
1014
|
+
agentIdentity: string;
|
|
1015
|
+
/** Agent private key (Ed25519 JWK with `d`). */
|
|
1016
|
+
privateJwk: JWK;
|
|
1017
|
+
/** Agent public key; used to derive `keyid` (thumbprint). */
|
|
1018
|
+
publicJwk: JWK;
|
|
1019
|
+
created?: number;
|
|
1020
|
+
expires?: number;
|
|
1021
|
+
/** Signature dictionary label. Defaults to `ait`. */
|
|
1022
|
+
label?: string;
|
|
1023
|
+
components?: string[];
|
|
1024
|
+
extraComponents?: Record<string, string>;
|
|
1025
|
+
}
|
|
1026
|
+
/** Build the `Signature-Input` and `Signature` header values for an AIP request. */
|
|
1027
|
+
declare const signMessage: (input: SignMessageInput) => Promise<{
|
|
1028
|
+
signatureInput: string;
|
|
1029
|
+
signature: string;
|
|
1030
|
+
}>;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Build an AIP {@link VerifyRequestContext} from a standard WHATWG `Request`.
|
|
1034
|
+
*
|
|
1035
|
+
* Every framework adapter ultimately has (or can produce) a `Request`: Hono exposes
|
|
1036
|
+
* `c.req.raw`, Next.js / Web Fetch hand you one directly, and Express/Fastify can be shimmed.
|
|
1037
|
+
* This helper centralizes the header + URL extraction so adapters stay thin and the parsing
|
|
1038
|
+
* rules (authority derivation, multiple `Agent-Identity` headers) live in one place.
|
|
1039
|
+
*/
|
|
1040
|
+
|
|
1041
|
+
/** Build the framework-agnostic verify context from a standard `Request`. */
|
|
1042
|
+
declare const buildVerifyContextFromRequest: (req: Request) => VerifyRequestContext;
|
|
1043
|
+
/** True when the request carries an AIP credential (at least one `Agent-Identity` header). */
|
|
1044
|
+
declare const hasAgentIdentityHeader: (req: Request) => boolean;
|
|
1045
|
+
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
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
|
|
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';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.js';
|
|
7
|
-
import { H as HeadersLike } from './
|
|
8
|
-
export { c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, l as loadSolanaFeePayer } from './
|
|
9
|
-
import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-
|
|
10
|
-
export { c as TempoSessionRailSpec } from './rail_spec-
|
|
7
|
+
import { H as HeadersLike } from './network_kind-BIJM2peR.js';
|
|
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
|
+
import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from './rail_spec-BFZmW9RN.js';
|
|
10
|
+
export { c as TempoSessionRailSpec } from './rail_spec-BFZmW9RN.js';
|
|
11
11
|
import { Context } from 'hono';
|
|
12
|
-
import './
|
|
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';
|
|
14
|
+
import { JWK } from 'jose';
|
|
15
|
+
import './pricing-CytRwhC2.js';
|
|
13
16
|
import './x402_server-Ciz2mls2.js';
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -163,7 +166,7 @@ declare function verificationAgentInstructions({ userAction, retryStep, extraSte
|
|
|
163
166
|
* status: 403,
|
|
164
167
|
* body: buildVerificationRequiredBody(reason, {
|
|
165
168
|
* message: 'Identity verification is required to call this endpoint.',
|
|
166
|
-
* agentInstructions: VERIFICATION_AGENT_INSTRUCTIONS,
|
|
169
|
+
* agentInstructions: JSON.stringify(VERIFICATION_AGENT_INSTRUCTIONS),
|
|
167
170
|
* }),
|
|
168
171
|
* };
|
|
169
172
|
* }
|
|
@@ -599,9 +602,8 @@ declare function extractOwnerScope(input: Request | HeadersLike): OwnerScope;
|
|
|
599
602
|
* Cross-module typed errors.
|
|
600
603
|
*
|
|
601
604
|
* Lives in its own module so `payment/` and `stripe-multichain/` helpers can
|
|
602
|
-
* throw `CheckoutValidationError` without importing from `checkout.ts
|
|
603
|
-
*
|
|
604
|
-
* node it sidesteps tsup's per-entry class duplication.)
|
|
605
|
+
* throw `CheckoutValidationError` without importing from `checkout.ts` — this
|
|
606
|
+
* also sidesteps tsup's per-entry class duplication.
|
|
605
607
|
*
|
|
606
608
|
* Re-exported from `checkout.ts` and the top-level entry to preserve the
|
|
607
609
|
* public import path.
|
|
@@ -866,8 +868,8 @@ interface ComputeFirstHandler {
|
|
|
866
868
|
declare function computeFirstCheckout(opts: ComputeFirstOptions): ComputeFirstHandler;
|
|
867
869
|
|
|
868
870
|
/** Factory for the standard `onDenied` callback shape used by Checkout's
|
|
869
|
-
* gate config. Replaces the
|
|
870
|
-
*
|
|
871
|
+
* gate config. Replaces the denial-mapping switch a merchant would otherwise
|
|
872
|
+
* hand-write.
|
|
871
873
|
*
|
|
872
874
|
* The shape is framework-neutral (`{status, body, headers?}`) — matches
|
|
873
875
|
* `Checkout`'s `onDenied` signature directly. For per-framework gate
|
|
@@ -928,4 +930,117 @@ declare function createDefaultOnDenied(opts: CreateDefaultOnDeniedOptions): (rea
|
|
|
928
930
|
*/
|
|
929
931
|
declare function defaultReadOnlyOnDenied(reason: DenialReason): DefaultOnDeniedResult;
|
|
930
932
|
|
|
931
|
-
|
|
933
|
+
/**
|
|
934
|
+
* RFC 9421 HTTP Message Signatures — the AIP-constrained subset.
|
|
935
|
+
*
|
|
936
|
+
* AIP (Agentic Identity Protocol) binds an Agent Identity Token (AIT) to the
|
|
937
|
+
* agent that presents it: the agent signs each HTTP request with the private key whose
|
|
938
|
+
* public half is carried in the AIT's `cnf.jwk` (RFC 7800). A verifier reconstructs the
|
|
939
|
+
* RFC 9421 signature base, verifies it against `cnf.jwk`, and confirms the signature's
|
|
940
|
+
* `keyid` equals the JWK thumbprint (RFC 7638) of that key. A stolen AIT is then useless
|
|
941
|
+
* without the bound private key.
|
|
942
|
+
*
|
|
943
|
+
* This module implements ONLY the shape AIP uses, not the full RFC 9421 grammar:
|
|
944
|
+
*
|
|
945
|
+
* - Covered components: the derived components `@method`, `@authority`, `@path`, plus the
|
|
946
|
+
* `agent-identity` header field. (The AIP "minimum required" set.) Extra components in a
|
|
947
|
+
* presented signature are accepted and covered if the caller supplies their values.
|
|
948
|
+
* - One labeled signature per request, tagged `tag="agent-identity"`. Web Bot Auth
|
|
949
|
+
* signatures (`tag="web-bot-auth"`) may coexist on the same request under a different
|
|
950
|
+
* label; we select ours by tag, ignoring the rest.
|
|
951
|
+
* - Algorithm: Ed25519 (EdDSA over OKP/Ed25519). AIP's default and only signing curve.
|
|
952
|
+
*
|
|
953
|
+
* The structured-field parsing here is deliberately narrow: it parses the AIP member of the
|
|
954
|
+
* `Signature-Input` / `Signature` dictionaries (a parenthesized inner list + integer/string
|
|
955
|
+
* params, and a single byte-sequence value). It is not a general RFC 8941 parser.
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
/** The AIP "minimum required" covered components, in canonical order. */
|
|
959
|
+
declare const AIP_COVERED_COMPONENTS: readonly ["@method", "@authority", "@path", "agent-identity"];
|
|
960
|
+
/** Tag that identifies the AIP signature among coexisting RFC 9421 signatures. */
|
|
961
|
+
declare const AIP_SIGNATURE_TAG = "agent-identity";
|
|
962
|
+
/** Parameters parsed from (or used to build) a `Signature-Input` member. */
|
|
963
|
+
interface SignatureParams {
|
|
964
|
+
components: string[];
|
|
965
|
+
created?: number;
|
|
966
|
+
expires?: number;
|
|
967
|
+
keyid?: string;
|
|
968
|
+
tag?: string;
|
|
969
|
+
alg?: string;
|
|
970
|
+
}
|
|
971
|
+
interface VerifyMessageSignatureInput {
|
|
972
|
+
/** HTTP method, e.g. `POST`. Case-insensitive; normalized to upper. */
|
|
973
|
+
method: string;
|
|
974
|
+
/** Authority (host[:port]), e.g. `wine-merchant.com`. Lowercased; default ports dropped. */
|
|
975
|
+
authority: string;
|
|
976
|
+
/** Request path (no query), e.g. `/checkout`. */
|
|
977
|
+
path: string;
|
|
978
|
+
/** Raw value of the `Agent-Identity` header the signature covers. */
|
|
979
|
+
agentIdentity: string;
|
|
980
|
+
/** Raw `Signature-Input` header value. */
|
|
981
|
+
signatureInput: string;
|
|
982
|
+
/** Raw `Signature` header value. */
|
|
983
|
+
signature: string;
|
|
984
|
+
/** The agent's public key from the AIT's `cnf.jwk`. */
|
|
985
|
+
cnfJwk: JWK;
|
|
986
|
+
/** Wall-clock seconds; defaults to now. Injectable for tests. */
|
|
987
|
+
now?: number;
|
|
988
|
+
/** Skew tolerance for created/expires. Defaults to {@link DEFAULT_MAX_SKEW_SECONDS}. */
|
|
989
|
+
maxSkewSeconds?: number;
|
|
990
|
+
/** Extra covered-component values, keyed by component name (for components beyond the AIP minimum). */
|
|
991
|
+
extraComponents?: Record<string, string>;
|
|
992
|
+
}
|
|
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';
|
|
994
|
+
type VerifyMessageSignatureResult = {
|
|
995
|
+
ok: true;
|
|
996
|
+
params: SignatureParams;
|
|
997
|
+
} | {
|
|
998
|
+
ok: false;
|
|
999
|
+
reason: VerifyFailureReason;
|
|
1000
|
+
};
|
|
1001
|
+
/**
|
|
1002
|
+
* Verify an AIP HTTP Message Signature. Performs the full check:
|
|
1003
|
+
* 1. select the AIP-tagged member of `Signature-Input`
|
|
1004
|
+
* 2. confirm the AIP minimum covered components are present
|
|
1005
|
+
* 3. enforce `created`/`expires` against `now` with skew tolerance
|
|
1006
|
+
* 4. confirm `keyid` equals the RFC 7638 thumbprint of `cnf.jwk`
|
|
1007
|
+
* 5. reconstruct the signature base and verify Ed25519 over it
|
|
1008
|
+
*/
|
|
1009
|
+
declare const verifyMessageSignature: (input: VerifyMessageSignatureInput) => Promise<VerifyMessageSignatureResult>;
|
|
1010
|
+
interface SignMessageInput {
|
|
1011
|
+
method: string;
|
|
1012
|
+
authority: string;
|
|
1013
|
+
path: string;
|
|
1014
|
+
agentIdentity: string;
|
|
1015
|
+
/** Agent private key (Ed25519 JWK with `d`). */
|
|
1016
|
+
privateJwk: JWK;
|
|
1017
|
+
/** Agent public key; used to derive `keyid` (thumbprint). */
|
|
1018
|
+
publicJwk: JWK;
|
|
1019
|
+
created?: number;
|
|
1020
|
+
expires?: number;
|
|
1021
|
+
/** Signature dictionary label. Defaults to `ait`. */
|
|
1022
|
+
label?: string;
|
|
1023
|
+
components?: string[];
|
|
1024
|
+
extraComponents?: Record<string, string>;
|
|
1025
|
+
}
|
|
1026
|
+
/** Build the `Signature-Input` and `Signature` header values for an AIP request. */
|
|
1027
|
+
declare const signMessage: (input: SignMessageInput) => Promise<{
|
|
1028
|
+
signatureInput: string;
|
|
1029
|
+
signature: string;
|
|
1030
|
+
}>;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Build an AIP {@link VerifyRequestContext} from a standard WHATWG `Request`.
|
|
1034
|
+
*
|
|
1035
|
+
* Every framework adapter ultimately has (or can produce) a `Request`: Hono exposes
|
|
1036
|
+
* `c.req.raw`, Next.js / Web Fetch hand you one directly, and Express/Fastify can be shimmed.
|
|
1037
|
+
* This helper centralizes the header + URL extraction so adapters stay thin and the parsing
|
|
1038
|
+
* rules (authority derivation, multiple `Agent-Identity` headers) live in one place.
|
|
1039
|
+
*/
|
|
1040
|
+
|
|
1041
|
+
/** Build the framework-agnostic verify context from a standard `Request`. */
|
|
1042
|
+
declare const buildVerifyContextFromRequest: (req: Request) => VerifyRequestContext;
|
|
1043
|
+
/** True when the request carries an AIP credential (at least one `Agent-Identity` header). */
|
|
1044
|
+
declare const hasAgentIdentityHeader: (req: Request) => boolean;
|
|
1045
|
+
|
|
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 };
|