SignedData
EIP-191 signed data primitive implementing the Ethereum Signed Message standard. Provides type-safe message signing and verification following the EIP-191 specification.Overview
EIP-191 defines a standard format for signed data with three versions:- 0x00: Data with validator (contract address)
- 0x01: Structured data (EIP-712)
- 0x45: Personal message (most common)
Installation
Basic Usage
Personal Message Signing
Create Signed Data
API Reference
Types
SignedDataType
Branded Uint8Array representing EIP-191 signed data.
SignedDataVersion
EIP-191 version bytes:
Functions
from(version, versionData, data)
Create EIP-191 signed data from components.
Parameters:
version: Version byte (0x00, 0x01, or 0x45)versionData: Version-specific data (validator address or domain separator)data: Message data
SignedDataType
Example:
Hash({ keccak256 })
Factory function that creates a personal message hash function.
Parameters:
keccak256: Keccak256 hash function
Verify({ keccak256, recoverPublicKey, addressFromPublicKey })
Factory function that creates a signature verification function.
Parameters:
keccak256: Keccak256 hash functionrecoverPublicKey: secp256k1 public key recovery functionaddressFromPublicKey: Address derivation function
Constants
EIP-191 Format
Personal Message (0x45)
The most common format used by wallets:Data with Validator (0x00)
For contract-validated signatures:Structured Data (0x01)
For EIP-712 typed data:Error Handling
Related
- EIP-191 Specification
- ContractSignature - EIP-1271 contract signature verification
- TypedData - EIP-712 structured data
- Signature - ECDSA signature handling

