2.2.0 • Published 2 years ago

firebase-scrypt v2.2.0

Weekly downloads
358
License
MIT
Repository
github
Last release
2 years ago

Node Firebase Scrypt

NodeJs implementation of Firebase's Scrypt modified version

Table of Contents

Install

To install, run :

npm i firebase-scrypt

Usage

Firebase parameters

Go to Firebase to get your hash parameters. To access these parameters, navigate to the 'Users' tab of the 'Authentication' section in the Firebase Console and select 'Password Hash Parameters' from the drop down in the upper-right hand corner of the users table.

Initialisation

import { FirebaseScrypt } from 'firebase-scrypt'

const firebaseParameter = {
  memCost: 1, // replace by your
  rounds: 1, // replace by your
  saltSeparator: 'your-separator', // replace by your 
  signerKey: 'your-key', // replace by your
}

const scrypt = new FirebaseScrypt(firebaseParameters)

Hash

[...]

const password = "test"
const salt = "salt"

scrypt.hash(password, salt)
  .then(hash => console.log(hash))

Verify

[...]

const password = "test"
const salt = "salt"
const hash = "PrZI5nfqjOEk"

scrypt.verify(password, salt, hash)
  .then(isValid => isValid ? console.log('Valid !') : console.log('Not valid !'))

Test

To test, run :

npm run test

2.2.0

2 years ago

2.1.0

3 years ago

2.0.0

4 years ago

1.0.8

4 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago