object-encrypt

1.0.2 • Public • Published

object-encrypt

// OE stands for ObjectEncrypt
const OE = require('object-encrypt');

const mySecret = 'secret123';

// Create a key based on that secret password.
const key = OE.createKey(mySecret);
// Key should not be exposed to client side or any other third party which can be malicious.

// Encrypt that secret with the key
const encrypted = OE.encrypt(mySecret, key);

// Decrypt that encrypted secret with the same key
const decrypted = OE.decrypt(encrypted, key);

// A key is both for encrypting and decrypting a secret.

Package Sidebar

Install

npm i object-encrypt

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

12.8 kB

Total Files

4

Last publish

Collaborators

  • ruzgarataozkan