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.
npm install @catalogfi/encryptoEncrypto 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.
```
npm install @catalogfi/encrypto
NOTE: If you are using this in browser environment, you need to use a bundler which supports node polyfills.
`
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);
`
`
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")
``