@rojo2/password

1.1.1 • Public • Published

Password

Travis CI

Password hash library using PBKDF2.

import password from "@rojo2/password";

// Hash password
const hashedPassword = await password.hash("plainPassword")

// Verify password
const result = await password.verify("plainPassword", "hashedPassword");
if (result === true) {
  // Password is ok.
} else {
  // Passwords doesn't match.
}

Or if you prefer promises:

import password from "@rojo2/password";

// Hash password
password.hash("plainPassword").then((hashedPassword) => {
  // ... do something with the hashed password (like saving it in a mongodb object) ...
}).catch((error) => {
  // ...
});

// Verify password
password.verify("plainPassword", "hashedPassword").then((result) => {
	if (result === true) {
		// Password is ok.
	} else {
		// Passwords doesn't match.
	}
}).catch((error) => {
  // ...
});

Made with by ROJO 2 (http://rojo2.com)

Readme

Keywords

Package Sidebar

Install

npm i @rojo2/password

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

15.2 kB

Total Files

4

Last publish

Collaborators

  • aitormm
  • azazeln28