Gathering detailed insights and metrics for micro-key-producer
Gathering detailed insights and metrics for micro-key-producer
Gathering detailed insights and metrics for micro-key-producer
Gathering detailed insights and metrics for micro-key-producer
Produces secure keys and passwords. Supports SSH, PGP, BLS, OTP and many other formats
npm install micro-key-producer
Typescript
Module System
Node Version
NPM Version
88.5
Supply Chain
99.2
Quality
79.8
Maintenance
100
Vulnerability
100
License
TypeScript (86.88%)
JavaScript (13.12%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
63 Stars
150 Commits
13 Forks
2 Watchers
2 Branches
5 Contributors
Updated on Jul 07, 2025
Latest Version
0.7.6
Package Id
micro-key-producer@0.7.6
Unpacked Size
407.82 kB
Size
72.41 kB
File Count
95
NPM Version
10.9.2
Node Version
22.13.0
Published on
Apr 24, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
Produces secure keys and passwords.
Used in: terminal7 WebRTC terminal multiplexer.
npm install micro-key-producer
jsr add jsr:@paulmillr/micro-key-producer
1import ssh from 'micro-key-producer/ssh.js'; 2import pgp from 'micro-key-producer/pgp.js'; 3import * as pwd from 'micro-key-producer/password.js'; 4import * as otp from 'micro-key-producer/otp.js'; 5import tor from 'micro-key-producer/tor.js'; 6import ipns from 'micro-key-producer/ipns.js'; 7import slip10 from 'micro-key-producer/slip10.js'; 8import { randomBytes } from 'micro-key-producer/utils.js';
Every method takes a seed (key), from which the formatted result is produced.
A seed can be known (a.k.a. deterministic - it will always produce the same result), or random.
1// known: (deterministic) Uses known mnemonic (handled in separate package) 2import { mnemonicToSeedSync } from '@scure/bip39'; 3const mnemonic = 'letter advice cage absurd amount doctor acoustic avoid letter advice cage above'; 4const knownSeed = mnemonicToSeedSync(mnemonic, ''); 5 6// random: Uses system's CSPRNG to produce new random seed 7import { randomBytes } from 'micro-key-producer/utils.js'; 8const randSeed = randomBytes(32);
1import ssh from 'micro-key-producer/ssh.js'; 2import { randomBytes } from 'micro-key-producer/utils.js'; 3 4const seed = randomBytes(32); 5const key = ssh(seed, 'user@example.com'); 6console.log(key.fingerprint, key.privateKey, key.publicKey); 7// SHA256:3M832z6j5R6mQh4TTzVG5KVs2Ibvy... 8// -----BEGIN OPENSSH PRIVATE KEY----- ... 9// ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...
The PGP (GPG) keys conform to RFC 4880 & RFC 6637. Only ed25519 algorithm is currently supported.
1import pgp, { getKeyId } from 'micro-key-producer/pgp.js'; 2import { randomBytes } from 'micro-key-producer/utils.js'; 3 4const seed = randomBytes(32); 5const email = 'user@example.com'; 6const pass = 'password'; 7const createdAt = Date.now(); // optional; timestamp >= 0 8 9const keyId = getKeyId(seed); 10const key = pgp(seed, email, pass, createdAt); 11console.log(key.fingerprint, key.privateKey, key.publicKey); 12// ca88e2a8afd9cdb8 13// -----BEGIN PGP PRIVATE KEY BLOCK-----... 14// -----BEGIN PGP PUBLIC KEY BLOCK-----...
1import { mnemonicToSeedSync } from '@scure/bip39'; 2import { createDerivedEIP2334Keystores } from 'micro-key-producer/bls.js'; 3 4const password = 'my_password'; 5const mnemonic = 'letter advice cage absurd amount doctor acoustic avoid letter advice cage above'; 6const keyType = 'signing'; // or 'withdrawal' 7const indexes = [0, 1, 2, 3]; // create 4 keys 8 9const keystores = createDerivedEIP2334Keystores( 10 password 11 'scrypt', 12 mnemonicToSeedSync(mnemonic, ''), 13 keyType, 14 indexes 15);
Conforms to EIP-2333 / EIP-2334 / EIP-2335. Online demo: eip2333-tool
1import * as pwd from 'micro-key-producer/password.js'; 2import { randomBytes } from '@noble/hashes/utils'; 3 4const seed = randomBytes(32); 5const pass = pwd.secureMask.apply(seed).password; 6// wivfi1-Zykrap-fohcij, will change on each run 7// secureMask is format from iOS keychain, see "Detailed API" section
Supports iOS / macOS Safari Secure Password from Keychain. Optional zxcvbn score for password bruteforce estimation
1import * as otp from 'micro-key-producer/otp.js'; 2otp.hotp(otp.parse('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS'), 0n); // 549419 3otp.totp(otp.parse('ZYTYYE5FOAGW5ML7LRWUL4WTZLNJAMZS'), 0); // 549419
Conforms to RFC 6238.
1import tor from 'micro-key-producer/tor.js'; 2import { randomBytes } from 'micro-key-producer/utils.js'; 3const seed = randomBytes(32); 4const key = tor(seed); 5console.log(key.privateKey, key.publicKey); 6// ED25519-V3:EOl78M2gA... 7// rx724x3oambzxr46pkbd... .onion
1import ipns from 'micro-key-producer/ipns.js'; 2import { randomBytes } from 'micro-key-producer/utils.js'; 3const seed = randomBytes(32); 4const k = ipns(seed); 5console.log(k.privateKey, k.publicKey, k.base16, k.base32, k.base36, k.contenthash); 6// 0x080112400681d6420abb1b... 7// 0x017200240801122012c829... 8// ipns://f0172002408011220... 9// ipns://bafzaajaiaejcaewi... 10// ipns://k51qzi5uqu5dgnfwb... 11// 0xe501017200240801122012...
1import slip10 from 'micro-key-producer/slip10.js'; 2import { randomBytes } from 'micro-key-producer/utils.js'; 3 4const seed = randomBytes(32); 5const hdkey1 = slip10.fromMasterSeed(seed); 6 7// props 8[hdkey1.depth, hdkey1.index, hdkey1.chainCode]; 9console.log(hdkey2.privateKey, hdkey2.publicKey); 10console.log(hdkey3.derive("m/0/2147483647'/1'")); 11const sig = hdkey3.sign(hash); 12hdkey3.verify(hash, sig);
SLIP10 (ed25519 BIP32) HDKey implementation has been funded by the Kin Foundation for Kinetic.
1import * as pgp from 'micro-key-producer/pgp'; 2import { randomBytes } from 'micro-key-producer/utils'; 3const pseed = randomBytes(32); 4pgp.getKeyId(pseed); // fast 5const pkeys = pgp.getKeys(pseed, 'user@example.com', 'password'); 6console.log(pkeys.keyId); 7console.log(pkeys.privateKey); 8console.log(pkeys.publicKey); 9 10// Also, you can explore existing keys internal structure 11console.log(pgp.pubArmor.decode(keys.publicKey)); 12const privDecoded = pgp.privArmor.decode(keys.privateKey); 13console.log(privDecoded); 14// And receive raw private keys as bigint 15console.log({ 16 ed25519: pgp.decodeSecretKey('password', privDecoded[0].data), 17 cv25519: pgp.decodeSecretKey('password', privDecoded[3].data), 18});
1import * as pwd from 'micro-key-producer/password.js'; 2console.log(pwd.secureMask.estimate); 3 4// Output 5{ 6 score: 'somewhat guessable', // ZXCVBN Score 7 // Guess times 8 guesses: { 9 online_throttling: '1y 115mo', // Throttled online attack 10 online: '1mo 10d', // Online attack 11 // Offline attack (salte, slow hash function like bcrypt, scrypt, PBKDF2, argon, etc) 12 slow: '57min 36sec', 13 fast: '0 sec' // Offline attack 14 }, 15 // Estimated attack costs (in $) 16 costs: { 17 luks: 1.536122841572242, // LUKS (Linux FDE) 18 filevault2: 0.2308740987992559, // FileVault 2 (macOS FDE) 19 macos: 0.03341598798410283, // MaccOS v10.8+ passwords 20 pbkdf2: 0.011138662661367609 // PBKDF2 (PBKDF2-HMAC-SHA256) 21 } 22}
Mask | Description | Example |
---|---|---|
1 | digits | 4, 7, 5, 0 |
@ | symbols | !, @, %, ^ |
v | vowels | a, e, i |
c | consonant | b, c, d |
a | letter (vowel or consonant) | a, b, e, c |
V | uppercase vowel | A, E, I |
C | uppercase consonant | B, C, D |
A | uppercase letter | A, B, E, C |
l | lower and upper case letters | A, b, C |
n | same as 'l', but also digits | A, 1, b, 2, C |
* | same as 'n', but also symbols | A, 1, !, b, @ |
s | syllable (same as 'cv') | ca, re, do |
S | Capitalized syllable (same as 'Cv) | Ca, Ti, Je |
All other characters used as is |
Examples:
Cvccvc-cvccvc-cvccv1
will generate Mavmuq-xadgys-poqsa5
@Ss-ss-ss
will generate: *Tavy-qyjy-vemo
Most strict password rules (so password will be accepted everywhere):
********
, since it can generate passwords which won't satisfy these rules.******
mask, we need to calculate entropy for specific mask (which is smaller).SLIP-0010 hierarchical deterministic (HD) wallets for implementation. Based on code from scure-bip32. Check out scure-bip39 if you also need mnemonic phrases.
.publicKeyRaw
getterparentFingerprint
m/0/1
) as hardened (m/0'/1'
). If you want this behaviour, there is a flag
forceHardened
in derive
methodNote: chainCode
property is essentially a private part of a secret "master" key, it should be
guarded from unauthorized access.
The full API is:
1class HDKey { 2 public static HARDENED_OFFSET: number; 3 public static fromMasterSeed(seed: Uint8Array | string): HDKey; 4 5 readonly depth: number = 0; 6 readonly index: number = 0; 7 readonly chainCode: Uint8Array | null = null; 8 readonly parentFingerprint: number = 0; 9 public readonly privateKey: Uint8Array; 10 11 get fingerprint(): number; 12 get fingerprintHex(): string; 13 get parentFingerprintHex(): string; 14 get pubKeyHash(): Uint8Array; 15 get publicKey(): Uint8Array; 16 get publicKeyRaw(): Uint8Array; 17 18 derive(path: string, forceHardened = false): HDKey; 19 deriveChild(index: number): HDKey; 20 sign(hash: Uint8Array): Uint8Array; 21 verify(hash: Uint8Array, signature: Uint8Array): boolean; 22}
MIT (c) Paul Miller (https://paulmillr.com), see LICENSE file.
No vulnerabilities found.
No security vulnerabilities found.