How to use eciesjs - 2 common examples

To help you get started, we’ve selected a few eciesjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TradaTech / icetea / web / playground.js View on Github external
function doDecrypt (privateKey, cipherText) {
  const plainText = decrypt(
    privateKey.toString('hex'),
    Buffer.from(cipherText, 'base64')
  ).toString()
  try {
    return JSON.parse(plainText)
  } catch (e) {
    console.warn(e)
    return plainText
  }
}
github TradaTech / icetea / web / bot.js View on Github external
function doEncrypt (msg, bufKey) {
  if (msg == null) return msg
  if (typeof msg !== 'string') {
    try {
      msg = JSON.stringify(msg)
    } catch (e) {
      console.warn(e)
      msg = String(msg)
    }
  }
  return ecencrypt(bufKey.toString('hex'), Buffer.from(msg)).toString('base64')
}

eciesjs

Elliptic Curve Integrated Encryption Scheme for secp256k1/curve25519

MIT
Latest version published 4 months ago

Package Health Score

74 / 100
Full package analysis

Popular eciesjs functions