2.3.0 • Published 2 years ago

@ibnlanre/cipher v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@ibnlanre/cipher

TypeScript code style: prettier version

for AES encryption or decryption

Install

To use, you'll need to install Node and Yarn or npm

  • NPM

    npm i @ibnlanre/cipher
  • YARN

    yarn add @ibnlanre/cipher

Import

  • ES6 Import

    import Cipher from "@ibnlanre/cipher";
  • NodeJS Require

    const Cipher = require("@ibnlanre/cipher").default;

Usage

  • Instantiate

    const encryption_key = Cipher.generateRandomKey(256);
    const initialization_vector = Cipher.generateRandomKey(128);
    
    const cipher = new Cipher({
      initialization_vector,
      algorithm: "aes-256-cbc",
      output_decoding: "base64",
      input_encoding: "utf-8",
      encryption_key,
    });
  • Destructure

    const { encrypt, decrypt } = cipher;
  • Utilize

    const formData = { example: "fooBar" };
    const encryptedData = encrypt(formData);
    const decryptedData = decrypt(encryptedData);

Maintainers

2.3.0

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago