Creates an hdkey object from a xprv or xpub extended key string. Accepts an optional versions object & an optional skipVerification boolean. If skipVerification is set to true, then the provided public key's x (and y if uncompressed) coordinate will not will be verified to be on the curve.
var key = 'xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j'var hdkey = HDKey.fromExtendedKey(key)
or
var key = 'xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt'var hdkey = HDKey.fromExtendedKey(key)
HDKey.fromJSON(obj)
Creates an hdkey object from an object created via hdkey.toJSON().
Newer, "hardened" derivation paths look like this:
// as defined by BIP-44var childkey = hdkey.derive("m/44'/0'/0'/0/0");
hdkey.sign(hash)
Signs the buffer hash with the private key using secp256k1 and returns the signature as a buffer.
hdkey.verify(hash, signature)
Verifies that the signature is valid for hash and the hdkey's public key using secp256k1. Returns true for valid, false for invalid. Throws if the hash or signature is the wrong length.
hdkey.wipePrivateData()
Wipes all record of the private key from the hdkey instance. After calling this method, the instance will behave as if it was created via HDKey.fromExtendedKey(xpub).
hdkey.toJSON()
Serializes the hdkey to an object that can be JSON.stringify()ed.