dash-platform-sdk
    Preparing search index...

    Class KeyPairController

    Collection of functions to work with private keys and seed phrases

    Index

    Methods

    • Allows to derive child HD Key

      Parameters

      • parent: HDKey

        {HDKey} - The HDKey parent instance

      • index: number

        {number} - Index of child

      • hardened: boolean

        {boolean} - hardened or no

      Returns Promise<HDKey>

      A promise that resolves child key

    • Allows to derive HD key by path

      Parameters

      • parent: HDKey

        {HDKey} - The HDKey parent instance

      • path: string

        {string} - Path of children

      Returns Promise<HDKey>

      A promise that resolves key by path

    • Convert a HDKey to a public key

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey to be converted into a public key

      • Optionalopts: NetworkVersion

        {NetworkVersion=} - Network version

      Returns Promise<Uint8Array<ArrayBufferLike>>

      • converted public key
    • Converts a HDKey to a wallet ID

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey to be converted into a wallet id.

      Returns Promise<string>

      Wallet id from used key

    • Converts an HDKey instance to an extended private key (xprv)

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey instance to convert

      • Optionalopts: NetworkVersion

        {NetworkVersion=} - Optional, containing the version

      Returns Promise<string>

      A promise that resolves to the xPrivateKey string

    • Convert a HDKey to a xPublicKey

      Parameters

      • hdKey: HDKey

        {HDKey} - The HDKey instance to convert

      • Optionalopts: NetworkVersion

        {NetworkVersion=} - Optional, containing the version

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Derives an Identity HDKey from a mnemonic phrase.

      Parameters

      • mnemonic: string

        {string} - The BIP39 mnemonic phrase.

      • OptionalidentityIndex: number

        {number} - The identity index (default: 0).

      • OptionalkeyIndex: number

        {number} - The key index within the identity (default: 0).

      • Optionalsalt: string

        {string=} - Optional salt for seed derivation.

      • Optionalverify: boolean

        {boolean=} - Whether to verify the mnemonic during derivation.

      • Optionalopts: HDFromSeedOptions & WalletToIdentityKeyOpts

        {(HDFromSeedOptions & WalletToIdentityKeyOpts)=} - Additional options for HD seed derivation and wallet-to-identity conversion.

      Returns Promise<HDKey>

      A promise that resolves to the derived identity HDKey.

    • Returns seed from mnemonic phrase

      Parameters

      • mnemonic: string

        {string} - The BIP39 mnemonic phrase.

      • Optionalsalt: string

        {string=} - Optional salt for seed derivation.

      • Optionalverify: boolean

        {boolean=} - Whether to verify the mnemonic during derivation.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Seed bytes

    • Returns wallet from mnemonic phrase

      Parameters

      • mnemonic: string

        {string} - The BIP39 mnemonic phrase.

      • Optionalsalt: string

        {string=} - Optional salt for seed derivation.

      • Optionalverify: boolean

        {boolean=} - Whether to verify the mnemonic during derivation.

      • Optionalopts: HDFromSeedOptions

        {HDFromSeedOptions=} - Optional derivation settings

      Returns Promise<HDKey>

      Wallet from mnemonic

    • Convert a private key to WIF

      Parameters

      • privateKeyBytes: Uint8Array

        {Uint8Array} - Private key bytes

      • Optionalopts: NetworkVersion

        {NetworkVersion=} - Optional options with network version

      Returns Promise<string>

      WIF

    • Convert public key to address

      Parameters

      • publicKeyBytes: Uint8Array

        {Uint8Array} - Bytes of public key

      • Optionalopts: NetworkVersion

        {NetworkVersion=} - Optional options with network version

      Returns Promise<string>

      address string

    • Convert seed bytes to wallet

      Parameters

      • seed: Uint8Array

        {Uint8Array} - seed bytes

      • Optionalopts: HDFromSeedOptions

        {HDFromSeedOptions?} - Optional options with network version

      Returns Promise<HDWallet>

    • Returns identity key from wallet

      Parameters

      • wallet: HDKey | HDWallet

        {HDWallet | HDKey} - wallet that will be used

      • identityIndex: number

        {number} - index of identity for wallet

      • keyIndex: number

        {number} - index of key for identity

      • opts: WalletToIdentityKeyOpts = ...

        {WalletToIdentityKeyOpts=} - optional options

      Returns Promise<HDKey>

    • Allows to convert xKey to HDXKey

      Parameters

      • xKey: string

        {string} - String with xKey

      • Optionalopts: HDFromXKeyOptions

        {HDFromXKeyOptions=} - Optional options

      Returns Promise<HDXKey>