diff --git a/src/encryption.js b/src/encryption.js index d80e026..2b1c88a 100644 --- a/src/encryption.js +++ b/src/encryption.js @@ -32,6 +32,28 @@ class Encryption { _this = this } + /** + * @api encryption.getPubKey() getPubKey() + * @apiName Encryption getPubKey() + * @apiGroup Encryption + * @apiDescription Get the public key for an address + * Given an address, the command will search the blockchain for a public + * key associated with that address. The address needs to have made at least + * one spend transaction, in order for its public key to be retrievable. + * + * @apiExample Example usage: + *(async () => { + * try { + * const addr = 'bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d' + * const pubkey = await bchjs.encryption.getPubKey(addr); + * console.log(pubkey); + * } catch(err) { + * console.error(err) + * } + *})() + * + */ + // Search the blockchain for a public key associated with a BCH address. async getPubKey (addr) { try {