How to use the libsodium-wrappers-sumo.crypto_sign_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 / SecretKey.ts View on Github external
sign(message: Uint8Array | string): Uint8Array {
    return sodium.crypto_sign_detached(message, this.sec_edward);
  }
github wireapp / wire-web-packages / packages / proteus / src / main / keys / SecretKey.ts View on Github external
sign(message: Uint8Array): Uint8Array {
    return sodium.crypto_sign_detached(message, this.sec_edward);
  }
github Cryptonomic / ConseilJS / src / utils / WrapperWrapper.js View on Github external
const sign = async (message, key) => {
    await sodiumsumo.ready;
    return sodiumsumo.crypto_sign_detached(message, key);
}
github auth0 / magic / magic.js View on Github external
switch (sk && Buffer.byteLength(sk)) {
    case sodium.crypto_sign_SECRETKEYBYTES:
      isk = sk;
      break;
    case sodium.crypto_sign_SEEDBYTES:
      isk = sodium.crypto_sign_seed_keypair(sk).privateKey;
      break;
    default:
      isk = sodium.crypto_sign_keypair().privateKey;
      sk  = sodium.crypto_sign_ed25519_sk_to_seed(isk);
  }

  let signature;
  try {
    signature = sodium.crypto_sign_detached(payload, isk);
  } catch(ex) {
    return done(new Error('Libsodium error: ' + ex));
  }

  return done(null, convert({
    alg:       'ed25519',
    sk:        sk,
    payload:   payload,
    signature: signature
  }));
}