import { HEX_ENC, type UTF8_ENC } from "../constants.js"; /** * Encodes a UTF-8 string into bytes. * @param str Input string. * @returns UTF-8 encoded bytes. */ export declare function utf8ToBuffer(str: string): Uint8Array; /** * Decodes UTF-8 bytes into a string. * @param buf UTF-8 encoded bytes. * @returns Decoded string. */ export declare function bufferToUtf8(buf: Uint8Array): string; /** * Concatenates multiple byte arrays. * @param buffers Byte arrays to concatenate. * @returns Concatenated byte array. */ export declare function concatBuffers(...buffers: Uint8Array[]): Uint8Array; /** * Converts bytes to a lowercase hex string. * @param buf Input bytes. * @param enc Output encoding selector. Only `hex` is accepted. * @returns Hex string. */ export declare function bufferToHex(buf: Uint8Array, enc?: typeof HEX_ENC | typeof UTF8_ENC): string; /** * Converts a hex string to bytes. * @param hex Input hex string, with optional `0x` prefix. * @returns Decoded bytes. */ export declare function hexToBuffer(hex: string): Uint8Array; /** * Removes a leading `0x` prefix from a hex string. * @param hex Input hex string. * @returns Hex string without prefix. */ export declare function sanitizeHex(hex: string): string; /** * Removes leading zeros from a hex string. * @param hex Input hex string. * @returns Hex string without leading zeros. */ export declare function removeHexLeadingZeros(hex: string): string; /** * Parses a hex string into a number. * @param hex Input hex string. * @returns Parsed number. */ export declare function hexToNumber(hex: string): number; /** * RFC 4648 Base64 from bytes. Chunks `btoa` input to avoid huge spread argument lists. * * @param buf Input bytes. * @returns Base64 string (no line breaks). */ export declare function bufferToBase64(buf: Uint8Array): string; /** * RFC 4648 Base64 to bytes (whitespace stripped). Uses `atob`. * * @param str Base64 string. * @returns New `Uint8Array`. * @throws {DOMException} Invalid Base64 where `atob` throws. */ export declare function base64ToBuffer(str: string): Uint8Array; /** * RFC 4648 Base64url without `=` padding (`-`/`_`). Common for JWK `k`. * * @param buf Input bytes. * @returns Base64url string. */ export declare function bufferToBase64Url(buf: Uint8Array): string; /** * Base64url to bytes (optional padding; then {@link base64ToBuffer}). * * @param str Base64url string. * @returns New `Uint8Array`. * @throws {Error} Length mod 4 === 1 (invalid). */ export declare function base64UrlToBuffer(str: string): Uint8Array; /** * 16-byte AES-128 raw key from `utf8ToBuffer(key.padEnd(16, " "))`. Must yield exactly 16 UTF-8 bytes * (same constraint as Web Crypto `importKey("raw", …)` for AES-128). * * @param key Passphrase. * @returns 16 key bytes. * @throws {Error} UTF-8 length ≠ 16 after padding. */ export declare function aes128StringKeyMaterial(key: string): Uint8Array; //# sourceMappingURL=encoding.d.ts.map