Allow specifying whether to compress key in ECKey.toBytes

This commit is contained in:
Andreas Brekken 2014-01-16 14:01:57 +07:00
parent 6cc7a23bdd
commit ecbb6f81ee

View file

@ -135,7 +135,8 @@ ECPubKey.prototype['export'] = function(format) {
return this['to' + format.substr(0, 1).toUpperCase() + format.substr(1)]() return this['to' + format.substr(0, 1).toUpperCase() + format.substr(1)]()
} }
ECPubKey.prototype.toBytes = function() { ECPubKey.prototype.toBytes = function(compressed) {
if (compressed === undefined) compressed = this.compressed
return this.pub.getEncoded(this.compressed) return this.pub.getEncoded(this.compressed)
} }