uvd-x402-sdk 2.57.0 → 2.59.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/dist/index.d.mts CHANGED
@@ -229,6 +229,64 @@ declare function signAnchorEd25519(privateKey: Uint8Array, paymentId: string, co
229
229
  * anchor provisional.
230
230
  */
231
231
  declare function signAnchorEvm(privateKey: Uint8Array, paymentId: string, contentHash: string, pointer: string, payee: string, chainId: number): string;
232
+ /**
233
+ * Derive the encryption target from a Solana (or Fogo) address.
234
+ *
235
+ * On ed25519 chains the address **is** the public key, so this needs no
236
+ * signature and no lookup. Rejects anything that does not decode to exactly 32
237
+ * bytes: a short decode silently padded up to 32 produces a small-order point,
238
+ * which fails a layer later with a message that points nowhere near the cause.
239
+ */
240
+ declare function payerKeyFromSolanaAddress(address: string): Uint8Array;
241
+ /**
242
+ * Seal `body` so every listed recipient can read it, and nobody else.
243
+ *
244
+ * The body is encrypted **once**; only the content key is wrapped per recipient,
245
+ * so adding the seller costs about sixty bytes rather than a second copy of the
246
+ * payload. That is what makes it practical for a seller to keep a readable copy
247
+ * of what it delivered — and answer a false "that is not what you sent" —
248
+ * instead of paying to anchor evidence it cannot open.
249
+ *
250
+ * A single payer recipient is emitted as format **v1, byte-for-byte**, so
251
+ * nothing already anchored becomes unreadable and readers still on v1 keep
252
+ * working.
253
+ */
254
+ declare function sealEvidenceTo(body: Uint8Array, recipients: Array<{
255
+ role: RecipientRole;
256
+ key: Uint8Array;
257
+ }>, paymentIdValue: string): Uint8Array;
258
+ interface AnchorOptions {
259
+ paymentId: string;
260
+ network: string;
261
+ txHash: string;
262
+ payer: string;
263
+ payee: string;
264
+ /** The buyer's encryption key, from `payerKeyFromSolanaAddress` or similar. */
265
+ payerKey: Uint8Array;
266
+ /**
267
+ * Your **public** key, to keep a readable copy so you can answer a false
268
+ * "that is not what you sent".
269
+ *
270
+ * It does not have to be your payment key, and should not be — a custodial
271
+ * payment wallet works fine here, because this key only ever decrypts.
272
+ */
273
+ sellerEncryptionKey?: Uint8Array;
274
+ /**
275
+ * `(digest) => "0x..."`. A callable rather than a private key is what lets a
276
+ * custodian sign: it receives the digest and returns the signature without the
277
+ * seed ever leaving it.
278
+ *
279
+ * Without one the anchor is **provisional** — it holds the slot, but a signed
280
+ * anchor for the same payment supersedes it.
281
+ */
282
+ sign?: (digest: Uint8Array) => string | Promise<string>;
283
+ retention?: string;
284
+ facilitator?: string;
285
+ fetch?: typeof fetch;
286
+ }
287
+ declare function anchorEvidence(body: Uint8Array, opts: AnchorOptions): Promise<Record<string, unknown>>;
288
+ /** Encode an anchor result for the `X-Durable-Evidence` response header. */
289
+ declare function evidenceHeader(evidence: unknown): string;
232
290
 
233
291
  /**
234
292
  * Facilitator wallet addresses by chain type
@@ -877,4 +935,4 @@ interface EscrowPreAuthParams {
877
935
  */
878
936
  declare function buildEscrowPreAuth(wallet: EscrowPreAuthSigner, params: EscrowPreAuthParams): Promise<string>;
879
937
 
880
- export { type AnchoredEvidence, ContentHashMismatch, type CreateSignedFetchConfig, DX402Error, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, OPERATOR_FEE_BPS, type RecipientRole, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, fetchNonce, getFacilitatorAddress, isEndToEnd, matchesFilters, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, recoverEvidence, sealEvidence, sealedRoles, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal };
938
+ export { type AnchorOptions, type AnchoredEvidence, ContentHashMismatch, type CreateSignedFetchConfig, DX402Error, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, OPERATOR_FEE_BPS, type RecipientRole, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, anchorEvidence, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isEndToEnd, matchesFilters, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, sealEvidence, sealEvidenceTo, sealedRoles, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal };
package/dist/index.d.ts CHANGED
@@ -229,6 +229,64 @@ declare function signAnchorEd25519(privateKey: Uint8Array, paymentId: string, co
229
229
  * anchor provisional.
230
230
  */
231
231
  declare function signAnchorEvm(privateKey: Uint8Array, paymentId: string, contentHash: string, pointer: string, payee: string, chainId: number): string;
232
+ /**
233
+ * Derive the encryption target from a Solana (or Fogo) address.
234
+ *
235
+ * On ed25519 chains the address **is** the public key, so this needs no
236
+ * signature and no lookup. Rejects anything that does not decode to exactly 32
237
+ * bytes: a short decode silently padded up to 32 produces a small-order point,
238
+ * which fails a layer later with a message that points nowhere near the cause.
239
+ */
240
+ declare function payerKeyFromSolanaAddress(address: string): Uint8Array;
241
+ /**
242
+ * Seal `body` so every listed recipient can read it, and nobody else.
243
+ *
244
+ * The body is encrypted **once**; only the content key is wrapped per recipient,
245
+ * so adding the seller costs about sixty bytes rather than a second copy of the
246
+ * payload. That is what makes it practical for a seller to keep a readable copy
247
+ * of what it delivered — and answer a false "that is not what you sent" —
248
+ * instead of paying to anchor evidence it cannot open.
249
+ *
250
+ * A single payer recipient is emitted as format **v1, byte-for-byte**, so
251
+ * nothing already anchored becomes unreadable and readers still on v1 keep
252
+ * working.
253
+ */
254
+ declare function sealEvidenceTo(body: Uint8Array, recipients: Array<{
255
+ role: RecipientRole;
256
+ key: Uint8Array;
257
+ }>, paymentIdValue: string): Uint8Array;
258
+ interface AnchorOptions {
259
+ paymentId: string;
260
+ network: string;
261
+ txHash: string;
262
+ payer: string;
263
+ payee: string;
264
+ /** The buyer's encryption key, from `payerKeyFromSolanaAddress` or similar. */
265
+ payerKey: Uint8Array;
266
+ /**
267
+ * Your **public** key, to keep a readable copy so you can answer a false
268
+ * "that is not what you sent".
269
+ *
270
+ * It does not have to be your payment key, and should not be — a custodial
271
+ * payment wallet works fine here, because this key only ever decrypts.
272
+ */
273
+ sellerEncryptionKey?: Uint8Array;
274
+ /**
275
+ * `(digest) => "0x..."`. A callable rather than a private key is what lets a
276
+ * custodian sign: it receives the digest and returns the signature without the
277
+ * seed ever leaving it.
278
+ *
279
+ * Without one the anchor is **provisional** — it holds the slot, but a signed
280
+ * anchor for the same payment supersedes it.
281
+ */
282
+ sign?: (digest: Uint8Array) => string | Promise<string>;
283
+ retention?: string;
284
+ facilitator?: string;
285
+ fetch?: typeof fetch;
286
+ }
287
+ declare function anchorEvidence(body: Uint8Array, opts: AnchorOptions): Promise<Record<string, unknown>>;
288
+ /** Encode an anchor result for the `X-Durable-Evidence` response header. */
289
+ declare function evidenceHeader(evidence: unknown): string;
232
290
 
233
291
  /**
234
292
  * Facilitator wallet addresses by chain type
@@ -877,4 +935,4 @@ interface EscrowPreAuthParams {
877
935
  */
878
936
  declare function buildEscrowPreAuth(wallet: EscrowPreAuthSigner, params: EscrowPreAuthParams): Promise<string>;
879
937
 
880
- export { type AnchoredEvidence, ContentHashMismatch, type CreateSignedFetchConfig, DX402Error, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, OPERATOR_FEE_BPS, type RecipientRole, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, fetchNonce, getFacilitatorAddress, isEndToEnd, matchesFilters, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, recoverEvidence, sealEvidence, sealedRoles, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal };
938
+ export { type AnchorOptions, type AnchoredEvidence, ContentHashMismatch, type CreateSignedFetchConfig, DX402Error, type ERC8128RequestOptions, ESCROW_DEPOSIT_LIMIT_USD, ESCROW_TIER_WINDOWS, EVENT_KINDS, EVIDENCE_HEADER, type EscrowNetworkConfig, type EscrowPaymentInfo, type EscrowPreAuthParams, type EscrowPreAuthSigner, type EscrowTierWindows, type EvidenceMode, EvidenceSkipped, FACILITATOR_ADDRESSES, type FacilitatorAddresses, KEEPALIVE_INTERVAL_MS, OPERATOR_FEE_BPS, type RecipientRole, type SSEFrame, SSEParser, type SignRequestOptions, type SignRequestWithSignerOptions, type SignatureBaseParams, type SignatureHeaders, type SignatureParamsInput, SigningWalletAdapter, type StreamTrafficEventsOptions, type TrafficEvent, type TrafficEventKind, TrafficStreamError, ZERO_ADDRESS, anchorDigest, anchorEvidence, buildEscrowPreAuth, buildSignatureBase, buildSignatureParams, computeEscrowNonce, contentHash, createSignedFetch, dereferencePointer, paymentId as dx402PaymentId, ed25519ToX25519, evidenceFromHeaders, evidenceHeader, fetchNonce, getFacilitatorAddress, isEndToEnd, matchesFilters, parseEvidenceHeader, parseSealed, parseTrafficEvent, payerKeyFromEvmSignature, payerKeyFromSolanaAddress, recoverEvidence, sealEvidence, sealEvidenceTo, sealedRoles, signAnchorEd25519, signAnchorEvm, signRequest, signRequestWithSigner, signRequestWithWallet, streamTrafficEvents, unseal };