/** * Ethereum Wallet Service for the BrightChain identity system. * * Derives Ethereum addresses from BrightChain member identities using * BIP44 hierarchical deterministic derivation. Provides message signing * and signature verification for dApp authentication and transaction * signing. * * Derivation path: m/44'/60'/0'/0/0 (BIP44 standard for Ethereum) * - purpose = 44 (BIP44) * - coin_type = 60 (Ethereum) * - account = 0 (default account) * - change = 0 (external chain — wallet addresses) * - index = 0 (first address) * * Requirements: 6.1, 6.2, 6.3, 6.7, 6.8 */ import { ECIESService, PlatformID } from '@digitaldefiance/ecies-lib'; /** * Error thrown when Ethereum address derivation fails. */ export declare class EthereumDerivationError extends Error { constructor(message: string); } /** * Error thrown when message signing fails. */ export declare class EthereumSigningError extends Error { constructor(message: string); } /** * Result of Ethereum address derivation. */ export interface IEthereumAddressResult { /** EIP-55 checksummed Ethereum address */ address: string; /** Uncompressed SECP256k1 public key (65 bytes, hex-encoded) */ publicKeyHex: string; /** BIP44 derivation path used */ derivationPath: string; } /** * Result of an Ethereum message signature. */ export interface IEthereumSignatureResult { /** The original message that was signed */ message: string; /** The ECDSA signature (hex-encoded, 65 bytes: r + s + v) */ signature: string; /** Recovery parameter (0 or 1) */ recoveryParam: number; } /** * Service for deriving Ethereum wallets from BrightChain member identities * and performing Ethereum-compatible message signing. * * All methods are static — the service is stateless and safe to call * from any context (browser or Node.js). * * @example * ```typescript * const eciesService = ServiceProvider.getInstance().eciesService; * * // Derive Ethereum address from paper key * const result = EthereumWalletService.deriveAddress(paperKey); * console.log(result.address); // 0x1234...abcd (EIP-55 checksummed) * * // Sign a message * const sig = EthereumWalletService.signMessage(paperKey, 'Hello World'); * * // Verify the signature * const valid = EthereumWalletService.verifySignature( * 'Hello World', * sig.signature, * result.address, * ); * ``` */ export declare class EthereumWalletService { /** * Derive an Ethereum address from a BIP39 mnemonic paper key. * * Uses BIP44 path m/44'/60'/0'/0/0 to derive the first Ethereum * address. The address is returned in EIP-55 checksummed format. * * **Validates: Requirements 6.1, 6.4** * * @param paperKey - The 24-word BIP39 mnemonic * @returns The derived Ethereum address, public key, and derivation path * @throws {EthereumDerivationError} If derivation fails */ static deriveAddress(paperKey: string): IEthereumAddressResult; /** * Derive an Ethereum address from a paper key after validating it. * * Convenience method that validates the paper key before derivation. * * @param paperKey - The 24-word BIP39 mnemonic * @param eciesService - The ECIES service for paper key validation * @returns The derived Ethereum address result * @throws {EthereumDerivationError} If the paper key is invalid or derivation fails */ static deriveAddressFromValidatedKey(paperKey: string, eciesService: ECIESService): IEthereumAddressResult; /** * Sign a message using the Ethereum personal_sign format (EIP-191). * * Prepends the standard Ethereum message prefix before signing, * making the signature compatible with MetaMask's personal_sign * and web3.eth.personal.sign. * * **Validates: Requirements 6.2, 6.3** * * @param paperKey - The 24-word BIP39 mnemonic (private key source) * @param message - The message to sign * @returns The signature result with hex-encoded signature and recovery param * @throws {EthereumSigningError} If signing fails */ static signMessage(paperKey: string, message: string): IEthereumSignatureResult; /** * Verify an Ethereum personal_sign signature. * * Recovers the signer's address from the signature and compares it * to the expected address. * * **Validates: Requirements 6.7, 6.8** * * @param message - The original message that was signed * @param signature - The hex-encoded 65-byte signature (0x-prefixed) * @param address - The expected signer's Ethereum address (EIP-55) * @returns `true` if the signature was produced by the address owner */ static verifySignature(message: string, signature: string, address: string): boolean; /** * Recover the signer's Ethereum address from a signed message. * * @param message - The original message * @param signature - The hex-encoded 65-byte signature (0x-prefixed) * @returns The recovered EIP-55 checksummed Ethereum address * @throws {EthereumSigningError} If recovery fails */ static recoverAddress(message: string, signature: string): string; /** * Hash a message using the EIP-191 personal message format. * * Format: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message) * * @param message - The message to hash * @returns The 32-byte keccak256 hash */ static hashMessage(message: string): Uint8Array; /** * Validate an EIP-55 checksummed Ethereum address. * * @param address - The address to validate * @returns `true` if the address is valid and properly checksummed */ static isValidAddress(address: string): boolean; } //# sourceMappingURL=ethereumWalletService.d.ts.map