How to use the elliptic/lib/elliptic/ec/signature function in elliptic

To help you get started, we’ve selected a few elliptic 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 Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-account / src / __tests__ / account.spec.ts View on Github external
nonce: 1,
      to: 'another_person',
      amount: new BN(888),
      pubKey: account.publicKey,
      gasPrice: 888,
      gasLimit: 888888,
      code: '',
      data: 'some_data',
    };

    const tx = new Transaction(rawTx);
    const rawSignature = account.signTransaction(tx);

    const lgtm = zcrypto.schnorr.verify(
      tx.bytes,
      new Signature({
        r: new BN(rawSignature.slice(0, 64), 16),
        s: new BN(rawSignature.slice(64), 16),
      }),
      Buffer.from(account.publicKey, 'hex'),
    );

    expect(lgtm).toBeTruthy();
  });
});
github Zilliqa / Zilliqa-JavaScript-Library / src / __tests__ / util.spec.ts View on Github external
const tx = {
      version: 8,
      nonce: 8,
      to: pairs[0].digest.slice(24),
      pubKey: publicKey,
      amount: new BN('888', 10),
      gasPrice: 8,
      gasLimit: 88,
      code: '',
      data: '',
    };

    const {signature} = util.createTransactionJson(privateKey, tx);
    const res = schnorr.verify(
      util.encodeTransaction(tx),
      new Signature({
        r: new BN((signature as string).slice(0, 64), 16),
        s: new BN((signature as string).slice(64), 16),
      }),
      Buffer.from(publicKey, 'hex'),
    );

    expect(res).toBeTruthy();
  });