1.0.5 • Published 2 years ago

ee-crypto-encode-decode v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Crypto Service

Features

  • one library for all JS porjects for encryption/decryption
  • custom format for Crypto.js library iv,s,p
  • never same output for the encryprion
  • password param to use in multiple Projects

Installation

Install the Package via npm

npm i ee-crypto-encode-decode

In require in .js Files

const {encode,decode} = require("ee-crypto-encode-decode");
const {setPassword} = require("ee-crypto-encode-decode");

OR import in .ts Files

import {encode,decode} from "ee-crypto-encode-decode";
import {setPassword}  from "ee-crypto-encode-decode";

Set your own password one time using setPassword:

setPassword("Test1234");
once you set this you do not need to pass it every time while calling encode or decode.

Encrypt Anything:

let a = {status:200,response:[{msg:"success"}]} ;
let b = encode(a,"password"); 
Output of vaiable b will be different everytime something like this: 
{"ct":"uzMQnuhUAeuRtMhZIfqlJe3jzU/rvIy1dJBOo/FtQXL159Z9bfIXHFt/jqoYVVM9","iv":"598685f872a3931ebdce3e68a91e6bfd","s":"b9f95d15d2ca0190"}

Decrypt the Encrypted:

let c = {"ct":"uzMQnuhUAeuRtMhZIfqlJe3jzU/rvIy1dJBOo/FtQXL159Z9bfIXHFt/jqoYVVM9","iv":"598685f872a3931ebdce3e68a91e6bfd","s":"b9f95d15d2ca0190"}    // note that this format is mandatory either string or Object.

let d = decode(c,"password");
Output of variable d will be original string 
{status:200,response:[{msg:"success"}]}
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago