New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

base64-ct

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base64-ct

Safe, constant-time Base64 encoding and decoding in pure JavaScript, with support for common Base64 variants.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Usage:

  • Traditional alphabet, padding:
const codec = new Base64(true);
const b64 = codec.encode(data);
const data2 = codec.decode(b64);
  • Traditional alphabet, no padding:
const codec = new Base64(false);
const b64 = codec.encode(data);
const data2 = codec.decode(b64);
  • URL-safe, no padding:
const codec = new Base64UrlSafe(false);
const b64 = codec.encode(data);
const data2 = codec.decode(b64);
  • URL-safe, padding, ignoring spaces and \n:
const codec = new Base64UrlSafe(true, " \n");
const b64 = codec.encode(data);
const data2 = codec.decode(b64);

Keywords

FAQs

Package last updated on 10 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc