# js-base64-ct **Repository Path**: mirrors_jedisct1/js-base64-ct ## Basic Information - **Project Name**: js-base64-ct - **Description**: Safe Base64 encoding/decoding in pure JavaScript. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-11 - **Last Updated**: 2025-09-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Safe Base64 codecs for JavaScript A pure JavaScript port of the libsodium base64 codecs. Features: * Supports traditional and URL-safe variants, with or without padding * Rejects non-canonical padding * Constant-time (best-effort), suitable for encoding/decoding secrets * Characters can be ignored by the decoder Available on NPM: [base64-ct](https://www.npmjs.com/package/base64-ct) Usage: - Traditional alphabet, padding: ```js const codec = new Base64(true); const b64 = codec.encode(data); const data2 = codec.decode(b64); ``` - Traditional alphabet, no padding: ```js const codec = new Base64(false); const b64 = codec.encode(data); const data2 = codec.decode(b64); ``` - URL-safe, no padding: ```js const codec = new Base64UrlSafe(false); const b64 = codec.encode(data); const data2 = codec.decode(b64); ``` - URL-safe, padding, ignoring spaces and `\n`: ```js const codec = new Base64UrlSafe(true, " \n"); const b64 = codec.encode(data); const data2 = codec.decode(b64); ```