$ show onchain-id/solidity
This repository provides a comprehensive Solidity implementation of the ERC-734 (Key Holder) and ERC-735 (Claim Holder) standards for decentralized on-chain identities. It includes a core Identity contract that manages cryptographic keys (management, action, claim, encryption) and claims (issuance, storage, revocation), along with a ClaimIssuer contract for issuing and revoking claims. The system supports proxy-based upgradeability via an ImplementationAuthority and IdentityProxy, allowing identity contracts to be upgraded without losing state. A factory contract (IdFactory) enables deterministic deployment of identity proxies using CREATE2, with support for wallet linking and token identity creation. A Gateway contract provides an off-chain authorization layer for identity deployment, managing approved signers and signature revocation. A Verifier contract allows other contracts to verify that an identity holds valid claims from trusted issuers for required topics. The architecture is modular, well-tested, and follows security best practices including signature malleability protection. It is designed for use in decentralized identity (DID) systems on EVM-compatible blockchains.
The LLM identified 5 files worth highlighting for reuse:
Core identity contract implementing ERC-734 and ERC-735. Manages keys with purposes (MANAGEMENT, ACTION, CLAIM, ENCRYPTION), handles claim lifecycle (add, remove, get), supports execution of actions with approval workflow, and includes signature recovery with EIP-2 malleability checks. Designed for use as a proxy implementation with a delegatedOnly modifier and an initialize function. Demonstrates clean separation of storage and logic, and robust permission handling.
Extends Identity to act as a claim issuer. Adds claim revocation by signature (preferred) or by claim ID (deprecated). Implements isClaimValid to verify claims using ECDSA recovery and key purpose checks. Prevents revocation of already revoked claims. Demonstrates a secure revocation pattern and integration with identity contracts.
Factory contract for deploying identity proxies using CREATE2. Supports creating identities for wallets (with optional multiple management keys) and tokens. Manages wallet-to-identity linking, token factory registration, and salt uniqueness. Uses an immutable ImplementationAuthority reference for upgradeability. Demonstrates deterministic deployment and complex state management across multiple mappings.
Gateway contract that authorizes identity deployment via off-chain signatures from approved signers. Supports custom salt, management keys, signature expiry, and signature revocation. Uses ECDSA recovery and custom errors for clear failure modes. Demonstrates a secure pattern for delegating deployment authority while maintaining control through signer management.
Verifier contract that checks if an identity holds valid claims from trusted issuers for required topics. Manages trusted issuers and their claim topics, supports adding/removing issuers and topics, and provides a verify function that iterates over required topics and validates claims. Uses try/catch for robust external calls. Demonstrates a flexible on-chain verification pattern for identity compliance.