How to use the libsodium-wrappers-sumo.crypto_sign_verify_detached function in libsodium-wrappers-sumo

To help you get started, we’ve selected a few libsodium-wrappers-sumo 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 zcash-hackworks / zcash-primitives-js / src / transaction_helper.js View on Github external
TransactionHelper.prototype.signShielded = function (signatureHashFn) {
  // Empty output script
  var scriptCode = Buffer.alloc(0)
  var dataToBeSigned = signatureHashFn(NOT_AN_INPUT, scriptCode, SIGHASH_ALL)

  // Add the signature
  this.joinSplitSig = Buffer.from(sodium.crypto_sign_detached(dataToBeSigned, this._joinSplitPrivKey))

  // Sanity check
  sodium.crypto_sign_verify_detached(this.joinSplitSig, dataToBeSigned, this.joinSplitPubKey)
}
github wireapp / wire-web-packages / packages / proteus / src / main / keys / PublicKey.ts View on Github external
verify(signature: Uint8Array, message: Uint8Array): boolean {
    return sodium.crypto_sign_verify_detached(signature, message, this.pub_edward);
  }
github wireapp / wire-web-packages / packages / proteus / src / main / keys / PublicKey.ts View on Github external
verify(signature: Uint8Array, message: Uint8Array | string): boolean {
    return sodium.crypto_sign_verify_detached(signature, message, this.pub_edward);
  }
github auth0 / magic / magic.js View on Github external
cb   = ispk;
    ispk = false;
  }
  const done = ret(cb);

  if (!pk) { return done(new Error('Cannot verify without a key')); }

  let payload, received, ipk;
  [ payload ]      = iparse(message);
  [ pk, received ] = cparse(pk, signature);

  ipk = (ispk) ? pk : sodium.crypto_sign_seed_keypair(pk).publicKey;

  let verified;
  try {
    verified = sodium.crypto_sign_verify_detached(received, payload, ipk);
  } catch(ex) {
    return done(new Error('Libsodium error: ' + ex));
  }

  if (!verified) { return done(new Error('Invalid signature')); }

  return done();
}