How to use the unchained-bitcoin.compressPublicKey function in unchained-bitcoin

To help you get started, we’ve selected a few unchained-bitcoin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github unchained-capital / unchained-wallets / src / ledger.js View on Github external
async run() {
    const result = await super.run();
    if (result.publicKey) {
      const compressedPublicKey = compressPublicKey(result.publicKey);
      return compressedPublicKey;
    } else {
      throw new {message: "Unable to export public key."};
    }
  }
github unchained-capital / unchained-wallets / src / ledger.js View on Github external
export async function exportLedgerPubKey(path, ledgerbtc) {
    try {
        const result = await ledgerbtc.getWalletPublicKey(path, {verify: true});
        if (result.publicKey) {
          const compressedPublicKey = compressPublicKey(result.publicKey);
          return { success: true, publicKey: compressedPublicKey };
        } else { return null; }
    } catch(e) {
        return { success: false, text: e.message };
    }
}