@catalogfi/encrypto
v0.1.5
Published
Encrypto is a simple encryption lib that uses the AES-256-CBC algorithm to encrypt and decrypt data using a key generated with a password and a salt.
Downloads
37
Keywords
Readme
Encrypto
Encrypto is a simple encryption lib that uses the AES-256-CBC algorithm to encrypt and decrypt data using a key generated with a password and a salt.
Installation
npm install @catalogfi/encrypto
NOTE: If you are using this in browser environment, you need to use a bundler which supports node polyfills.
Usage of Encrypto
import Encrypto from 'encrypto';
const { key, salt, encryptedData } = Encrypto.encrypt(_data, _password);
const { decryptedData } = Encrypto.decrypt(encryptedData,_password,salt);
You can also decrypt using the key and salt
const { key, salt, encryptedData } = Encrypto.encrypt(_data, _password);
const { decryptedData } = Encrypto.decryptWithKey(encryptedData,key,salt);
Usage of Vault
import { Vault, ChromeExtensionStorage } from 'encryto';
const storage = new ChromeExtensionStorage();
const vault = new Vault(storage);
await vault.lock({test:"test"}, "password");
// Unlocks the vault using the token
const data = await vault.unlock()
// Unlocks the vault using the password
const data = await vault.unlock("password")