hashed-password
v1.1.0
Published
A simple TS package used for hashed password generation and verification
Downloads
10
Readme
Hashed Password
A simple package to hash passwords and verify if the password and hash match
Installation
yarn add hashed-password
Ussage
import { validatePassword, hashPassword, randomPassword } from "hashed-password"
const {hash, salt} = hashPassword("YOUR PASSWORD");
const isValid = validatePassword("YOUR PASSWORD", salt, hash);
const securePass = randomPassword(10,{numbers: false, symbols: false})
Demo
Demo : Demo Url
React Sample: Code Sandbox
Functions
Typedefs
validatePassword(inputPassword, salt, storedHash) ⇒ boolean
Given an input password a salt and an hash Does the given password mathc with the hash
Kind: global function
Returns: boolean - does hash(input Password + salt ) === storedHash?
| Param | Type | | --- | --- | | inputPassword | string | | salt | string | | storedHash | string |
hashPassword(password) ⇒ HashAndSalt
Given a Password and hash it with a salt, then return the hash and the salt
Kind: global function
Returns: HashAndSalt - object containing the hash and the salt usedP
| Param | Type | | --- | --- | | password | string |
randomPassword(length, options) ⇒ string
Returns a random password based on given params
Kind: global function
| Param | Type | | --- | --- | | length | number | | options | passwordOptions |
HashAndSalt : Object
Kind: global typedef
Properties
| Name | Type | Description | | --- | --- | --- | | hash | string | The hash we got | | salt | string | The salt used for hashing |