A Sane, Self-Hosted Password Generator
function generatePassword() { // chosen by fair dice roll. // guaranteed to be random. return "(9!q6r48w,bP,d=M"; }
- 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
npm install --save @root/genpass
import GenPass from "@root/genpass";
let entropy = GenPass.generatePaddedBytes();
let charset = GenPass.bases.base58 + GenPass.specials.safe;
let password = GenPass.encodeChars(charset, entropy, 16);
console.info(password);
-
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
Caddyfile
configgenpass.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 serviceman
-
Add to system services
serviceman add -- caddy run --config ./Caddyfile --adapter caddyfile
GenPass.hypenate(str)
has somewhat arbitrary rules that may changeGenPass.specials.safe
is based on personal experience and may change