Guillaume Vincent ae7a85b5ea | 8 anos atrás | |
---|---|---|
dist | 8 anos atrás | |
src | 8 anos atrás | |
tests | 8 anos atrás | |
.gitignore | 8 anos atrás | |
.npmignore | 8 anos atrás | |
.travis.yml | 8 anos atrás | |
license | 8 anos atrás | |
package.json | 8 anos atrás | |
readme.md | 8 anos atrás | |
webpack.config.js | 8 anos atrás |
core library for LessPass password manager in node.js used to generate unique password
npm install lesspass
var lesspass = require('lesspass');
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var site = 'lesspass.com';
var options = {
counter: 1,
password: {
length: 12,
settings: ['lowercase', 'uppercase', 'numbers', 'symbols']
}
};
lesspass.generatePassword(login, masterPassword, site, options).then(function (generatedPassword) {
console.log(generatedPassword) //azYS7,olOL2]
});
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="lesspass.min.js"></script>
<script>
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var site = 'lesspass.com';
var options = {
counter: 1,
password: {
length: 12,
settings: ['lowercase', 'uppercase', 'numbers', 'symbols']
}
};
lesspass.generatePassword(login, masterPassword, site, options).then(function (generatedPassword) {
console.log(generatedPassword) //azYS7,olOL2]
});
</script>
</body>
</html>
generatePassword(login, masterPassword, site, options)
generate unique password based on login, masterPassword, site and options.
paramaters :
login
: stringmasterPassword
: stringsite
: stringcounter
: integer (default: 1)password.length
: integer between 6 and 64 (default: 12)password.settings
: array of string in lowercase
, uppercase
, numbers
or symbols
(default: ['lowercase', 'uppercase', 'numbers', 'symbols']
)exemple :
var options = {
counter: 2,
password: {
length: 14,
settings: ['lowercase', 'uppercase', 'numbers']
}
};
return:
promise with generated password
lesspass.generatePassword(login, masterPassword, site, options) .then(function (generatedPassword) { console.log(generatedPassword); }) .catch(function (error) { console.log(error); });
see tests/api.tests.js for more examples
npm test
see LessPass project