@bankofai/x402-extensions 2.6.0-beta.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 +792 -0
- package/dist/cjs/bazaar/index.d.ts +3 -0
- package/dist/cjs/bazaar/index.js +629 -0
- package/dist/cjs/bazaar/index.js.map +1 -0
- package/dist/cjs/index-DPJQYYGe.d.ts +662 -0
- package/dist/cjs/index.d.ts +360 -0
- package/dist/cjs/index.js +1880 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/payment-identifier/index.d.ts +345 -0
- package/dist/cjs/payment-identifier/index.js +285 -0
- package/dist/cjs/payment-identifier/index.js.map +1 -0
- package/dist/cjs/sign-in-with-x/index.d.ts +1091 -0
- package/dist/cjs/sign-in-with-x/index.js +845 -0
- package/dist/cjs/sign-in-with-x/index.js.map +1 -0
- package/dist/esm/bazaar/index.d.mts +3 -0
- package/dist/esm/bazaar/index.mjs +33 -0
- package/dist/esm/bazaar/index.mjs.map +1 -0
- package/dist/esm/chunk-MTWK6ERV.mjs +777 -0
- package/dist/esm/chunk-MTWK6ERV.mjs.map +1 -0
- package/dist/esm/chunk-RERA4OZZ.mjs +233 -0
- package/dist/esm/chunk-RERA4OZZ.mjs.map +1 -0
- package/dist/esm/chunk-UHTNEDIJ.mjs +580 -0
- package/dist/esm/chunk-UHTNEDIJ.mjs.map +1 -0
- package/dist/esm/index-DPJQYYGe.d.mts +662 -0
- package/dist/esm/index.d.mts +360 -0
- package/dist/esm/index.mjs +323 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/payment-identifier/index.d.mts +345 -0
- package/dist/esm/payment-identifier/index.mjs +39 -0
- package/dist/esm/payment-identifier/index.mjs.map +1 -0
- package/dist/esm/sign-in-with-x/index.d.mts +1091 -0
- package/dist/esm/sign-in-with-x/index.mjs +71 -0
- package/dist/esm/sign-in-with-x/index.mjs.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/eip2612-gas-sponsoring/types.ts","../../src/eip2612-gas-sponsoring/resourceService.ts","../../src/eip2612-gas-sponsoring/facilitator.ts","../../src/erc20-approval-gas-sponsoring/types.ts","../../src/erc20-approval-gas-sponsoring/resourceService.ts","../../src/erc20-approval-gas-sponsoring/facilitator.ts"],"sourcesContent":["/**\n * Type definitions for the EIP-2612 Gas Sponsoring Extension\n *\n * This extension enables gasless approval of the Permit2 contract for tokens\n * that implement EIP-2612. The client signs an off-chain permit, and the\n * facilitator submits it on-chain via `x402Permit2Proxy.settleWithPermit`.\n */\n\nimport type { FacilitatorExtension } from \"@bankofai/x402-core/types\";\n\n/**\n * Extension identifier for the EIP-2612 gas sponsoring extension.\n */\nexport const EIP2612_GAS_SPONSORING: FacilitatorExtension = { key: \"eip2612GasSponsoring\" };\n\n/**\n * EIP-2612 gas sponsoring info populated by the client.\n *\n * Contains the EIP-2612 permit signature and parameters that the facilitator\n * needs to call `x402Permit2Proxy.settleWithPermit`.\n */\nexport interface Eip2612GasSponsoringInfo {\n /** Index signature for compatibility with Record<string, unknown> */\n [key: string]: unknown;\n /** The address of the sender (token owner). */\n from: string;\n /** The address of the ERC-20 token contract. */\n asset: string;\n /** The address of the spender (Canonical Permit2). */\n spender: string;\n /** The amount to approve (uint256 as decimal string). Typically MaxUint256. */\n amount: string;\n /** The current EIP-2612 nonce of the sender (decimal string). */\n nonce: string;\n /** The timestamp at which the permit signature expires (decimal string). */\n deadline: string;\n /** The 65-byte concatenated EIP-2612 permit signature (r, s, v) as a hex string. */\n signature: string;\n /** Schema version identifier. */\n version: string;\n}\n\n/**\n * Server-side EIP-2612 gas sponsoring info included in PaymentRequired.\n * Contains a description and version; the client populates the rest.\n */\nexport interface Eip2612GasSponsoringServerInfo {\n /** Index signature for compatibility with Record<string, unknown> */\n [key: string]: unknown;\n /** Human-readable description of the extension. */\n description: string;\n /** Schema version identifier. */\n version: string;\n}\n\n/**\n * The full extension object as it appears in PaymentRequired.extensions\n * and PaymentPayload.extensions.\n */\nexport interface Eip2612GasSponsoringExtension {\n /** Extension info - server-provided or client-enriched. */\n info: Eip2612GasSponsoringServerInfo | Eip2612GasSponsoringInfo;\n /** JSON Schema describing the expected structure of info. */\n schema: Record<string, unknown>;\n}\n","/**\n * Resource Service functions for declaring the EIP-2612 Gas Sponsoring extension.\n *\n * These functions help servers declare support for EIP-2612 gasless Permit2 approvals\n * in the PaymentRequired response extensions.\n */\n\nimport { EIP2612_GAS_SPONSORING, type Eip2612GasSponsoringExtension } from \"./types\";\n\n/**\n * The JSON Schema for the EIP-2612 gas sponsoring extension info.\n * Matches the schema defined in the spec.\n */\nconst eip2612GasSponsoringSchema: Record<string, unknown> = {\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"object\",\n properties: {\n from: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the sender.\",\n },\n asset: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the ERC-20 token contract.\",\n },\n spender: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the spender (Canonical Permit2).\",\n },\n amount: {\n type: \"string\",\n pattern: \"^[0-9]+$\",\n description: \"The amount to approve (uint256). Typically MaxUint.\",\n },\n nonce: {\n type: \"string\",\n pattern: \"^[0-9]+$\",\n description: \"The current nonce of the sender.\",\n },\n deadline: {\n type: \"string\",\n pattern: \"^[0-9]+$\",\n description: \"The timestamp at which the signature expires.\",\n },\n signature: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]+$\",\n description: \"The 65-byte concatenated signature (r, s, v) as a hex string.\",\n },\n version: {\n type: \"string\",\n pattern: \"^[0-9]+(\\\\.[0-9]+)*$\",\n description: \"Schema version identifier.\",\n },\n },\n required: [\"from\", \"asset\", \"spender\", \"amount\", \"nonce\", \"deadline\", \"signature\", \"version\"],\n};\n\n/**\n * Declares the EIP-2612 gas sponsoring extension for inclusion in\n * PaymentRequired.extensions.\n *\n * The server advertises that it (or its facilitator) supports EIP-2612\n * gasless Permit2 approval. The client will populate the info with the\n * actual permit signature data.\n *\n * @returns An object keyed by the extension identifier containing the extension declaration\n *\n * @example\n * ```typescript\n * import { declareEip2612GasSponsoringExtension } from '@bankofai/x402-extensions';\n *\n * const routes = [\n * {\n * path: \"/api/data\",\n * price: \"$0.01\",\n * extensions: {\n * ...declareEip2612GasSponsoringExtension(),\n * },\n * },\n * ];\n * ```\n */\nexport function declareEip2612GasSponsoringExtension(): Record<\n string,\n Eip2612GasSponsoringExtension\n> {\n const key = EIP2612_GAS_SPONSORING.key;\n return {\n [key]: {\n info: {\n description:\n \"The facilitator accepts EIP-2612 gasless Permit to `Permit2` canonical contract.\",\n version: \"1\",\n },\n schema: eip2612GasSponsoringSchema,\n },\n };\n}\n","/**\n * Facilitator functions for extracting and validating EIP-2612 Gas Sponsoring extension data.\n *\n * These functions help facilitators extract the EIP-2612 permit data from payment\n * payloads and validate it before calling settleWithPermit.\n */\n\nimport type { PaymentPayload } from \"@bankofai/x402-core/types\";\nimport {\n EIP2612_GAS_SPONSORING,\n type Eip2612GasSponsoringInfo,\n type Eip2612GasSponsoringExtension,\n} from \"./types\";\n\n/**\n * Extracts the EIP-2612 gas sponsoring info from a payment payload's extensions.\n *\n * Returns the info if the extension is present and contains the required client-populated\n * fields (from, asset, spender, amount, nonce, deadline, signature, version).\n *\n * @param paymentPayload - The payment payload to extract from\n * @returns The EIP-2612 gas sponsoring info, or null if not present\n */\nexport function extractEip2612GasSponsoringInfo(\n paymentPayload: PaymentPayload,\n): Eip2612GasSponsoringInfo | null {\n if (!paymentPayload.extensions) {\n return null;\n }\n\n const extension = paymentPayload.extensions[EIP2612_GAS_SPONSORING.key] as\n | Eip2612GasSponsoringExtension\n | undefined;\n\n if (!extension?.info) {\n return null;\n }\n\n const info = extension.info as Record<string, unknown>;\n\n // Check that the client has populated the required fields\n if (\n !info.from ||\n !info.asset ||\n !info.spender ||\n !info.amount ||\n !info.nonce ||\n !info.deadline ||\n !info.signature ||\n !info.version\n ) {\n return null;\n }\n\n return info as unknown as Eip2612GasSponsoringInfo;\n}\n\n/**\n * Validates that the EIP-2612 gas sponsoring info has valid format.\n *\n * Performs basic validation on the info fields:\n * - Addresses are valid hex (0x + 40 hex chars)\n * - Amount, nonce, deadline are numeric strings\n * - Signature is a hex string\n * - Version is a numeric version string\n *\n * @param info - The EIP-2612 gas sponsoring info to validate\n * @returns True if the info is valid, false otherwise\n */\nexport function validateEip2612GasSponsoringInfo(info: Eip2612GasSponsoringInfo): boolean {\n const addressPattern = /^0x[a-fA-F0-9]{40}$/;\n const numericPattern = /^[0-9]+$/;\n const hexPattern = /^0x[a-fA-F0-9]+$/;\n const versionPattern = /^[0-9]+(\\.[0-9]+)*$/;\n\n return (\n addressPattern.test(info.from) &&\n addressPattern.test(info.asset) &&\n addressPattern.test(info.spender) &&\n numericPattern.test(info.amount) &&\n numericPattern.test(info.nonce) &&\n numericPattern.test(info.deadline) &&\n hexPattern.test(info.signature) &&\n versionPattern.test(info.version)\n );\n}\n","/**\n * Type definitions for the ERC-20 Approval Gas Sponsoring Extension\n *\n * This extension enables gasless Permit2 approval for generic ERC-20 tokens\n * that do NOT implement EIP-2612. The client signs (but does not broadcast) a\n * raw `approve(Permit2, MaxUint256)` transaction, and the facilitator broadcasts\n * it atomically before settling the Permit2 payment.\n */\n\nimport type { FacilitatorExtension } from \"@bankofai/x402-core/types\";\n\n/**\n * Signer capability carried by the ERC-20 approval extension when registered in a facilitator.\n *\n * Mirrors FacilitatorEvmSigner (from @bankofai/x402-evm) plus `sendRawTransaction`.\n * The extension signer owns the full approve+settle flow: it broadcasts the\n * pre-signed approval transaction AND executes the Permit2 settle call, enabling\n * production implementations to bundle both atomically (e.g., Flashbots, multicall).\n *\n * The method signatures are duplicated here (rather than extending FacilitatorEvmSigner)\n * to avoid a circular dependency between @bankofai/x402-extensions and @bankofai/x402-evm.\n */\nexport interface Erc20ApprovalGasSponsoringSigner {\n getAddresses(): readonly `0x${string}`[];\n readContract(args: {\n address: `0x${string}`;\n abi: readonly unknown[];\n functionName: string;\n args?: readonly unknown[];\n }): Promise<unknown>;\n verifyTypedData(args: {\n address: `0x${string}`;\n domain: Record<string, unknown>;\n types: Record<string, unknown>;\n primaryType: string;\n message: Record<string, unknown>;\n signature: `0x${string}`;\n }): Promise<boolean>;\n writeContract(args: {\n address: `0x${string}`;\n abi: readonly unknown[];\n functionName: string;\n args: readonly unknown[];\n }): Promise<`0x${string}`>;\n sendTransaction(args: { to: `0x${string}`; data: `0x${string}` }): Promise<`0x${string}`>;\n waitForTransactionReceipt(args: { hash: `0x${string}` }): Promise<{ status: string }>;\n getCode(args: { address: `0x${string}` }): Promise<`0x${string}` | undefined>;\n sendRawTransaction(args: { serializedTransaction: `0x${string}` }): Promise<`0x${string}`>;\n}\n\n/**\n * Extension identifier for the ERC-20 approval gas sponsoring extension.\n */\nexport const ERC20_APPROVAL_GAS_SPONSORING = {\n key: \"erc20ApprovalGasSponsoring\",\n} as const satisfies FacilitatorExtension;\n\n/** Current schema version for the ERC-20 approval gas sponsoring extension info. */\nexport const ERC20_APPROVAL_GAS_SPONSORING_VERSION = \"1\";\n\n/**\n * Extended extension object registered in a facilitator via registerExtension().\n * Carries the signer that owns the full approve+settle flow for ERC-20 tokens\n * that lack EIP-2612. The signer must have all FacilitatorEvmSigner capabilities\n * plus `sendRawTransaction` for broadcasting the pre-signed approval tx.\n *\n * @example\n * ```typescript\n * import { createErc20ApprovalGasSponsoringExtension } from '@bankofai/x402-extensions';\n *\n * facilitator.registerExtension(\n * createErc20ApprovalGasSponsoringExtension(evmSigner, viemClient),\n * );\n * ```\n */\nexport interface Erc20ApprovalGasSponsoringFacilitatorExtension extends FacilitatorExtension {\n key: \"erc20ApprovalGasSponsoring\";\n /** Signer with broadcast + settle capability. Optional — settlement fails gracefully if absent. */\n signer?: Erc20ApprovalGasSponsoringSigner;\n}\n\n/**\n * Signer input for {@link createErc20ApprovalGasSponsoringExtension}.\n * Matches the FacilitatorEvmSigner shape from @bankofai/x402-evm (duplicated to avoid circular dep).\n */\nexport type Erc20ApprovalGasSponsoringBaseSigner = Omit<\n Erc20ApprovalGasSponsoringSigner,\n \"sendRawTransaction\"\n>;\n\n/**\n * Create an ERC-20 approval gas sponsoring extension ready to register in a facilitator.\n *\n * @param signer - The EVM facilitator signer (e.g. from `toFacilitatorEvmSigner()`)\n * @param client - Object providing `sendRawTransaction` (e.g. a viem WalletClient)\n * @param client.sendRawTransaction - Broadcasts a signed transaction to the network\n * @returns A fully configured extension to pass to `facilitator.registerExtension()`\n */\nexport function createErc20ApprovalGasSponsoringExtension(\n signer: Erc20ApprovalGasSponsoringBaseSigner,\n client: {\n sendRawTransaction: (args: { serializedTransaction: `0x${string}` }) => Promise<`0x${string}`>;\n },\n): Erc20ApprovalGasSponsoringFacilitatorExtension {\n return {\n ...ERC20_APPROVAL_GAS_SPONSORING,\n signer: {\n ...signer,\n sendRawTransaction: client.sendRawTransaction.bind(client),\n },\n };\n}\n\n/**\n * ERC-20 approval gas sponsoring info populated by the client.\n *\n * Contains the RLP-encoded signed `approve(Permit2, MaxUint256)` transaction\n * that the facilitator broadcasts before settling the Permit2 payment.\n *\n * Note: Unlike EIP-2612, there is no nonce/deadline/signature — instead the\n * entire signed transaction is included as `signedTransaction`.\n */\nexport interface Erc20ApprovalGasSponsoringInfo {\n /** Index signature for compatibility with Record<string, unknown> */\n [key: string]: unknown;\n /** The address of the sender (token owner who signed the tx). */\n from: `0x${string}`;\n /** The address of the ERC-20 token contract. */\n asset: `0x${string}`;\n /** The address of the spender (Canonical Permit2). */\n spender: `0x${string}`;\n /** The amount approved (uint256 as decimal string). Always MaxUint256. */\n amount: string;\n /** The RLP-encoded signed EIP-1559 transaction as a hex string. */\n signedTransaction: `0x${string}`;\n /** Schema version identifier. */\n version: string;\n}\n\n/**\n * Server-side ERC-20 approval gas sponsoring info included in PaymentRequired.\n * Contains a description and version; the client populates the rest.\n */\nexport interface Erc20ApprovalGasSponsoringServerInfo {\n /** Index signature for compatibility with Record<string, unknown> */\n [key: string]: unknown;\n /** Human-readable description of the extension. */\n description: string;\n /** Schema version identifier. */\n version: string;\n}\n\n/**\n * The full extension object as it appears in PaymentRequired.extensions\n * and PaymentPayload.extensions.\n */\nexport interface Erc20ApprovalGasSponsoringExtension {\n /** Extension info - server-provided or client-enriched. */\n info: Erc20ApprovalGasSponsoringServerInfo | Erc20ApprovalGasSponsoringInfo;\n /** JSON Schema describing the expected structure of info. */\n schema: Record<string, unknown>;\n}\n","/**\n * Resource Service functions for declaring the ERC-20 Approval Gas Sponsoring extension.\n *\n * These functions help servers declare support for ERC-20 approval gas sponsoring\n * in the PaymentRequired response extensions. Use this for tokens that do NOT\n * implement EIP-2612 (generic ERC-20 tokens).\n */\n\nimport {\n ERC20_APPROVAL_GAS_SPONSORING,\n ERC20_APPROVAL_GAS_SPONSORING_VERSION,\n type Erc20ApprovalGasSponsoringExtension,\n} from \"./types\";\n\n/**\n * The JSON Schema for the ERC-20 approval gas sponsoring extension info.\n * Matches the schema defined in the spec.\n */\nexport const erc20ApprovalGasSponsoringSchema: Record<string, unknown> = {\n $schema: \"https://json-schema.org/draft/2020-12/schema\",\n type: \"object\",\n properties: {\n from: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the sender (token owner).\",\n },\n asset: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the ERC-20 token contract.\",\n },\n spender: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]{40}$\",\n description: \"The address of the spender (Canonical Permit2).\",\n },\n amount: {\n type: \"string\",\n pattern: \"^[0-9]+$\",\n description: \"The amount approved (uint256). Always MaxUint256.\",\n },\n signedTransaction: {\n type: \"string\",\n pattern: \"^0x[a-fA-F0-9]+$\",\n description: \"The RLP-encoded signed EIP-1559 transaction as a hex string.\",\n },\n version: {\n type: \"string\",\n pattern: \"^[0-9]+(\\\\.[0-9]+)*$\",\n description: \"Schema version identifier.\",\n },\n },\n required: [\"from\", \"asset\", \"spender\", \"amount\", \"signedTransaction\", \"version\"],\n};\n\n/**\n * Declares the ERC-20 approval gas sponsoring extension for inclusion in\n * PaymentRequired.extensions.\n *\n * The server advertises that it (or its facilitator) supports broadcasting\n * a pre-signed `approve(Permit2, MaxUint256)` transaction on the client's behalf.\n * Use this for tokens that do NOT implement EIP-2612.\n *\n * @returns An object keyed by the extension identifier containing the extension declaration\n *\n * @example\n * ```typescript\n * import { declareErc20ApprovalGasSponsoringExtension } from '@bankofai/x402-extensions';\n *\n * const routes = [\n * {\n * path: \"/api/data\",\n * price: { amount: \"1000\", asset: \"0x...\", extra: { assetTransferMethod: \"permit2\" } },\n * extensions: {\n * ...declareErc20ApprovalGasSponsoringExtension(),\n * },\n * },\n * ];\n * ```\n */\nexport function declareErc20ApprovalGasSponsoringExtension(): Record<\n string,\n Erc20ApprovalGasSponsoringExtension\n> {\n const key = ERC20_APPROVAL_GAS_SPONSORING.key;\n return {\n [key]: {\n info: {\n description:\n \"The facilitator broadcasts a pre-signed ERC-20 approve() transaction to grant Permit2 allowance.\",\n version: ERC20_APPROVAL_GAS_SPONSORING_VERSION,\n },\n schema: erc20ApprovalGasSponsoringSchema,\n },\n };\n}\n","/**\n * Facilitator functions for extracting and validating ERC-20 Approval Gas Sponsoring\n * extension data.\n *\n * These functions help facilitators extract the pre-signed approve() transaction\n * from payment payloads and validate it before broadcasting and settling.\n */\n\nimport Ajv from \"ajv/dist/2020.js\";\nimport type { PaymentPayload } from \"@bankofai/x402-core/types\";\nimport {\n ERC20_APPROVAL_GAS_SPONSORING,\n type Erc20ApprovalGasSponsoringInfo,\n type Erc20ApprovalGasSponsoringExtension,\n} from \"./types\";\nimport { erc20ApprovalGasSponsoringSchema } from \"./resourceService\";\n\n/**\n * Extracts the ERC-20 approval gas sponsoring info from a payment payload's extensions.\n *\n * Performs structural extraction only — checks that the extension is present and\n * contains all required fields. Does NOT validate field formats (use\n * validateErc20ApprovalGasSponsoringInfo for that).\n *\n * @param paymentPayload - The payment payload to extract from\n * @returns The ERC-20 approval gas sponsoring info, or null if not present\n */\nexport function extractErc20ApprovalGasSponsoringInfo(\n paymentPayload: PaymentPayload,\n): Erc20ApprovalGasSponsoringInfo | null {\n if (!paymentPayload.extensions) {\n return null;\n }\n\n const extension = paymentPayload.extensions[ERC20_APPROVAL_GAS_SPONSORING.key] as\n | Erc20ApprovalGasSponsoringExtension\n | undefined;\n\n if (!extension?.info) {\n return null;\n }\n\n const info = extension.info as Record<string, unknown>;\n\n if (\n !info.from ||\n !info.asset ||\n !info.spender ||\n !info.amount ||\n !info.signedTransaction ||\n !info.version\n ) {\n return null;\n }\n\n return info as unknown as Erc20ApprovalGasSponsoringInfo;\n}\n\n/**\n * Validates that the ERC-20 approval gas sponsoring info has valid format.\n *\n * Validates the info against the canonical JSON Schema, checking:\n * - All required fields are present\n * - Addresses are valid hex (0x + 40 hex chars)\n * - Amount is a numeric string\n * - signedTransaction is a hex string\n * - Version is a numeric version string\n *\n * @param info - The ERC-20 approval gas sponsoring info to validate\n * @returns True if the info is valid, false otherwise\n */\nexport function validateErc20ApprovalGasSponsoringInfo(\n info: Erc20ApprovalGasSponsoringInfo,\n): boolean {\n const ajv = new Ajv({ strict: false, allErrors: true });\n const validate = ajv.compile(erc20ApprovalGasSponsoringSchema);\n return validate(info) as boolean;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { ResourceServerExtension, PaymentPayload } from '@bankofai/x402-core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type definitions for the Payment-Identifier Extension
|
|
5
|
+
*
|
|
6
|
+
* Enables clients to provide an idempotency key that resource servers
|
|
7
|
+
* can use for deduplication of payment requests.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Extension identifier constant for the payment-identifier extension
|
|
11
|
+
*/
|
|
12
|
+
declare const PAYMENT_IDENTIFIER = "payment-identifier";
|
|
13
|
+
/**
|
|
14
|
+
* Minimum length for payment identifier
|
|
15
|
+
*/
|
|
16
|
+
declare const PAYMENT_ID_MIN_LENGTH = 16;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum length for payment identifier
|
|
19
|
+
*/
|
|
20
|
+
declare const PAYMENT_ID_MAX_LENGTH = 128;
|
|
21
|
+
/**
|
|
22
|
+
* Pattern for valid payment identifier characters (alphanumeric, hyphens, underscores)
|
|
23
|
+
*/
|
|
24
|
+
declare const PAYMENT_ID_PATTERN: RegExp;
|
|
25
|
+
/**
|
|
26
|
+
* Payment identifier info containing the required flag and client-provided ID
|
|
27
|
+
*/
|
|
28
|
+
interface PaymentIdentifierInfo {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the server requires clients to include a payment identifier.
|
|
31
|
+
* When true, clients must provide an `id` or receive a 400 Bad Request.
|
|
32
|
+
*/
|
|
33
|
+
required: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Client-provided unique identifier for idempotency.
|
|
36
|
+
* Must be 16-128 characters, alphanumeric with hyphens and underscores allowed.
|
|
37
|
+
*/
|
|
38
|
+
id?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Payment identifier extension with info and schema.
|
|
42
|
+
*
|
|
43
|
+
* Used both for server-side declarations (info without id) and
|
|
44
|
+
* client-side payloads (info with id).
|
|
45
|
+
*/
|
|
46
|
+
interface PaymentIdentifierExtension {
|
|
47
|
+
/**
|
|
48
|
+
* The payment identifier info.
|
|
49
|
+
* Server declarations have required only, clients add the id.
|
|
50
|
+
*/
|
|
51
|
+
info: PaymentIdentifierInfo;
|
|
52
|
+
/**
|
|
53
|
+
* JSON Schema validating the info structure
|
|
54
|
+
*/
|
|
55
|
+
schema: PaymentIdentifierSchema;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* JSON Schema type for the payment-identifier extension
|
|
59
|
+
*/
|
|
60
|
+
interface PaymentIdentifierSchema {
|
|
61
|
+
$schema: "https://json-schema.org/draft/2020-12/schema";
|
|
62
|
+
type: "object";
|
|
63
|
+
properties: {
|
|
64
|
+
required: {
|
|
65
|
+
type: "boolean";
|
|
66
|
+
};
|
|
67
|
+
id: {
|
|
68
|
+
type: "string";
|
|
69
|
+
minLength: number;
|
|
70
|
+
maxLength: number;
|
|
71
|
+
pattern: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
required: ["required"];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* JSON Schema definitions for the Payment-Identifier Extension
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* JSON Schema for validating payment identifier info.
|
|
83
|
+
* Compliant with JSON Schema Draft 2020-12.
|
|
84
|
+
*/
|
|
85
|
+
declare const paymentIdentifierSchema: PaymentIdentifierSchema;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Utility functions for the Payment-Identifier Extension
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Generates a unique payment identifier.
|
|
92
|
+
*
|
|
93
|
+
* @param prefix - Optional prefix for the ID (e.g., "pay_"). Defaults to "pay_".
|
|
94
|
+
* @returns A unique payment identifier string
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* // With default prefix
|
|
99
|
+
* const id = generatePaymentId(); // "pay_7d5d747be160e280504c099d984bcfe0"
|
|
100
|
+
*
|
|
101
|
+
* // With custom prefix
|
|
102
|
+
* const id = generatePaymentId("txn_"); // "txn_7d5d747be160e280504c099d984bcfe0"
|
|
103
|
+
*
|
|
104
|
+
* // Without prefix
|
|
105
|
+
* const id = generatePaymentId(""); // "7d5d747be160e280504c099d984bcfe0"
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare function generatePaymentId(prefix?: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Validates that a payment ID meets the format requirements.
|
|
111
|
+
*
|
|
112
|
+
* @param id - The payment ID to validate
|
|
113
|
+
* @returns True if the ID is valid, false otherwise
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* isValidPaymentId("pay_7d5d747be160e280"); // true (exactly 16 chars after prefix removal check)
|
|
118
|
+
* isValidPaymentId("abc"); // false (too short)
|
|
119
|
+
* isValidPaymentId("pay_abc!@#"); // false (invalid characters)
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
declare function isValidPaymentId(id: string): boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Client-side utilities for the Payment-Identifier Extension
|
|
126
|
+
*/
|
|
127
|
+
/**
|
|
128
|
+
* Appends a payment identifier to the extensions object if the server declared support.
|
|
129
|
+
*
|
|
130
|
+
* This function reads the server's `payment-identifier` declaration from the extensions,
|
|
131
|
+
* and appends the client's ID to it. If the extension is not present (server didn't declare it),
|
|
132
|
+
* the extensions are returned unchanged.
|
|
133
|
+
*
|
|
134
|
+
* @param extensions - The extensions object from PaymentRequired (will be modified in place)
|
|
135
|
+
* @param id - Optional custom payment ID. If not provided, a new ID will be generated.
|
|
136
|
+
* @returns The modified extensions object (same reference as input)
|
|
137
|
+
* @throws Error if the provided ID is invalid
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* import { appendPaymentIdentifierToExtensions } from '@bankofai/x402-extensions/payment-identifier';
|
|
142
|
+
*
|
|
143
|
+
* // Get extensions from server's PaymentRequired response
|
|
144
|
+
* const extensions = paymentRequired.extensions ?? {};
|
|
145
|
+
*
|
|
146
|
+
* // Append a generated ID (only if server declared payment-identifier)
|
|
147
|
+
* appendPaymentIdentifierToExtensions(extensions);
|
|
148
|
+
*
|
|
149
|
+
* // Or use a custom ID
|
|
150
|
+
* appendPaymentIdentifierToExtensions(extensions, "pay_my_custom_id_12345");
|
|
151
|
+
*
|
|
152
|
+
* // Include in PaymentPayload
|
|
153
|
+
* const paymentPayload = {
|
|
154
|
+
* x402Version: 2,
|
|
155
|
+
* resource: paymentRequired.resource,
|
|
156
|
+
* accepted: selectedPaymentOption,
|
|
157
|
+
* payload: { ... },
|
|
158
|
+
* extensions
|
|
159
|
+
* };
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare function appendPaymentIdentifierToExtensions(extensions: Record<string, unknown>, id?: string): Record<string, unknown>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Resource Server utilities for the Payment-Identifier Extension
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Declares the payment-identifier extension for inclusion in PaymentRequired.extensions.
|
|
170
|
+
*
|
|
171
|
+
* Resource servers call this function to advertise support for payment identifiers.
|
|
172
|
+
* The declaration indicates whether a payment identifier is required and includes
|
|
173
|
+
* the schema that clients must follow.
|
|
174
|
+
*
|
|
175
|
+
* @param required - Whether clients must provide a payment identifier. Defaults to false.
|
|
176
|
+
* @returns A PaymentIdentifierExtension object ready for PaymentRequired.extensions
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* import { declarePaymentIdentifierExtension, PAYMENT_IDENTIFIER } from '@bankofai/x402-extensions/payment-identifier';
|
|
181
|
+
*
|
|
182
|
+
* // Include in PaymentRequired response (optional identifier)
|
|
183
|
+
* const paymentRequired = {
|
|
184
|
+
* x402Version: 2,
|
|
185
|
+
* resource: { ... },
|
|
186
|
+
* accepts: [ ... ],
|
|
187
|
+
* extensions: {
|
|
188
|
+
* [PAYMENT_IDENTIFIER]: declarePaymentIdentifierExtension()
|
|
189
|
+
* }
|
|
190
|
+
* };
|
|
191
|
+
*
|
|
192
|
+
* // Require payment identifier
|
|
193
|
+
* const paymentRequiredStrict = {
|
|
194
|
+
* x402Version: 2,
|
|
195
|
+
* resource: { ... },
|
|
196
|
+
* accepts: [ ... ],
|
|
197
|
+
* extensions: {
|
|
198
|
+
* [PAYMENT_IDENTIFIER]: declarePaymentIdentifierExtension(true)
|
|
199
|
+
* }
|
|
200
|
+
* };
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
declare function declarePaymentIdentifierExtension(required?: boolean): PaymentIdentifierExtension;
|
|
204
|
+
/**
|
|
205
|
+
* ResourceServerExtension implementation for payment-identifier.
|
|
206
|
+
*
|
|
207
|
+
* This extension doesn't require any enrichment hooks since the declaration
|
|
208
|
+
* is static. It's provided for consistency with other extensions and for
|
|
209
|
+
* potential future use with the extension registration system.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* import { paymentIdentifierResourceServerExtension } from '@bankofai/x402-extensions/payment-identifier';
|
|
214
|
+
*
|
|
215
|
+
* resourceServer.registerExtension(paymentIdentifierResourceServerExtension);
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare const paymentIdentifierResourceServerExtension: ResourceServerExtension;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Validation and extraction utilities for the Payment-Identifier Extension
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Type guard to check if an object is a valid payment-identifier extension structure.
|
|
226
|
+
*
|
|
227
|
+
* This checks for the basic structure (info object with required boolean),
|
|
228
|
+
* but does not validate the id format if present.
|
|
229
|
+
*
|
|
230
|
+
* @param extension - The object to check
|
|
231
|
+
* @returns True if the object has the expected payment-identifier extension structure
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* if (isPaymentIdentifierExtension(extensions["payment-identifier"])) {
|
|
236
|
+
* // TypeScript knows this is PaymentIdentifierExtension
|
|
237
|
+
* console.log(extension.info.required);
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
declare function isPaymentIdentifierExtension(extension: unknown): extension is PaymentIdentifierExtension;
|
|
242
|
+
/**
|
|
243
|
+
* Result of payment identifier validation
|
|
244
|
+
*/
|
|
245
|
+
interface PaymentIdentifierValidationResult {
|
|
246
|
+
/**
|
|
247
|
+
* Whether the payment identifier is valid
|
|
248
|
+
*/
|
|
249
|
+
valid: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Error messages if validation failed
|
|
252
|
+
*/
|
|
253
|
+
errors?: string[];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Validates a payment-identifier extension object.
|
|
257
|
+
*
|
|
258
|
+
* Checks both the structure (using JSON Schema) and the ID format.
|
|
259
|
+
*
|
|
260
|
+
* @param extension - The extension object to validate
|
|
261
|
+
* @returns Validation result with errors if invalid
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const result = validatePaymentIdentifier(paymentPayload.extensions?.["payment-identifier"]);
|
|
266
|
+
* if (!result.valid) {
|
|
267
|
+
* console.error("Invalid payment identifier:", result.errors);
|
|
268
|
+
* }
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
declare function validatePaymentIdentifier(extension: unknown): PaymentIdentifierValidationResult;
|
|
272
|
+
/**
|
|
273
|
+
* Extracts the payment identifier from a PaymentPayload.
|
|
274
|
+
*
|
|
275
|
+
* @param paymentPayload - The payment payload to extract from
|
|
276
|
+
* @param validate - Whether to validate the ID before returning (default: true)
|
|
277
|
+
* @returns The payment ID string, or null if not present or invalid
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const id = extractPaymentIdentifier(paymentPayload);
|
|
282
|
+
* if (id) {
|
|
283
|
+
* // Use for idempotency lookup
|
|
284
|
+
* const cached = await idempotencyStore.get(id);
|
|
285
|
+
* }
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
declare function extractPaymentIdentifier(paymentPayload: PaymentPayload, validate?: boolean): string | null;
|
|
289
|
+
/**
|
|
290
|
+
* Extracts and validates the payment identifier from a PaymentPayload.
|
|
291
|
+
*
|
|
292
|
+
* @param paymentPayload - The payment payload to extract from
|
|
293
|
+
* @returns Object with the ID and validation result
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const { id, validation } = extractAndValidatePaymentIdentifier(paymentPayload);
|
|
298
|
+
* if (!validation.valid) {
|
|
299
|
+
* return res.status(400).json({ error: validation.errors });
|
|
300
|
+
* }
|
|
301
|
+
* if (id) {
|
|
302
|
+
* // Use for idempotency
|
|
303
|
+
* }
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
declare function extractAndValidatePaymentIdentifier(paymentPayload: PaymentPayload): {
|
|
307
|
+
id: string | null;
|
|
308
|
+
validation: PaymentIdentifierValidationResult;
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Checks if a PaymentPayload contains a payment-identifier extension.
|
|
312
|
+
*
|
|
313
|
+
* @param paymentPayload - The payment payload to check
|
|
314
|
+
* @returns True if the extension is present
|
|
315
|
+
*/
|
|
316
|
+
declare function hasPaymentIdentifier(paymentPayload: PaymentPayload): boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Checks if the server requires a payment identifier based on the extension info.
|
|
319
|
+
*
|
|
320
|
+
* @param extension - The payment-identifier extension from PaymentRequired or PaymentPayload
|
|
321
|
+
* @returns True if the server requires a payment identifier
|
|
322
|
+
*/
|
|
323
|
+
declare function isPaymentIdentifierRequired(extension: unknown): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Validates that a payment identifier is provided when required.
|
|
326
|
+
*
|
|
327
|
+
* Use this to check if a client's PaymentPayload satisfies the server's requirement.
|
|
328
|
+
*
|
|
329
|
+
* @param paymentPayload - The client's payment payload
|
|
330
|
+
* @param serverRequired - Whether the server requires a payment identifier (from PaymentRequired)
|
|
331
|
+
* @returns Validation result - invalid if required but not provided
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const serverExtension = paymentRequired.extensions?.["payment-identifier"];
|
|
336
|
+
* const serverRequired = isPaymentIdentifierRequired(serverExtension);
|
|
337
|
+
* const result = validatePaymentIdentifierRequirement(paymentPayload, serverRequired);
|
|
338
|
+
* if (!result.valid) {
|
|
339
|
+
* return res.status(400).json({ error: result.errors });
|
|
340
|
+
* }
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
declare function validatePaymentIdentifierRequirement(paymentPayload: PaymentPayload, serverRequired: boolean): PaymentIdentifierValidationResult;
|
|
344
|
+
|
|
345
|
+
export { PAYMENT_IDENTIFIER, PAYMENT_ID_MAX_LENGTH, PAYMENT_ID_MIN_LENGTH, PAYMENT_ID_PATTERN, type PaymentIdentifierExtension, type PaymentIdentifierInfo, type PaymentIdentifierSchema, type PaymentIdentifierValidationResult, appendPaymentIdentifierToExtensions, declarePaymentIdentifierExtension, extractAndValidatePaymentIdentifier, extractPaymentIdentifier, generatePaymentId, hasPaymentIdentifier, isPaymentIdentifierExtension, isPaymentIdentifierRequired, isValidPaymentId, paymentIdentifierResourceServerExtension, paymentIdentifierSchema, validatePaymentIdentifier, validatePaymentIdentifierRequirement };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PAYMENT_IDENTIFIER,
|
|
3
|
+
PAYMENT_ID_MAX_LENGTH,
|
|
4
|
+
PAYMENT_ID_MIN_LENGTH,
|
|
5
|
+
PAYMENT_ID_PATTERN,
|
|
6
|
+
appendPaymentIdentifierToExtensions,
|
|
7
|
+
declarePaymentIdentifierExtension,
|
|
8
|
+
extractAndValidatePaymentIdentifier,
|
|
9
|
+
extractPaymentIdentifier,
|
|
10
|
+
generatePaymentId,
|
|
11
|
+
hasPaymentIdentifier,
|
|
12
|
+
isPaymentIdentifierExtension,
|
|
13
|
+
isPaymentIdentifierRequired,
|
|
14
|
+
isValidPaymentId,
|
|
15
|
+
paymentIdentifierResourceServerExtension,
|
|
16
|
+
paymentIdentifierSchema,
|
|
17
|
+
validatePaymentIdentifier,
|
|
18
|
+
validatePaymentIdentifierRequirement
|
|
19
|
+
} from "../chunk-RERA4OZZ.mjs";
|
|
20
|
+
export {
|
|
21
|
+
PAYMENT_IDENTIFIER,
|
|
22
|
+
PAYMENT_ID_MAX_LENGTH,
|
|
23
|
+
PAYMENT_ID_MIN_LENGTH,
|
|
24
|
+
PAYMENT_ID_PATTERN,
|
|
25
|
+
appendPaymentIdentifierToExtensions,
|
|
26
|
+
declarePaymentIdentifierExtension,
|
|
27
|
+
extractAndValidatePaymentIdentifier,
|
|
28
|
+
extractPaymentIdentifier,
|
|
29
|
+
generatePaymentId,
|
|
30
|
+
hasPaymentIdentifier,
|
|
31
|
+
isPaymentIdentifierExtension,
|
|
32
|
+
isPaymentIdentifierRequired,
|
|
33
|
+
isValidPaymentId,
|
|
34
|
+
paymentIdentifierResourceServerExtension,
|
|
35
|
+
paymentIdentifierSchema,
|
|
36
|
+
validatePaymentIdentifier,
|
|
37
|
+
validatePaymentIdentifierRequirement
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|