/** * Byte encoding and allocation for Node and Bun. Inputs accept Buffer and * Uint8Array so callers can pass binary protocol values without conversion. */ import { Buffer as NodeBuffer } from "node:buffer"; export type BufferLike = NodeBuffer | Uint8Array; /** Decode hexadecimal text, ignoring non-hex separators. */ export declare function fromHex(hex: string): BufferLike; export declare function fromString(str: string, encoding?: "utf8" | "utf-8" | "base64"): BufferLike; export declare function toHex(buffer: BufferLike): string; export declare function bufferToString(buffer: BufferLike, encoding?: "utf8" | "utf-8" | "base64" | "hex"): string; export declare function isBuffer(obj: unknown): obj is BufferLike; export declare function alloc(size: number): BufferLike; export declare function fromBytes(bytes: number[] | Uint8Array): BufferLike; export declare function concat(buffers: BufferLike[]): BufferLike; /** Preserve the input representation's slice ownership semantics. */ export declare function slice(buffer: BufferLike, start: number, end?: number): BufferLike; export declare function equals(a: BufferLike, b: BufferLike): boolean; export declare function byteLength(buffer: BufferLike): number; /** Allocate cryptographically secure random bytes using the runtime provider. */ export declare function randomBytes(size: number): BufferLike; export declare const BufferUtils: { fromHex: typeof fromHex; fromString: typeof fromString; fromBytes: typeof fromBytes; toHex: typeof toHex; bufferToString: typeof bufferToString; toString: typeof bufferToString; isBuffer: typeof isBuffer; alloc: typeof alloc; concat: typeof concat; slice: typeof slice; equals: typeof equals; byteLength: typeof byteLength; randomBytes: typeof randomBytes; }; export type { BufferLike as Buffer };