Change PrivateKey.toString from WIF to hex format
This commit is contained in:
parent
9f32c1b7ba
commit
ff844e9935
@ -283,12 +283,21 @@ PrivateKey.isValid = function(data, network){
|
|||||||
return !PrivateKey.getValidationError(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
|
* Will output the PrivateKey to a WIF string
|
||||||
*
|
*
|
||||||
* @returns {String} A WIP representation of the private key
|
* @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 network = this.network;
|
||||||
var compressed = this.compressed;
|
var compressed = this.compressed;
|
||||||
|
|
||||||
|
|||||||
@ -409,8 +409,7 @@ PublicKey.prototype.toAddress = function(network) {
|
|||||||
* @returns {String} A DER hex encoded string
|
* @returns {String} A DER hex encoded string
|
||||||
*/
|
*/
|
||||||
PublicKey.prototype.toString = function() {
|
PublicKey.prototype.toString = function() {
|
||||||
var compressed = _.isUndefined(this.compressed) || this.compressed;
|
return this.toDER().toString('hex');
|
||||||
return this.toDER(compressed).toString('hex');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user