/** * Encode a `Buffer` / `Uint8Array` as unpadded base64url. * * @param {Buffer | Uint8Array} bytes * @returns {string} */ export function encode(bytes: Buffer | Uint8Array): string; /** * Encode a UTF-8 string as unpadded base64url. * * @param {string} text * @returns {string} */ export function encodeString(text: string): string; /** * Encode a JSON-serialisable value as unpadded base64url of its * UTF-8 JSON representation. * * @param {unknown} value * @returns {string} */ export function encodeJson(value: unknown): string; /** * Decode an unpadded base64url string into a `Buffer`. Rejects strings * containing padding, whitespace, or non-alphabet characters, and * rejects non-canonical encodings via a roundtrip check. * * @param {string} text * @returns {Buffer} */ export function decode(text: string): Buffer; /** * Decode base64url and interpret the result as UTF-8. * * @param {string} text * @returns {string} */ export function decodeString(text: string): string; /** * Decode base64url and parse the result as JSON. Header failures are * tagged {@link ErrorCode.INVALID_HEADER} so callers get an actionable code. * * @param {string} text * @returns {unknown} */ export function decodeJson(text: string): unknown;