JSPM

compchain-crypto

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q35606F
  • License UNLICENSED

Compchain encryption library

Package Exports

  • compchain-crypto

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (compchain-crypto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

compchain-crypto

Compchain encryption library

NPM

Installation

$ npm i --save compchain-crypto

Usage

const cc = require('compchain-crypto')
const assert = require('assert')

const privkey = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
const pubkey = '03a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd'
const msgObj = {
    first_name: 'Testy',
    last_name: 'McTesterson',
    email: 'testy@gmail.com',
    phone_code: '1',
    phone: '555-555-5555',
    country: 'USA',
    dob: '1-1-1970',
}

cc.encryptData(msgObj, pubkey)
.then( ciphertext =>
{
    console.log('ciphertext', ciphertext)
    cc.decryptData(ciphertext, privkey)
    .then( msg =>
    {
        console.log('msg', msg);
        assert.equal(msg, JSON.stringify(msgObj))
    });
});