From 76cb9c2a39d477a64824a985ade40507e3bbade1 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Fri, 13 Feb 2026 21:34:48 -0800 Subject: feat(vanilla): add testing infrastructure and tests (NK-wjnczv) --- vanilla/node_modules/@exodus/bytes/base32.d.ts | 83 ++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 vanilla/node_modules/@exodus/bytes/base32.d.ts (limited to 'vanilla/node_modules/@exodus/bytes/base32.d.ts') diff --git a/vanilla/node_modules/@exodus/bytes/base32.d.ts b/vanilla/node_modules/@exodus/bytes/base32.d.ts new file mode 100644 index 0000000..bf7c2fc --- /dev/null +++ b/vanilla/node_modules/@exodus/bytes/base32.d.ts @@ -0,0 +1,83 @@ +/** + * Implements base32 and base32hex from [RFC4648](https://datatracker.ietf.org/doc/html/rfc4648) + * (no differences from [RFC3548](https://datatracker.ietf.org/doc/html/rfc4648)). + * + * ```js + * import { fromBase32, toBase32 } from '@exodus/bytes/base32.js' + * import { fromBase32hex, toBase32hex } from '@exodus/bytes/base32.js' + * ``` + * + * @module @exodus/bytes/base32.js + */ + +/// + +import type { OutputFormat, Uint8ArrayBuffer } from './array.js'; + +/** + * Options for base32 encoding + */ +export interface ToBase32Options { + /** Whether to include padding characters (default: false) */ + padding?: boolean; +} + +/** + * Padding mode for base32 decoding + * - `true`: padding is required + * - `false`: padding is not allowed + * - `'both'`: padding is optional (default) + */ +export type PaddingMode = boolean | 'both'; + +/** + * Options for base32 decoding + */ +export interface FromBase32Options { + /** Output format (default: 'uint8') */ + format?: OutputFormat; + /** Padding mode */ + padding?: PaddingMode; +} + +/** + * Encode a `Uint8Array` to a base32 string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options + * @returns The base32 encoded string + */ +export function toBase32(arr: Uint8Array, options?: ToBase32Options): string; + +/** + * Encode a `Uint8Array` to a base32hex string (RFC 4648) + * + * @param arr - The input bytes + * @param options - Encoding options (padding defaults to false) + * @returns The base32hex encoded string + */ +export function toBase32hex(arr: Uint8Array, options?: ToBase32Options): string; + +/** + * Decode a base32 string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base32 encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase32(string: string, options?: FromBase32Options): Uint8ArrayBuffer; +export function fromBase32(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer; + +/** + * Decode a base32hex string to bytes + * + * Operates in strict mode for last chunk, does not allow whitespace + * + * @param string - The base32hex encoded string + * @param options - Decoding options + * @returns The decoded bytes + */ +export function fromBase32hex(string: string, options?: FromBase32Options): Uint8ArrayBuffer; +export function fromBase32hex(string: string, options: FromBase32Options & { format: 'buffer' }): Buffer; -- cgit v1.2.3