Skip to main content
EIP712 implements Ethereum’s typed structured data specification (EIP-712): deterministic type encoding, recursive struct hashing, domain separation, \x19\x01 digest construction, signing, and address recovery.

Digest Construction

Quick Start

API Reference

EIP712 exports pre-wired convenience functions (using pure-TS Keccak-256 and Secp256k1) alongside uppercase dependency-injection factories (HashDomain, HashType, HashStruct, EncodeValue, EncodeData, HashTypedData, SignTypedData, RecoverAddress, VerifyTypedData) for custom or WASM crypto backends.

Domain Fields

EIP712Domain includes only the fields present on domain, encoded in canonical order:

Security Considerations

Always bind chainId and verifyingContract in domain, and include a per-signer nonce and deadline in the signed struct. Without them, valid signatures can be replayed across forks, contracts, or indefinitely on the same chain.
  • Prefix collision safety: The 0x19 0x01 prefix (EIP-191 version 0x01) cannot collide with RLP-encoded transactions or EIP-191 personal messages (\x19Ethereum Signed Message:\n).
  • Dynamic field hashing: string and bytes values are hashed with keccak256 before being placed in their 32-byte slot; arrays hash the concatenation of their encoded elements.
  • Errors: Invalid types, missing fields, or cyclic type references throw Eip712Error / Eip712EncodingError / Eip712InvalidDomainError.