Function deriveHdPrivateNodeIdentifier

  • Derive the public identifier for a given HdPrivateNode. This is used to uniquely identify HD nodes in software. The first 4 bytes of this identifier are considered its "fingerprint".

    Parameters

    • hdPrivateNode: HdPrivateNodeValid

      the HdPrivateNode from which to derive the public identifier (not require to be valid)

    • crypto: {
          ripemd160: {
              hash: ((input: Uint8Array) => Uint8Array);
          };
          secp256k1: {
              derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array);
          };
          sha256: {
              hash: ((input: Uint8Array) => Uint8Array);
          };
      } = ...

      an optional object containing implementations implementations of sha256, ripemd160, and secp256k1 compressed public key derivation to use

      • ripemd160: {
            hash: ((input: Uint8Array) => Uint8Array);
        }
        • hash: ((input: Uint8Array) => Uint8Array)
            • (input: Uint8Array): Uint8Array
            • Returns the ripemd160 hash of the provided input.

              To incrementally construct a ripemd160 hash (e.g. for streaming), use init, update, and final.

              Parameters

              • input: Uint8Array

                a Uint8Array to be hashed using ripemd160

              Returns Uint8Array

      • secp256k1: {
            derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array);
        }
        • derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array)
            • (privateKey: Uint8Array): string | Uint8Array
            • Derive a compressed public key from a valid secp256k1 private key.

              Returns an error message if the provided private key is too large (see validatePrivateKey).

              Parameters

              • privateKey: Uint8Array

                a valid secp256k1, 32-byte private key

              Returns string | Uint8Array

      • sha256: {
            hash: ((input: Uint8Array) => Uint8Array);
        }
        • hash: ((input: Uint8Array) => Uint8Array)
            • (input: Uint8Array): Uint8Array
            • Returns the sha256 hash of the provided input.

              To incrementally construct a sha256 hash (e.g. for streaming), use init, update, and final.

              Parameters

              • input: Uint8Array

                a Uint8Array to be hashed using sha256

              Returns Uint8Array

    Returns string | Uint8Array

Generated using TypeDoc