1.0.2 • Published 1 year ago

easecrypto v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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)

Functions parameters

1.0.2

1 year ago

1.0.1

2 years ago

1.0.0

2 years ago