easecrypto
v1.0.2
Published
cipher/decipher files and private keys easily
Downloads
1
Maintainers
Readme
Easecrypto package
A package to help you encrypt/decrypt files and strings with simple functions
Installation
Install via npm
$ npm install easecrypto
How to use
import the functions you need
const {fileEncryptor, fileDecryptor, keyEncryptor, keyDecryptor} = require('easecrypto')
Functions
File Encryptor
Example
fileEncryptor('./src.json', './dist.ms', privateKey,'r', ((data, err) => {
if(err){
console.error(err);
}else{
console.log(data);
}
}))
Functions parameters
Troubleshooting
make sure you pass the flag parameter! pass 'r' or null. Otherwise it will throw an error.
fileEncryptor('./src.json', './dist.ms', privateKey,null, ((data, err) => {
if(err){
console.error(err);
}else{
console.log(data);
}
}))
File Decryptor
Example
fileDecryptor('./dist.ms', './new.json', privateKey, (res => {
console.log(res);
}))
Functions parameters
Troubleshooting
make sure you pass the destination path parameter! either a path value or null. Otherwise it will throw an error.
fileDecryptor('./dist.ms', null, privateKey, (res => {
console.log(res);
}))
Key Encryptor
Example
const encryptedKey = keyEncryptor("secret password", privateKey)
Functions parameters
Key Decryptor
Example
const decryptedKey = keyDecryptor(encryptedKey, privateKey)