@did-btc1/method
    Preparing search index...

    Class GeneralUtils

    Static class of general utility functions for the did-btc1 spec implementation GeneralUtils

    Index

    Constructors

    Methods

    • Converts a bigint to a buffer

      Parameters

      • value: bigint

        The bigint to convert

      Returns Buffer

      The buffer representation of the bigint

    • Derives a child key from an HDKey

      Parameters

      • hdkey: HDKey

        The HDKey to derive the child key from

      • path: string

        The path to derive the child key from

      Returns HDKey

      A Promise resolving to the child key

      Error if the child key cannot be derived

    • Helper function to encode a secp256k1 key in SchnorrSecp256k1 Multikey Format

      Parameters

      • xOnlyPublicKeyBytes: Bytes

      Returns string

    • Generates a new mnemonic phrase and HD wallet

      Returns Promise<HdWallet>

      Promise resolving to a new hdwallet object w/ mnemonic and hdkey

      if the public key bytes cannot be derived

    • Recovers an HDKey from a mnemonic phrase

      Parameters

      • mnemonic: string

        The mnemonic phrase to recover the HDKey from

      • path: string

        The path to derive the child key from

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Promise resolving to the recovered private key bytes

      if the HDKey cannot be recovered

    • Recovers an HDKey from a mnemonic phrase

      Parameters

      • mnemonic: string

        The mnemonic phrase to recover the HDKey from

      • Optionalseed: Uint8Array<ArrayBufferLike>

        Optional seed to recover the HDKey from

      Returns Promise<HDKey>

      Promise resolving to the recovered HDKey

      Error if the HDKey cannot be recovered

    • Recovers a secp256k1 privateKey from its original entropy

      Parameters

      • entropy: Uint8Array

        The entropy to recover the privateKey from

      Returns Uint8Array

      The recovered privateKey

      if the privateKey cannot be recovered

    • Recovers a secp256k1 privateKey from its original entropy

      Parameters

      • xorEntropy: Uint8Array

        The original entropy to recover the privateKey from

      • salt: Uint8Array

        The salt used to tweak the privateKey

      Returns Uint8Array

      The recovered privateKey

      if the privateKey cannot be recovered

    • Untweak the entropy with a salt using XNOR

      Parameters

      • tweakedEntropy: Uint8Array

        The tweaked entropy to untweak

      • salt: Uint8Array

        The salt to untweak the entropy with

      Returns Uint8Array

      The original entropy

    • Tweak the entropy with a salt using XOR

      Parameters

      • entropy: Uint8Array

        The entropy to tweak

      • salt: Uint8Array

        The salt to tweak the entropy with

      Returns Uint8Array

      The tweaked entropy