settings: added network to wallet secret
This commit is contained in:
parent
fc1d098135
commit
520fd762ba
2 changed files with 17 additions and 16 deletions
|
|
@ -647,7 +647,11 @@ Wallet.prototype.getSecretNumber = function() {
|
|||
* @return {string}
|
||||
*/
|
||||
Wallet.prototype.getSecret = function() {
|
||||
var buf = new Buffer(this.getMyCopayerId() + this.getSecretNumber(), 'hex');
|
||||
var buf = new Buffer(
|
||||
this.getMyCopayerId() +
|
||||
this.getSecretNumber() +
|
||||
this.getNetworkName() === 'livenet' ? 'L' : 'T',
|
||||
'hex');
|
||||
var str = Base58Check.encode(buf);
|
||||
return str;
|
||||
};
|
||||
|
|
@ -662,9 +666,11 @@ Wallet.decodeSecret = function(secretB) {
|
|||
var secret = Base58Check.decode(secretB);
|
||||
var pubKeyBuf = secret.slice(0, 33);
|
||||
var secretNumber = secret.slice(33, 38);
|
||||
var networkName = secret.slice(38, 39) === 'L' ? 'livenet' : 'testnet';
|
||||
return {
|
||||
pubKey: pubKeyBuf.toString('hex'),
|
||||
secretNumber: secretNumber.toString('hex')
|
||||
secretNumber: secretNumber.toString('hex'),
|
||||
networkName: networkName,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue