Closure-isolated Ethereum private key signer for EIP-191 messages, transactions, and EIP-712 typed data.
@tevm/voltaire/signers (also exported as Signers from @tevm/voltaire) provides the Signer interface and PrivateKeySignerImpl, a WASM-backed signer that encapsulates the 32-byte private key inside a private closure and exposes only the checksummed address, 64-byte publicKey, and signing methods.
Signing Flows
Quick Start
PrivateKeySignerImpl uses the Zig WASM primitives (Keccak256Wasm, secp256k1Sign, Eip712Wasm). Initialize the WASM module once before creating a signer.
Hashes via Eip712Wasm.hashTypedData and returns 65-byte hex
getAddress
(signer: Signer)
string
Returns signer.address
recoverTransactionAddress
(transaction: any)
Promise<string>
Placeholder; currently throws "recoverTransactionAddress not yet implemented"
Security Notes
PrivateKeySignerImpl isolates the private key in a closure to prevent accidental property serialization (JSON.stringify, Object.keys), but the bytes still reside in JS/WASM heap memory for the lifetime of the instance. For high-value production keys, isolate signing behind a dedicated HSM, KMS, or hardware wallet.
fromPrivateKey throws Error if the key is not exactly 32 bytes (64 hex characters).
Calling PrivateKeySignerImpl.fromPrivateKey before initializing WASM (await Keccak256Wasm.init()) throws because Keccak256Wasm.hash requires an initialized WASM instance.