Change PrivateKey.toString from WIF to hex format

This commit is contained in:
Yemel Jardi 2015-01-02 18:15:17 -03:00
parent 9f32c1b7ba
commit ff844e9935
2 changed files with 11 additions and 3 deletions

View File

@ -283,12 +283,21 @@ PrivateKey.isValid = function(data, network){
return !PrivateKey.getValidationError(data, network);
};
/**
* Will output the PublicKey encoded as hex string
*
* @returns {String}
*/
PrivateKey.prototype.toString = function() {
return this.toBuffer().toString('hex');
}
/**
* Will output the PrivateKey to a WIF string
*
* @returns {String} A WIP representation of the private key
*/
PrivateKey.prototype.toString = PrivateKey.prototype.toWIF = function() {
PrivateKey.prototype.toWIF = function() {
var network = this.network;
var compressed = this.compressed;

View File

@ -409,8 +409,7 @@ PublicKey.prototype.toAddress = function(network) {
* @returns {String} A DER hex encoded string
*/
PublicKey.prototype.toString = function() {
var compressed = _.isUndefined(this.compressed) || this.compressed;
return this.toDER(compressed).toString('hex');
return this.toDER().toString('hex');
};
/**