0.2.0 • Published 3 years ago

@s1seven/js-bigchaindb-key-derivation v0.2.0

Weekly downloads
106
License
Apache-2.0
Repository
-
Last release
3 years ago

key-derivation

Heavily inspired by stellar-hd-wallet. Complies to BIP44 and SLIP10.

Usage

TODO: DEMONSTRATE API

const BigChainWallet = require('@s1seven/js-bigchain-key-derivation');

TODOs

Account discovery

In an extra module ?

async accountDiscovery(account: number | string, index: number, attempt = 0): Promise<boolean> {
  const conn = new Connection(this.networkUrl);
  const publicKey = this.getPublicKey(index, 'base58');
  // ? only check unspent ?
  const unspentTransactions = await conn.listOutputs(publicKey, false);
  const spentTransactions = await conn.listOutputs(publicKey, true);
  const transactions = [...unspentTransactions, ...spentTransactions];
  if (transactions.length) {
    return false;
  }
  if (!transactions.length) {
    return this.accountDiscovery(account, (index += 1), (attempt += 1));
  }
  if (attempt === 20) {
    return true;
  }
  return false;
}
  • add third property if keypair has unspent transaction ?
  • check that previous account has transaction history

DER / KeyObject / PEM encoding

  • Add missing alg to export as DER/PEM/Keyobject X25519 private key
0.2.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago