chaingate
Version:
Multi-chain cryptocurrency SDK for TypeScript — unified API for Bitcoin, Ethereum, Litecoin, Dogecoin, Bitcoin Cash, Polygon, Arbitrum, and any EVM-compatible chain. Create wallets, query balances, send transactions, and manage tokens and NFTs across UTXO
41 lines (40 loc) • 1.83 kB
TypeScript
/**
* Message signing and verification for EVM (EIP-191) and UTXO (Bitcoin-style)
* networks.
*/
/**
* Signs a message using EIP-191 personal sign (the same scheme as MetaMask's
* `personal_sign`).
*
* @param message - The message to sign (string or raw bytes).
* @param privateKey - The 32-byte private key.
* @returns The 65-byte signature as a hex string with `0x` prefix.
*/
export declare function signEvmMessage(message: string | Uint8Array, privateKey: Uint8Array): string;
/**
* Verifies an EIP-191 personal sign signature.
*
* @param message - The original message (string or raw bytes).
* @param signature - The signature (hex string with `0x` prefix).
* @param address - The expected signer address (EIP-55 checksummed or lowercase).
* @returns `true` if the signature is valid and was produced by the given address.
*/
export declare function verifyEvmMessage(message: string | Uint8Array, signature: string, address: string): boolean;
/**
* Signs a message using the Bitcoin message signing standard.
*
* @param message - The message to sign (string or raw bytes).
* @param privateKey - The 32-byte private key.
* @param prefix - The chain-specific sign header. Defaults to Bitcoin's prefix.
* @returns The signature as a base64 string (65 bytes).
*/
export declare function signUtxoMessage(message: Uint8Array | string, privateKey: Uint8Array, prefix?: string): string;
/**
* Recovers the compressed public key from a Bitcoin-style signed message.
*
* @param message - The original message.
* @param signature - The base64-encoded signature (65 bytes).
* @param prefix - The chain-specific sign header.
* @returns The recovered compressed public key (33 bytes).
*/
export declare function recoverUtxoPublicKey(message: Uint8Array | string, signature: string, prefix?: string): Uint8Array;