soteria-fe
v1.0.1
Published
A file encryption package for node
Downloads
9
Maintainers
Readme
soteria-fe
An easy to use file encryption package for nodejs.
Installation
npm i soteria-fe
Quick Start
const fe = require("soteria-fe");
Async Encryption
encrypt(file-path, password, options) returns a promise which resolves with an object containing the salt and iv used to encrypt the file.
const fe = require("soteria-fe");
fe.encrypt(<file path>, <password>, options).then(({ salt, iv }) => { // Code goes here});
Sync Encryption
encryptSync(file-path, password, options) returns an object containing the salt and iv used to encrypt the file.
const fe = require("soteria-fe");
const { salt, iv } = fe.encryptSync(<file path>, <password>, options);
Async Decryption
decrypt(file-path, password, options) returns a promise.
const fe = require("soteria-fe");
fe.decrypt(<file path>, <password>, options).then(() => { // Code goes here});
Sync Decryption
decryptSync(file-path, password, options) returns nothing.
const fe = require("soteria-fe");
fe.decryptSync(<file path>, <password>, options);
Options
| Name | Description | |------|-------------| | bytes | Specify the number of bytes to be used to make the salt. Default:- 16 | | algorithm | Specify the algorithm to encrypt/decrpyt a file. Default:- aes-192-cbc | | iv | Specify the Initialisation Vector. | | salt | Specify the salt to make the cipher. | | keylen | Specify the length(in bytes) of the key used to make cipher. Default: 24 | | length | Specify the length of iv. Default:- 16 | | outputPath | Specify the output file name. |