|
|
@ -1,5 +1,4 @@ |
|
|
|
var ECKey = require('../../browser/vendor-bundle.js').ECKey; |
|
|
|
var buffertools = require('buffertools'); |
|
|
|
|
|
|
|
var Key = function() { |
|
|
|
this._pub = null; |
|
|
@ -48,7 +47,7 @@ Key.prototype.regenerateSync = function() { |
|
|
|
throw new Error('Key does not have a private key set'); |
|
|
|
} |
|
|
|
|
|
|
|
var eck = new ECKey(buffertools.toHex(this.private)); |
|
|
|
var eck = new ECKey(this.private.toString('hex')); |
|
|
|
eck.setCompressed(this.compressed); |
|
|
|
this.public = new Buffer(eck.getPub()); |
|
|
|
return this; |
|
|
@ -62,7 +61,7 @@ Key.prototype.signSync = function(hash) { |
|
|
|
if (!Buffer.isBuffer(hash) || hash.length !== 32) { |
|
|
|
throw new Error('Arg should be a 32 bytes hash buffer'); |
|
|
|
} |
|
|
|
var eck = new ECKey(buffertools.toHex(this.private)); |
|
|
|
var eck = new ECKey(this.private.toString('hex')); |
|
|
|
eck.setCompressed(this.compressed); |
|
|
|
var signature = eck.sign(bufferToArray(hash)); |
|
|
|
// return it as a buffer to keep c++ compatibility
|
|
|
|