Socket
Book a DemoInstallSign in
Socket

key-forge

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

key-forge

A simple random key generator for use with Node.

1.0.0-beta-01
latest
Source
npmnpm
Version published
Weekly downloads
58
13.73%
Maintainers
3
Weekly downloads
 
Created
Source

Key Forge

A simple key generation library for use with Node. More or less a convenience wrapper around Node's Crypto and Buffer libraries.

Install

npm install key-forge

Usage

Although Key Forge has a number of functions that you can use to fine-tune your key generation, mostly what you want is this:

{randomKey} = require "key-forge"
keySize = 16 # bytes
key = randomKey keySize # defaults to hex encoding
key = randomKey keySize, "hex"
key = randomKey keySize, "base64"
key = randomKey keySize, "base64url"

Notes on Encodings

  • "hex": direct output from Node.js Buffer.toString("hex")

  • "base64": output from Buffer.toString("base64") with the "=" padding stripped.

  • "base64url": Based on http://tools.ietf.org/html/rfc4648#section-5, with padding stripped.

Keywords

key

FAQs

Package last updated on 22 Oct 2014

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.