Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

secp256k1

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secp256k1 - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

.npmignore

12

index.js

@@ -148,6 +148,6 @@ var crypto = require('crypto');

* @param {Buffer} sig the signature as 64 byte buffer
* @param {Integer} recid the recovery id (as returned by ecdsa_sign_compact)
* @param {Integer} recid the recovery id (as returned by ecdsa_sign_compact). should be [0,3]
* @param {Boolean} compressed whether to recover a compressed or uncompressed pubkey
* @param {Function} [cb]
* @return {Buffer} the pubkey, a 33 or 65 byte buffer
* @return {Buffer|null} the pubkey, a 33 or 65 byte buffer, or null if invalid input
*/

@@ -158,2 +158,10 @@ exports.recoverCompact = function(msg, sig, recid, compressed, cb){

if (recid < 0 || recid > 3) {
if (!cb) {
return null;
} else {
return cb('failed recid >= 0 && recid <= 3');
}
}
if(!cb){

@@ -160,0 +168,0 @@ return secpNode.recoverCompact(msg, sig, compressed, recid);

2

package.json
{
"name": "secp256k1",
"version": "0.0.8",
"version": "0.0.9",
"description": "This module provides native bindings to ecdsa secp256k1 functions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -45,2 +45,10 @@ //tests against the `ecdsa` module

it('should NOT verify an invalid signature', function () {
//testing verification
var sig2 = ecdsa.sign(msg, ck.privateKey);
sig2 = new Buffer(ecdsa.serializeSig(sig2));
sig2[0] = 0xff;
assert(ecdsaNative.verify(pubKey, msg, sig2) === -2, 'should NOT verify invalid signature');
});
it('should verify a signature async', function (done) {

@@ -98,2 +106,15 @@ //testing verification

});
it('should not crash when recoverId is out of bounds - sync', function() {
var sig = ecdsaNative.recoverCompact(msg, compactSig.signature, -27, true);
assert.strictEqual(sig, null);
});
it('should not crash when recoverId is out of bounds - async', function(done) {
ecdsaNative.recoverCompact(msg, compactSig.signature, -27, true, function(err, sig) {
assert.strictEqual(err, 'failed recid >= 0 && recid <= 3');
assert.strictEqual(sig, undefined);
done();
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc