UNPKG

@covenance/dlc

Version:

Crypto and Bitcoin functions for Covenance DLC implementation

34 lines (33 loc) 1.45 kB
import { Point } from './secp256k1'; import { PubKey, Signature } from './types'; /** * Function to verify a general signature * @param sig - The signature to verify * @param pubKey - The public key to verify against * @param message - The message that was signed * @param tag - The tag to use for hashing (defaults to BIP0340/challenge) * @returns Boolean indicating whether the signature is valid */ export declare function verifySig(sig: Signature, pubKey: PubKey, message: Uint8Array, tag?: Uint8Array): Promise<boolean>; /** * Function to verify a signature with additional script interpreter like verification * @param sig - The signature to verify * @param pubKey - The public key to verify against * @param message - The message that was signed * @param tag - The tag to use for hashing (defaults to BIP0340/challenge) * @returns Boolean indicating whether the signature is valid */ export declare function verifySigStrict(sig: Signature, pubKey: PubKey, message: Uint8Array, tag?: Uint8Array): Promise<boolean>; /** * Encodes a point as a BIP-340 x-only key * @param point - The point to encode * @returns The encoded point as a 32-byte Buffer */ export declare function encodeXOnlyPubkey({ x, y }: Point): Buffer; /** * Modulus operation that handles negative numbers * @param k - The number to mod * @param n - The modulus * @returns The modulus of k and n */ export declare function mod(k: bigint, n: bigint): bigint;