Skip to main content

DomainSeparator

EIP-712 domain separator - a 32-byte keccak256 hash used for domain-specific signature verification.

Overview

DomainSeparator is a branded Hash type representing the keccak256 hash of an EIP-712 domain separator. It ensures signatures are valid only within a specific domain context, preventing replay attacks across different contracts or chains.

Type Definition

Usage

Create from Hex

Create from Bytes

Convert to Hex

Compare Separators

Computing Domain Separators

Use Domain.toHash() to compute domain separators:

Error Handling

DomainSeparator operations throw typed errors for precise error handling:

InvalidDomainSeparatorLengthError

Thrown when the input bytes length is not exactly 32 bytes.

Specification

See Also