|
|
@ -11,7 +11,7 @@ var Signature = function Signature(r, s, i) { |
|
|
|
this.i = i; //public key recovery parameter in range [0, 3]
|
|
|
|
}; |
|
|
|
|
|
|
|
Signature.prototype.fromCompressed = function(buf) { |
|
|
|
Signature.prototype.fromCompact = function(buf) { |
|
|
|
var i = buf.slice(0, 1)[0] - 27 - 4; //TODO: handle uncompressed pubkeys
|
|
|
|
var b2 = buf.slice(1, 33); |
|
|
|
var b3 = buf.slice(33, 65); |
|
|
@ -102,7 +102,7 @@ Signature.parseDER = function(buf) { |
|
|
|
return obj; |
|
|
|
}; |
|
|
|
|
|
|
|
Signature.prototype.toCompressed = function(i) { |
|
|
|
Signature.prototype.toCompact = function(i) { |
|
|
|
i = typeof i === 'number' ? i : this.i; |
|
|
|
if (!(i === 0 || i === 1 || i === 2 || i === 3)) |
|
|
|
throw new Error('i must be equal to 0, 1, 2, or 3'); |
|
|
|