UNPKG

@x402-hpke/node

Version:

Provider-agnostic HPKE envelope library for x402 (Node) — cross-language interop with Python

32 lines (31 loc) 1.08 kB
export type XPaymentAuthorization = { from: string; to: string; value: string; validAfter: string; validBefore: string; nonce: string; }; export type XPaymentPayload = { signature: string; authorization: XPaymentAuthorization; }; export type XPaymentHeader = { x402Version: 1; scheme: string; network: string; payload: XPaymentPayload; }; export type XPaymentResponseHeader = { x402Version: 1; scheme: string; network: string; payload: Record<string, any>; }; export type PaymentLike = XPaymentHeader | XPaymentResponseHeader; export declare function isXPayment(obj: any): obj is XPaymentHeader; export declare function isXPaymentResponse(obj: any): obj is XPaymentResponseHeader; export declare function normalizePaymentLike<T extends PaymentLike>(input: T): T; export declare function synthesizePaymentHeaderValue(p: PaymentLike): string; export declare function parsePaymentHeaderValue(s: string): PaymentLike | null; export declare function deriveExtendedAppFromPayment(p: XPaymentHeader): Record<string, string>;