lib/util.js
function webidAndPubKeyToAddress(webid, pubKey, testnet) {
  if (typeof(pubKey) === 'string') {
    pubKey = new bitcore.HDPublicKey(pubKey)
  }
  var hash = sha2(webid)

  var ints = hashToInts(hash)

  var dep2 = pubKey.derive(ints[0]).derive(ints[1]).derive(ints[2]).derive(ints[3])

  //console.log(dep2);

  if (testnet) {
    var address2 = new bitcore.Address(dep2.publicKey, bitcore.Networks.testnet)
  } else {
    var address2 = new bitcore.Address(dep2.publicKey)
  }

  //console.log(address1);
  //console.log(address2);

  return address2
}
function webidAndPubKeyToAddress(webid, pubKey, testnet) {
  if (typeof(pubKey) === 'string') {
    pubKey = new bitcore.HDPublicKey(pubKey)
  }
  var hash = sha2(webid)

  var ints = hashToInts(hash)

  var dep2 = pubKey.derive(ints[0]).derive(ints[1]).derive(ints[2]).derive(ints[3])

  //console.log(dep2);

  if (testnet) {
    var address2 = new bitcore.Address(dep2.publicKey, bitcore.Networks.testnet)
  } else {
    var address2 = new bitcore.Address(dep2.publicKey)
  }

  //console.log(address1);
  //console.log(address2);

  return address2
}
function webidAndPubKeyToAddress ( webid , pubKey , testnet ) { if ( typeof ( pubKey ) === 'string' ) { pubKey = new bitcore . HDPublicKey ( pubKey ) } var hash = sha2 ( webid ) var ints = hashToInts ( hash ) var dep2 = pubKey . derive ( ints [ 0 ] ) . derive ( ints [ 1 ] ) . derive ( ints [ 2 ] ) . derive ( ints [ 3 ] ) //console.log(dep2); if ( testnet ) { var address2 = new bitcore . Address ( dep2 . publicKey , bitcore . Networks . testnet ) } else { var address2 = new bitcore . Address ( dep2 . publicKey ) } //console.log(address1); //console.log(address2); return address2 }
get an address from webid and hd pub key
@param  {String}  webid   The WebID
@param  {String}  pubKey  The HD public key
@param  {boolean} testnet Use testnet
@return {String}          bitcoin address
get an address from webid and hd pub key