How to use the chloride.crypto_sign_ed25519_sk_to_curve25519 function in chloride

To help you get started, we’ve selected a few chloride 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 ssbc / ssb-keys / index.js View on Github external
exports.unbox = function (boxed, keys) {
  boxed = u.toBuffer(boxed)

  var sk = keys._exchangeKey || sodium.crypto_sign_ed25519_sk_to_curve25519(u.toBuffer(keys.private || keys))
  if(keys.private) keys._exchangeKey = sk //if keys is an object, cache the curve key.
  try {
    var msg = pb.multibox_open(boxed, sk)
    return JSON.parse(''+msg)
  } catch (_) { }
  return
}
github ssbc / ssb-keys / index.js View on Github external
exports.unboxKey = function (boxed, keys) {
  boxed = u.toBuffer(boxed)
  var sk = sodium.crypto_sign_ed25519_sk_to_curve25519(u.toBuffer(keys.private || keys))
  return pb.multibox_open_key(boxed, sk)
}