This module makes encrypting and decrypting string data with a password easy by leveraging libsodium-wrappers under the hood π. It was specifically built to help with encrypting and decrypting data for NeDB π.
Wait for the library to be initialized.
Generate a key and salt using a password. If salt is not provided, a new key will be generated each time, so make sure you save the salt! Returns a object with the secret key and the salt. You should never store the secret
Encrypt a string with the key. This returns the cipher text and the header. Be sure to store the cipherText with the header or you will not be able to decrypt the data! Returns an object with the cipher text and header.
Decrypt data given a secret key, the header, and the cipher text. It returns a string containing the decrypted data.
Please take a look at the TEST to see how to use it.