-
Notifications
You must be signed in to change notification settings - Fork 0
Crypto Provider
Danny SMc edited this page Oct 21, 2020
·
8 revisions
The CryptoProvider is a built-in provider that comes as part of the package, this is to offer additional helper functionality to easily add to your platform. The provider comes with password hashing and validation using PBKDF2 and also offers AES encryption and decryption functionality.
Below defines the available methods:
Method | Description | Parameters | Result |
---|---|---|---|
hashPassword |
This function takes the plain text password, and will hash it using the PBKDF2 methods native to Node.JS and then respond with an available hash. | password[string] | Promise<string> |
validatePassword |
This function will take the user given password as plain text, then the hashed password that exists, and it will verify whether it is the same password. | password[string], hashed_password[string] | Promise<boolean> |
encrypt |
This function will take a key (as a password) and the data as a string, and then will encrypt it using the AES-128-CBC method and will return the result. | key[string], data[string] | Promise<string> |
decrypt |
This function will take a key (the password used to encrypt) and the existing encrypted data, and then it will use the same encryption method to decrypt the data and pass that back. | key[string], data[string] | Promise<string> |