Skip to content

BarryCarlyon/quickpassword

Repository files navigation

A very very quick and dirty password encrypter using bcrypt based on this Stackoverflow Question

Updating node

If you update Node, you will need to run npm install in order to rebuild this module.

Notes

A note from the bcrypt readme

A library to help you hash passwords.

You can read about bcrypt in Wikipedia as well as in the following article: How To Safely Store A Password

ESM

I mean conceptually under ESM, this library is over kill....

import { cryptPassword, comparePassword } from "quickpassword";

let passwordValid = await comparePassword(
    plain_text_input,
    encrypted_password_from_storage
);

let passwordToStore = await cryptPassword(
    plain_text_input
);

CommonJS

Comparison

const quickpassword = require("quickpassword");

quickpassword.comparePassword(
    input_string,
    encrypted_password_from_db,
    (err, isMatch) => {
        if (err) {
            console.log("Password Err");
        } else {
            if (isMatch) {
                // passwords Match
            } else {
                // passwords do not match
            }
        }
    }
);

Generation (for storage)

const quickpassword = require("quickpassword");

quickpassword.cryptPassword(entry, (err, ret) => {
    if (err) {
        console.log("Failed");
    } else {
        // ret contains encrypted password for storage
    }
});

Upgrading node

If/when you upgrade node, this module (well bcrypt) will need to be recompiled, npm rebuild should get you going!


About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published

Contributors 2

  •  
  •