crypto-server-client

1.0.1 • Public • Published

How to use:

const { genKeysHex, dataEncode , dataDecode } = require('crypto-server-client');

// Create keys const server= genKeysHex(); console.log('server:', server)

const client = genKeysHex(); console.log('client:', client)

// Server To Client, encode const serverPrivateKeyHex = server.pivateKey; const clientPublicKeyHex = client.publicKey;

// JSON Message const MESSAGE = JSON.stringify({ name: '1234', data: 'data' });

const payload64 = dataEncode(serverPrivateKeyHex , clientPublicKeyHex, MESSAGE); console.log('payload64:', payload64) // - - - - - - - - - - -

// Client decode const clientPrivateKeyHex = client.pivateKey; const serverPublicKeyHex = server.publicKey; const msg = dataDecode(clientPrivateKeyHex, serverPublicKeyHex, payload64); const JsonMsg = JSON.parse(msg); console.log('JsonMsg:', JsonMsg);

Readme

Keywords

Package Sidebar

Install

npm i crypto-server-client

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

4.77 kB

Total Files

4

Last publish

Collaborators

  • ri.saldias