JSPM

crypto-server-client

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q9581F
  • License ISC

ECDH methods to encode-decode json object from client to server

Package Exports

  • crypto-server-client

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 (crypto-server-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);