eos-communication-lib
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

EOS Communication

This library allows to encrypt messages on the EOS platform, using the AES shared key encryption algorithm.

Decryption is achieved by combining the receiver's private key and the sender's public key to create the private key necessary to decrypt the message.

This module uses eosjs-ecc to perform the required cryptographic operations.

Install

npm

$ npm install --save eos-communication-lib

Usage

import { encrypt, decrypt } from 'eos-communication-lib';

const public_key = "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV";
const private_key = "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3";

const message = "Private Message, shhhh!";
const encrypted = encrypt(private_key, public_key, message);
// => TO DECRYPT: eos-communication
// .1167451677...23460624..862584768Q+h1AeLQbjfzZJD1Nsx6kk3U/jSNStwoWstz9uNCadw=

const decrypted = decrypt(private_key, public_key, encrypted);
// => Private Message, shhhh!

API

Table of Contents

encrypt

Encrypt Message

Parameters

  • private_key string EOSIO Private Key
  • public_key string EOSIO Public Key
  • message string Message to Encrypt
  • maxsize number Maximum character message size (optional, default 256)

Examples

const encrypted = encrypt(private_key, public_key, message);

Returns string Encrypted Message

decrypt

Decrypt Message

Parameters

  • private_key string EOSIO Private Key
  • public_key string EOSIO Public Key
  • message string Encrypted Message

Examples

const decrypted = decrypt(private_key, public_key, message);

Returns string Decrypted Message

Readme

Keywords

none

Package Sidebar

Install

npm i eos-communication-lib

Weekly Downloads

3

Version

0.2.1

License

MIT

Unpacked Size

8.16 kB

Total Files

5

Last publish

Collaborators

  • deniscarriere