@x402-hpke/node
Version:
Provider-agnostic HPKE envelope library for x402 (Node) — cross-language interop with Python
19 lines (18 loc) • 897 B
TypeScript
export type StreamingKey = Uint8Array;
export declare function sealChunkXChaCha(key: StreamingKey, noncePrefix16: Uint8Array, seq: number, plaintext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
export declare function openChunkXChaCha(key: StreamingKey, noncePrefix16: Uint8Array, seq: number, ciphertext: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
export declare class XChaChaStreamLimiter {
private readonly key;
private readonly prefix;
private readonly maxChunks;
private readonly maxBytes;
private chunksUsed;
private bytesUsed;
constructor(key: StreamingKey, noncePrefix16: Uint8Array, opts?: {
maxChunks?: number;
maxBytes?: number;
});
private enforceLimits;
seal(seq: number, chunk: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
open(seq: number, ct: Uint8Array, aad?: Uint8Array): Promise<Uint8Array>;
}