bitcore-wallet-utils
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -16,2 +16,8 @@ 'use strict'; | ||
WalletUtils.PATHS = { | ||
BASE_ADDRESS_DERIVATION: "m/45'", | ||
REQUEST_KEY: "m/1'/0", | ||
TXPROPOSAL_KEY: "m/1'/1", | ||
}; | ||
/* TODO: It would be nice to be compatible with bitcoind signmessage. How | ||
@@ -55,4 +61,4 @@ * the hash is calculated there? */ | ||
WalletUtils.deriveAddress = function(publicKeyRing, path, m, network) { | ||
var publicKeys = _.map(publicKeyRing, function(xPubKey) { | ||
var xpub = new Bitcore.HDPublicKey(xPubKey); | ||
var publicKeys = _.map(publicKeyRing, function(item) { | ||
var xpub = new Bitcore.HDPublicKey(item.xPubKey); | ||
return xpub.derive(path).publicKey; | ||
@@ -71,5 +77,9 @@ }); | ||
WalletUtils.getProposalHash = function(toAddress, amount, message) { | ||
return toAddress + '|' + amount + '|' + (message || ''); | ||
return [toAddress, amount, (message || '')].join('|'); | ||
}; | ||
WalletUtils.getCopayerHash = function(name, xPubKey, requestPubKey) { | ||
return [name, xPubKey, requestPubKey].join('|'); | ||
}; | ||
WalletUtils.xPubToCopayerId = function(xpub) { | ||
@@ -150,3 +160,3 @@ var hash = sjcl.hash.sha256.hash(xpub); | ||
var network = new Bitcore.Address(txp.toAddress).network.name; | ||
var xpriv = new Bitcore.HDPrivateKey(xPrivKey, network); | ||
var xpriv = new Bitcore.HDPrivateKey(xPrivKey, network).derive(WalletUtils.PATHS.BASE_ADDRESS_DERIVATION); | ||
@@ -153,0 +163,0 @@ _.each(txp.inputs, function(i) { |
@@ -5,3 +5,3 @@ { | ||
"author": "BitPay Inc", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
13152
11
0
236