An open API service indexing awesome lists of open source software.

https://github.com/mrvsik/soteria-fe

Package designed to encrypt and decrypt files easily
https://github.com/mrvsik/soteria-fe

crypto-js nodejs npm-package typescript

Last synced: 3 months ago
JSON representation

Package designed to encrypt and decrypt files easily

Awesome Lists containing this project

README

        

# soteria-fe
An easy to use file encryption package for nodejs.

## Installation
```bash
npm i soteria-fe
```

## Quick Start
```js
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.
```js
const fe = require("soteria-fe");
fe.encrypt(, , 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.
```js
const fe = require("soteria-fe");
const { salt, iv } = fe.encryptSync(, , options);
```
## Async Decryption
**decrypt(file-path, password, options)** returns a **promise**.
```js
const fe = require("soteria-fe");
fe.decrypt(, , options).then(() => { // Code goes here});
```
## Sync Decryption
**decryptSync(file-path, password, options)** returns nothing.
```js
const fe = require("soteria-fe");
fe.decryptSync(, , 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. |