@dupkey/password
v1.0.2
Published
Password hashing, validating and rehashing.
Downloads
1
Maintainers
Readme
@dupkey/password
Password hashing, validating and rehashing. Implements bcrypt.js..........
Install
npm install @dupkey/password
Example
Create a new password object.
let password = new Password(password: string);
Get the password hash.
let hash = password.getHash(int $algo = PASSWORD_DEFAULT, array $options = []);
Validate a given hash matches a password.
if (password.valid(hash: string)) {};
"Checks to see if the supplied hash implements the algorithm and options provided." (not implemented yet)
if (password.needsRehash(hash: string, algo: int = PASSWORD_DEFAULT, options Array = [])) {}
Build the TypeScript and JavaScript versions
npm run build
Run the tests
npm test
VS Code Debugging
Create a launch.json
file in your .vscode folder with the following:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--require", "ts-node/register",
"-u", "tdd",
"--timeout", "999999",
"--colors", "--recursive",
"${workspaceFolder}/test/**/*.ts"
],
"internalConsoleOptions": "openOnSessionStart"
}
]
}
In the debug tab (Ctrl+Shift+D) select "Mocha Tests" from the dropdown and then click "Start Debugging". Results will display in the console on the bottom of the VS Code.