Skip to main content

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
Returns: SignedDataType Example:

Hash({ keccak256 })

Factory function that creates a personal message hash function. Parameters:
  • keccak256: Keccak256 hash function
Returns: Function that hashes messages with EIP-191 format Example:

Verify({ keccak256, recoverPublicKey, addressFromPublicKey })

Factory function that creates a signature verification function. Parameters:
  • keccak256: Keccak256 hash function
  • recoverPublicKey: secp256k1 public key recovery function
  • addressFromPublicKey: Address derivation function
Returns: Function that verifies signatures Example:

Constants

EIP-191 Format

Personal Message (0x45)

The most common format used by wallets:
Hashed with keccak256 before signing.

Data with Validator (0x00)

For contract-validated signatures:

Structured Data (0x01)

For EIP-712 typed data:

Error Handling

See Also

  • Address - Ethereum address handling
  • Hash - Keccak256 hashing