seanpmaxwell/jet-key

Generate secure keys in the Crockford alphabet

TypeScript

2

9 commits

updated Sep 26, 2026

See the code

See what people are saying

SourceMessageScoreDate

jet-key: a fast secret key generator with configurable entropy (r/webdev)

link: [https://github.com/seanpmaxwell/jet-key](https://github.com/seanpmaxwell/jet-key) # Background Suppose you need a secret key for something: it could be a session cookie, some encryption library, etc. Many people will just grab a string from some random string generator (I know I used to),…

0

Sep 26, 2026

README

✈️🔑   jet-key

npm version npm downloads License

Generate secure random secret keys in the Crockford base32 alphabet. By default, each key has 52 characters, no separators or timestamp, and 260 random bits from the platform's cryptographically secure random source.

Oh yeah, and this thing is fast, see benchmarks

· · ·

🛠️ Installation / Basic usage

npm install jet-key
import jetKey from 'jet-key';

console.log(jetKey()); // 'YFC75GX2KY5W183FRZA4XDVZ6PYDJPQT7JMNH3N7ZXPQ8FCW3M4G'

jetKey(entropy?: number): string is the default export:

import jetKey from 'jet-key';

jetKey(128); // 26 characters, 130 random bits
jetKey(256); // 52 characters, 260 random bits
jetKey(512); // 103 characters, 515 random bits
Entropy explained The alphabet is `0123456789ABCDEFGHJKMNPQRSTVWXYZ`. Keys are random and collision-resistant; uniqueness is probabilistic, not guaranteed. Node.js 20.19+ and modern browsers with Web Crypto are supported.

The optional entropy argument specifies the minimum number of random bits (default: 256). It must be an integer from 1 to 1,048,576; invalid values throw a RangeError. The upper limit bounds memory use to at most 209,716 characters per key. Each character encodes five random bits, so key length is Math.ceil(entropy / 5) and actual entropy rounds up to a multiple of five.

· · ·

📟 CLI

npx jet-key               # One 52-character secret key
npx jet-key -c 10         # Ten keys, one per line
npx jet-key --count=10    # Equivalent long option
npx jet-key --entropy 256 # One 52-character key
npx jet-key -e 128 -c 10  # Ten 26-character keys
npx jet-key --help
npx jet-key --version
FlagAliasDescription
--entropy-eAccepts the same bit count as the API and defaults to 256.
--count-cMust be a positive safe integer and defaults to 1.
--help-hMust be used alone.
--version-vMust be used alone.

· · ·

⚡ Benchmarks

Node v24.13.0; V8 13.6.233.17-node.37; darwin/arm64; Apple M4 Pro

Median of 7 samples, at least 500 ms each, after 500 ms warmup per generator.

GeneratorCharactersRandom bitsMedian ops/secns/keyRelative throughput
jetKey()5226056,269,56417.81.00x
Nano ID: Crockford, 52 chars5226026,456,54737.80.47x
crypto.randomBytes(33): base64url442641,675,458596.90.03x

· · ·

🪪 License

MIT © seanpmaxwell

Contributors

seanpmaxwell

9 commits

seanpmaxwell/jet-key

Generate secure keys in the Crockford alphabet

TypeScript

2

9 commits

updated Sep 26, 2026

See the code

See what people are saying

SourceMessageScoreDate

jet-key: a fast secret key generator with configurable entropy (r/webdev)

link: [https://github.com/seanpmaxwell/jet-key](https://github.com/seanpmaxwell/jet-key) # Background Suppose you need a secret key for something: it could be a session cookie, some encryption library, etc. Many people will just grab a string from some random string generator (I know I used to),…

0

Sep 26, 2026

README

✈️🔑   jet-key

npm version npm downloads License

Generate secure random secret keys in the Crockford base32 alphabet. By default, each key has 52 characters, no separators or timestamp, and 260 random bits from the platform's cryptographically secure random source.

Oh yeah, and this thing is fast, see benchmarks

· · ·

🛠️ Installation / Basic usage

npm install jet-key
import jetKey from 'jet-key';

console.log(jetKey()); // 'YFC75GX2KY5W183FRZA4XDVZ6PYDJPQT7JMNH3N7ZXPQ8FCW3M4G'

jetKey(entropy?: number): string is the default export:

import jetKey from 'jet-key';

jetKey(128); // 26 characters, 130 random bits
jetKey(256); // 52 characters, 260 random bits
jetKey(512); // 103 characters, 515 random bits
Entropy explained The alphabet is `0123456789ABCDEFGHJKMNPQRSTVWXYZ`. Keys are random and collision-resistant; uniqueness is probabilistic, not guaranteed. Node.js 20.19+ and modern browsers with Web Crypto are supported.

The optional entropy argument specifies the minimum number of random bits (default: 256). It must be an integer from 1 to 1,048,576; invalid values throw a RangeError. The upper limit bounds memory use to at most 209,716 characters per key. Each character encodes five random bits, so key length is Math.ceil(entropy / 5) and actual entropy rounds up to a multiple of five.

· · ·

📟 CLI

npx jet-key               # One 52-character secret key
npx jet-key -c 10         # Ten keys, one per line
npx jet-key --count=10    # Equivalent long option
npx jet-key --entropy 256 # One 52-character key
npx jet-key -e 128 -c 10  # Ten 26-character keys
npx jet-key --help
npx jet-key --version
FlagAliasDescription
--entropy-eAccepts the same bit count as the API and defaults to 256.
--count-cMust be a positive safe integer and defaults to 1.
--help-hMust be used alone.
--version-vMust be used alone.

· · ·

⚡ Benchmarks

Node v24.13.0; V8 13.6.233.17-node.37; darwin/arm64; Apple M4 Pro

Median of 7 samples, at least 500 ms each, after 500 ms warmup per generator.

GeneratorCharactersRandom bitsMedian ops/secns/keyRelative throughput
jetKey()5226056,269,56417.81.00x
Nano ID: Crockford, 52 chars5226026,456,54737.80.47x
crypto.randomBytes(33): base64url442641,675,458596.90.03x

· · ·

🪪 License

MIT © seanpmaxwell

Contributors

seanpmaxwell

9 commits

Languages

TypeScript

100.0%