1.1.1 • Published 6 years ago

@rojo2/password v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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)