Function encodeHdPrivateKey

  • Encode an HD private key (as defined by BIP32) given a valid HdPrivateNode and network.

    Note that this function defaults to throwing encoding errors. To handle errors in a type-safe way, set throwErrors to false.

    Type Parameters

    • ThrowErrors extends boolean = true

    Parameters

    • keyParameters: DecodedHdKey<HdPrivateNodeValid>

      A valid HD private node and the network for which to encode the key.

    • __namedParameters: {
          crypto?: {
              sha256: {
                  hash: ((input) => Uint8Array) & ((input) => Uint8Array);
              };
          };
          throwErrors?: ThrowErrors;
      } = {}
      • Optional crypto?: {
            sha256: {
                hash: ((input) => Uint8Array) & ((input) => Uint8Array);
            };
        }

        An optional object containing an implementation of sha256 to use.

        • sha256: {
              hash: ((input) => Uint8Array) & ((input) => Uint8Array);
          }
          • hash: ((input) => Uint8Array) & ((input) => Uint8Array)
      • Optional throwErrors?: ThrowErrors

        If true, this function will throw an Error when the provided HD node has a depth exceeding the maximum depth that can be encoded using the BIP32 serialization format rather than returning the error as a string (defaults to true).

    Returns ThrowErrors extends true
        ? HdPrivateKeyEncodeResult
        : string | HdPrivateKeyEncodeResult

Generated using TypeDoc