1.0.0 • Published 1 year ago
@root/genpass v1.0.0
genpass.js
A Sane, Self-Hosted Password Generator
function generatePassword() { // chosen by fair dice roll. // guaranteed to be random. return "(9!q6r48w,bP,d=M"; }
Features
- Sane defaults (Base58 + Safe special characters)
- Options for Base62, Base58, Base36, Base32 (Crockford), and Hex
- or use your own custom character set
- Choose which special characters
- Choose length by Character count or Bit entropy
JavaScript
npm install --save @root/genpassimport GenPass from "@root/genpass";
let entropy = GenPass.generateBytes();
let charset = GenPass.bases.base58 + GenPass.specials.safe;
let password = GenPass.encodeChars(charset, entropy, 16);
console.info(password);Self-Host
- Clone to your sites directory
mkdir -p ./srv/www/ pushd ./srv/www/ git clone https://github.com/bnnanet/genpass.js.git \ --branch gh-pages --depth 1 \ ./genpass.example.com Add to your
Caddyfileconfiggenpass.example.com { encode gzip zstd file_server { root ./genpass.example.com/ } }Install caddy and serviceman, if needed
curl https://webinstall.dev/webi | sh source ~/.config/envman/PATH.env webi caddy servicemanAdd to system services
serviceman add -- caddy run --config ./Caddyfile --adapter caddyfile
API Notes
GenPass.hypenate(str)has somewhat arbitrary rules that may changeGenPass.specials.safeis based on personal experience and may change
1.0.0
1 year ago