import { PublicKey } from './public-key.js'; import type { RecoverableSignature, WalletImportFormatType } from '@bitauth/libauth'; /** * Private Key entity. */ export declare class PrivateKey { readonly bytes: Uint8Array; /** * Construct a new Private Key. * * @throws {Error} If Private Key cannot be constructed. * * @param bytes {Uint8Array} The raw bytes (32) for the Private Key. */ constructor(bytes: Uint8Array); /** * Create a Private Key Entity from the given bytes. * * @param privateKeyBytes {string} Raw Private Key bytes. * * @throws {Error} If Private Key could not be created. * * @returns {PrivateKey} The created Private Key Entity. */ static fromBytes(privateKeyBytes: Uint8Array): PrivateKey; /** * Create a Private Key Entity from the given bytes (as hexadecimal string). * * @param privateKeyHex {string} Raw Private Key bytes encoded as hexadecimal string. * * @throws {Error} If Private Key could not be created. * * @returns {PrivateKey} The created Private Key Entity. */ static fromHex(privateKeyHex: string): PrivateKey; /** * Create a Private Key from a given WIF (Note that the network information from the WIF will be lost). * * @throws {Error} If Private Key cannot be created. * * @returns {PrivateKey} The Private Key */ static fromWIF(wif: string, removePrefixes?: string[]): PrivateKey; /** * Generate a random Private Key. * * @returns {PrivateKey} The randomly generated Private Key */ static generateRandom(): PrivateKey; static isWIF(wif: string, removePrefixes?: string[]): boolean; /** * Derive the public key from this private key. * * @throws {Error} If Public Key cannot be derived. * * @returns {PublicKey} The derived Public Key. */ derivePublicKey(): PublicKey; /** * Sign a message using a recoverable compact signature format. * * @param message The message to sign, either as a Uint8Array or string. * If a string is provided, it will be converted to UTF-8 bytes. * * @throws {Error} If message cannot be signed. * * @returns The generated recoverable compact signature. */ signMessageRecoverableCompact(message: Uint8Array | string): RecoverableSignature; /** * Sign a message using a compact signature format. * * @param message The message to sign, either as a Uint8Array or string. * If a string is provided, it will be converted to UTF-8 bytes. * * @throws {Error} If message cannot be signed. * * @returns The generated compact signature. */ signMessageCompact(message: Uint8Array | string): Uint8Array; /** * Sign a message using the Schnorr signature scheme. * * @param message The message to sign, either as a Uint8Array or string. * If a string is provided, it will be converted to UTF-8 bytes. * * @throws {Error} If message cannot be signed. * * @returns The generated Schnorr signature. */ signMessageSchnorr(message: Uint8Array | string): Uint8Array; /** * Sign a message using DER (Distinguished Encoding Rules) format. * * @param message The message to sign, either as a Uint8Array or string. * If a string is provided, it will be converted to UTF-8 bytes. * * @throws {Error} If message cannot be signed. * * @returns The generated DER signature. */ signMessageDER(message: Uint8Array | string): Uint8Array; /** * Sign a message hash with this Private Key using an Electron Cash Signature. * * This applies the Bitcoin and Electron Magic Bytes. * * NOTE: Electron can verify this message successfully, but generates them differently internally. * * @param message The message. * * @throws {Error} If message hash cannot be signed. * * @returns {Uint8Array} The generated signature. */ signMessageElectron(message: string): Uint8Array; /** * Sign a message hash with this Private Key using a Recoverable Compact Signature. * * @param messageHash {Uint8Array} The hash of the message. * * @throws {Error} If message hash cannot be signed. * * @returns {Uint8Array} The generated signature. */ signMessageHashRecoverableCompact(messageHash: Uint8Array | string): RecoverableSignature; /** * Sign a message hash with this Private Key using a Compact Signature. * * @param messageHash {Uint8Array} The hash of the message. * * @throws {Error} If message hash cannot be signed. * * @returns {Uint8Array} The generated signature. */ signMessageHashCompact(messageHash: Uint8Array | string): Uint8Array; /** * Sign a message hash with this Private Key using a Schnorr Signature. * * @param messageHash {Uint8Array} The hash of the message. * * @throws {Error} If message hash cannot be signed. * * @returns {Uint8Array} The generated signature. */ signMessageHashSchnorr(messageHash: Uint8Array | string): Uint8Array; /** * Sign a message hash with this Private Key using a DER Signature. * * @param messageHash {Uint8Array} The hash of the message. * * @throws {Error} If message hash cannot be signed. * * @returns {Uint8Array} The generated signature. */ signMessageHashDER(messageHash: Uint8Array | string): Uint8Array; /** * Convert the raw bytes of this Private Key to hexadecimal encoding. * * @returns {string} The raw bytes of the Private Key as a hexadecimal string. */ toHex(): string; /** * Convert this Private Key to a raw 32 byte representation. * * @returns {Uint8Array} The raw Private Key as a Uint8Array. */ toBytes(): Uint8Array; /** * Convert this Private Key to a WIF format. * * @param type {WalletImportFormatType} The type of WIF to create. * * @returns {string} The Private Key in WIF format. */ toWif(type?: WalletImportFormatType): string; /** * Returns the Private Key as a mainnet WIF. * * @returns {string} The Private Key as a mainnet WIF. */ toString(): string; }