![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
password-generator-js
Advanced tools
A random password generator for node and browsers, which makes it possible to choose random-function. It either creates passwords using combinations of characters, digits and symbols, or from words (english or spanish currently).
npm install password-generator-js
const PasswordGenerator = require('password-generator-js')
let password = PasswordGenerator.generatePassword([options, [randomFunction]])
<script src="path/to/module/index.js"></script>
let password = PasswordGenerator.generatePassword([options, [randomFunction]])
password = PasswordGenerator.generatePassword([options, [randomFunction]])
It is possible to specifiy random function. The function should take no arguments and return a value between 0 and 1.
password = PasswordGenerator.generatePassword(options, randomFunction[, callback])
password = PasswordGenerator.generatePassword({ length: 20 }, c => {
let RandomOrg = require('random-org')
let random = new RandomOrg({ apiKey: '12345-67890-api-key' })
random.generateDecimalFractions()
.then(result => {
c(result.random.data[0])
});
}).then(console.log.bind(console))
password = PasswordGenerator.generatePassword({ length: 20 }, () => {
let RandomOrg = require('random-org')
let random = new RandomOrg({ apiKey: '12345-67890-api-key' })
return random.generateDecimalFractions()
.then(result => result.random.data[0]);
}).then(console.log.bind(console))
The random function should take a callback as argument and call it with the result or take no argument and return a promise which resolves with the result.
{
length: 25,
uppercase: true,
lowercase: true,
digits: true,
symbols: true,
obscureSymbols: true,
extra: ''
}
Extra symbols can be used to add possible characters to the algorithm.
password = PasswordGenerator.generatePassword([options, [randomFunction]])
password = PasswordGenerator.generatePassword(options, randomFunction[, callback])
.then(callback)
let passwordGenerator = new PasswordGenerator([options, [randomFunction]])
passwordGenerator.options = { ... }
passwordGenerator.random = () => { ... }
password = passwordGenerator.generatePassword([options, [randomFunction]])
password = passwordGenerator.generatePassword(options, [randomFunction[, callback]])
.then(callback)
Both english and spanish is currently available
password = PasswordGenerator.generatePasswordFromWords([length[, language]])
Language is specified as a string such as 'english' or 'spanish'.
<script src="path/to/module/words/english.js"></script>
<script src="path/to/module/words/spanish.js"></script>
password = PasswordGenerator.generatePasswordFromWords([length[, language]])
Language is specified as a string such as 'english' or 'spanish'.
FAQs
A password generator for both node and browsers
The npm package password-generator-js receives a total of 39 weekly downloads. As such, password-generator-js popularity was classified as not popular.
We found that password-generator-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.