From 055cd7fecaec01b030f5db115287d1bfaad437b6 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 14 Dec 2022 10:05:41 -0800 Subject: [PATCH] fix(encryption): Adding documentation for the encryption library --- src/encryption.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 {