Function generateKeys

  • Description

    Generate a new key pair given a mnemonic and passphrase

    Returns

    The generated key pair

    Example

    cryptoUtils.generateKeys('raw peace visual boil prefer rebel anchor right elegant side gossip enroll force salmon between', 'my_password_123')
    .then(({ mnemonic, passphrase, sk, pk, pkh }) => console.log(mnemonic, passphrase, sk, pk, pkh));

    // Or generate keys given an HD derivartion path
    cryptoUtils.generateKeys('gym exact clown can answer hope sample mirror knife twenty powder super imitate lion churn almost shed chalk dust civil gadget pyramid helmet trade', undefined, 'm/44h/1729h/0h/0h')
    .then(({ mnemonic, passphrase, sk, pk, pkh }) => console.log(mnemonic, passphrase, sk, pk, pkh));

    Parameters

    • mnemonic: string

      The mnemonic seed

    • Optional passphrase: string

      The passphrase used to salt the seed

    • Optional derivationPath: string

      Derivation path if generating keys for an HD account

    Returns Promise<KeysMnemonicPassphrase>

Generated using TypeDoc