btcutil-js - v0.2.0
    Preparing search index...

    Variable btcecConst

    btcec: {
        ecdsaParseDERSignature(
            signature: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        ecdsaParseSignature(signature: Bytes): Promise<Uint8Array<ArrayBufferLike>>;
        ecdsaRecoverCompact(
            signature: Bytes,
            hash: Bytes,
        ): Promise<RecoverCompactResult>;
        ecdsaSign(
            privKey: Bytes,
            hash: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        ecdsaSignCompact(
            privKey: Bytes,
            hash: Bytes,
            isCompressedKey: boolean,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        ecdsaVerify(pubKey: Bytes, hash: Bytes, signature: Bytes): Promise<boolean>;
        generateSharedSecret(
            privKey: Bytes,
            pubKey: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        isCompressedPubKey(pubKey: Bytes): Promise<boolean>;
        newPrivateKey(): Promise<KeyPairResult>;
        privKeyFromBytes(privKey: Bytes): Promise<KeyPairResult>;
        pubKeyFromBytes(pubKey: Bytes): Promise<Uint8Array<ArrayBufferLike>>;
        schnorrParsePubKey(
            xOnlyPubKey: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        schnorrParseSignature(
            signature: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        schnorrSerializePubKey(pubKey: Bytes): Promise<Uint8Array<ArrayBufferLike>>;
        schnorrSign(
            privKey: Bytes,
            hash: Bytes,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        schnorrVerify(
            pubKey: Bytes,
            hash: Bytes,
            signature: Bytes,
        ): Promise<boolean>;
        serializeCompressed(pubKey: Bytes): Promise<Uint8Array<ArrayBufferLike>>;
        serializeUncompressed(pubKey: Bytes): Promise<Uint8Array<ArrayBufferLike>>;
    } = ...

    secp256k1 elliptic curve cryptography: key management, ECDSA, Schnorr, ECDH.

    Type Declaration

    • ecdsaParseDERSignature: function
      • Parse a strict DER-encoded ECDSA signature. Calls Go: ecdsa.ParseDERSignature() from btcd/btcec/v2/ecdsa.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • ecdsaParseSignature: function
      • Parse and normalize a BER-encoded ECDSA signature. Calls Go: ecdsa.ParseSignature() from btcd/btcec/v2/ecdsa.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • ecdsaRecoverCompact: function
    • ecdsaSign: function
      • Sign a 32-byte hash with ECDSA (RFC 6979 deterministic). Returns DER-encoded signature. Calls Go: ecdsa.Sign() from btcd/btcec/v2/ecdsa.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • ecdsaSignCompact: function
      • Sign a hash and return a 65-byte compact (recoverable) signature. Calls Go: ecdsa.SignCompact() from btcd/btcec/v2/ecdsa.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • ecdsaVerify: function
      • Verify an ECDSA DER-encoded signature. Calls Go: ecdsa.Signature.Verify() from btcd/btcec/v2/ecdsa.

        Parameters

        Returns Promise<boolean>

    • generateSharedSecret: function
      • Compute an ECDH shared secret. Calls Go: btcec.GenerateSharedSecret() from btcd/btcec/v2.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • isCompressedPubKey: function
      • Check if a public key is in compressed format. Calls Go: btcec.IsCompressedPubKey() from btcd/btcec/v2.

        Parameters

        Returns Promise<boolean>

    • newPrivateKey: function
    • privKeyFromBytes: function
      • Derive the private/public key pair from raw private key bytes (hex). Calls Go: btcec.PrivKeyFromBytes() from btcd/btcec/v2.

        Parameters

        Returns Promise<KeyPairResult>

    • pubKeyFromBytes: function
      • Parse a public key (compressed 33-byte or uncompressed 65-byte hex) and return normalized compressed form. Calls Go: btcec.ParsePubKey() from btcd/btcec/v2.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • schnorrParsePubKey: function
      • Parse a 32-byte x-only public key (BIP-340). Returns 33-byte compressed key. Calls Go: schnorr.ParsePubKey() from btcd/btcec/v2/schnorr.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • schnorrParseSignature: function
      • Parse a 64-byte Schnorr signature. Calls Go: schnorr.ParseSignature() from btcd/btcec/v2/schnorr.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • schnorrSerializePubKey: function
      • Serialize a public key as 32-byte x-only (BIP-340). Calls Go: schnorr.SerializePubKey() from btcd/btcec/v2/schnorr.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • schnorrSign: function
      • Sign a 32-byte hash with Schnorr (BIP-340). Returns 64-byte signature. Calls Go: schnorr.Sign() from btcd/btcec/v2/schnorr.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • schnorrVerify: function
      • Verify a BIP-340 Schnorr signature. Accepts 32-byte x-only or 33-byte compressed pubkey. Calls Go: schnorr.Signature.Verify() from btcd/btcec/v2/schnorr.

        Parameters

        Returns Promise<boolean>

    • serializeCompressed: function
      • Serialize a public key to compressed 33-byte form. Calls Go: btcec.PublicKey.SerializeCompressed() from btcd/btcec/v2.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>

    • serializeUncompressed: function
      • Serialize a public key to uncompressed 65-byte form. Calls Go: btcec.PublicKey.SerializeUncompressed() from btcd/btcec/v2.

        Parameters

        Returns Promise<Uint8Array<ArrayBufferLike>>