@dupkey/password
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@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.

Dependencies (1)

Dev Dependencies (7)

Package Sidebar

Install

npm i @dupkey/password

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.6 kB

Total Files

9

Last publish

Collaborators

  • nicgene