Socket
Socket
Sign inDemoInstall

bitcoinjs-lib

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcoinjs-lib - npm Package Compare versions

Comparing version 1.1.10 to 1.2.0

2

package.json
{
"name": "bitcoinjs-lib",
"version": "1.1.10",
"version": "1.2.0",
"description": "Client-side Bitcoin JavaScript library",

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

@@ -12,9 +12,9 @@ var assert = require('assert')

var ecurve = require('ecurve')
var curve = ecurve.getCurveByName('secp256k1')
var secp256k1 = ecurve.getCurveByName('secp256k1')
function ECKey(d, compressed) {
assert(d.signum() > 0, 'Private key must be greater than 0')
assert(d.compareTo(curve.n) < 0, 'Private key must be less than the curve order')
assert(d.compareTo(ECKey.curve.n) < 0, 'Private key must be less than the curve order')
var Q = curve.G.multiply(d)
var Q = ECKey.curve.G.multiply(d)

@@ -25,2 +25,5 @@ this.d = d

// Constants
ECKey.curve = secp256k1
// Static constructors

@@ -56,3 +59,3 @@ ECKey.fromWIF = function(string) {

var d = BigInteger.fromBuffer(buffer)
d = d.mod(curve.n)
d = d.mod(ECKey.curve.n)

@@ -81,5 +84,5 @@ return new ECKey(d, compressed)

ECKey.prototype.sign = function(hash) {
return ecdsa.sign(curve, hash, this.d)
return ecdsa.sign(ECKey.curve, hash, this.d)
}
module.exports = ECKey

@@ -9,3 +9,3 @@ var crypto = require('./crypto')

var ecurve = require('ecurve')
var curve = ecurve.getCurveByName('secp256k1')
var secp256k1 = ecurve.getCurveByName('secp256k1')

@@ -22,5 +22,8 @@ function ECPubKey(Q, compressed) {

// Constants
ECPubKey.curve = secp256k1
// Static constructors
ECPubKey.fromBuffer = function(buffer) {
var Q = ecurve.Point.decodeFrom(curve, buffer)
var Q = ecurve.Point.decodeFrom(ECPubKey.curve, buffer)
return new ECPubKey(Q, Q.compressed)

@@ -41,3 +44,3 @@ }

ECPubKey.prototype.verify = function(hash, signature) {
return ecdsa.verify(curve, hash, signature, this.Q)
return ecdsa.verify(ECPubKey.curve, hash, signature, this.Q)
}

@@ -44,0 +47,0 @@

var assert = require('assert')
var networks = require('../src/networks')

@@ -10,2 +9,3 @@ var base58 = require('bs58')

var base58check = Bitcoin.base58check
var networks = Bitcoin.networks
var ECKey = Bitcoin.ECKey

@@ -195,3 +195,3 @@ var ECSignature = Bitcoin.ECSignature

if (actualHash != undefined) {
if (actualHash !== undefined) {
// Test data is big-endian

@@ -198,0 +198,0 @@ Array.prototype.reverse.call(actualHash)

var assert = require('assert')
var crypto = require('crypto')
var ecurve = require('ecurve')
var networks = require('../src/networks')

@@ -45,2 +46,17 @@ var sinon = require('sinon')

it('uses the secp256k1 curve by default', function() {
var secp256k1 = ecurve.getCurveByName('secp256k1')
for (var property in secp256k1) {
// FIXME: circular structures in ecurve
if (property === 'G') continue
if (property === 'infinity') continue
var actual = ECKey.curve[property]
var expected = secp256k1[property]
assert.deepEqual(actual, expected)
}
})
describe('fromWIF', function() {

@@ -47,0 +63,0 @@ fixtures.valid.forEach(function(f) {

@@ -38,2 +38,17 @@ var assert = require('assert')

it('uses the secp256k1 curve by default', function() {
var secp256k1 = ecurve.getCurveByName('secp256k1')
for (var property in secp256k1) {
// FIXME: circular structures in ecurve
if (property === 'G') continue
if (property === 'infinity') continue
var actual = ECPubKey.curve[property]
var expected = secp256k1[property]
assert.deepEqual(actual, expected)
}
})
describe('fromHex/toHex', function() {

@@ -40,0 +55,0 @@ it('supports compressed points', function() {

@@ -60,3 +60,3 @@ var assert = require('assert')

// broadcast our transaction
helloblock.transactions.propagate(txb.build().toHex(), function(err, res) {
helloblock.transactions.propagate(txb.build().toHex(), function(err) {
// no err means that the transaction has been successfully propagated

@@ -63,0 +63,0 @@ if (err) return done(err)

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