
sspg.js is a lightweight JavaScript library for generating strong passwords without sacrificing control.
You can define character sets, and choose between standard and cryptographically secure random number generation.
Features:
- Generates strong passwords of a specified length.
- Offers a compact string-based configuration format.
- Provides both regular and cryptographically secure random generation.
- Uses easy-to-remember character codes (e.g., `0` for digits, `a` for lowercase).
- Includes escape characters for literal inclusion of special characters.
How to use it:
1. Install ‘sspg.js’ via NPM:
# NPM $ npm install sspg
2. Import the gen or gens function:
import { gen, gens } from "sspg";3. Generate a 12-character password with digits, lowercase, and uppercase letters. Configuration String Characters:
0: Digits (0-9)a: Lowercase letters (a-z)A: Uppercase letters (A-Z)-or_: The characters-and_.: Special characters:!@#$%^&*,.;:/?+=[or]: Bracket characters:()[]{}<>|'”~c: Escape character. The following character is added directly to the character set.s: Use the cryptographically secure random number generator.u: Use the standard (Math.random()) random number generator.
const password = gen("0aA", 12);
// 2hVwVKhi31v2
console.log(password);4. Generate a 12-character cryptographically secure password:
const password = gens("0aA", 12);
// Example: PaSnA1r0CesB
console.log(password);5. Available configs:
const password = gen({
characters: string;
safe?: boolean;
}, 12);






