How iotaledger/identity works
Project Type and Purpose
• This is an open-source, multi-crate Rust library (monorepo) implementing Self-Sovereign Identity (SSI) with W3C DID & Verifiable Credentials.
• Provides language agnostic core crates, plus IOTA-specific DID method implementations, and FFI bindings for WebAssembly (JavaScript/TypeScript) and gRPC services.
Logical Layers & Top-Level Structure
• Root Workspace (Cargo.toml)
• Core Layer:
• identity_core
• identity_document
• identity_credential
• identity_did
• Crypto & Verification Layer:
• identity_jose (JWS/JWT)
• identity_verification (verification methods)
• identity_ecdsa_verifier, identity_eddsa_verifier, identity_pqc_verifier
• Storage & Key Management Layer:
• identity_storage (abstract storage)
• identity_stronghold (secure vault implementation)
• IOTA Integration Layer:
• identity_iota (IOTA DID method)
• identity_iota_core (Rebased network adapter + Move VM interactions)
• identity_resolver (DID resolution commands)
• Bindings Layer:
• bindings/wasm/identity_wasm (WASM build, TS API)
• bindings/grpc (proto definitions, gRPC server)
• Examples and Tests
Component Interactions & Data Flow
• External Client (Rust app, Node.js/TS, or gRPC consumer)
→ invokes high-level APIs exposed by the WASM module or gRPC service
→ FFI Binding Layer routes calls into native Rust crates
→ Core Layer handles generic DID/VC operations (create, sign, verify)
→ Crypto Layer uses JOSE and verifier crates to encode/decode JWS/JWT, SD-JWT, ZKP
→ Storage Layer persists keys and state (in-memory, Stronghold, custom backends)
→ IOTA Layer publishes DID documents to the Tangle, resolves documents via IOTA node
→ Resolver Layer orchestrates fetching and parsing DID documents from various methods
→ Results bubble back to the client
Architectural Patterns & Principles
• Modular crate-based design (separation of concerns, single responsibility)
• Layered architecture (Core, Crypto, Storage, Network, Bindings)
• Plugin-style DID method support (method-agnostic core + iota-specific implementation)
• FFI abstraction (Binding crates isolate environment-specific code)
• Dependency inversion for storage and network adapters (swapable backends)
Elements
• Components:
• Client Layer (Rust App, JS/TS Browser, gRPC Consumer)
• Binding Layer (WASM, gRPC Server)
• Core Crates Layer (document, credential, DID, core types)
• Crypto Layer (JOSE, verifier crates)
• Storage Layer (identity_storage interface, Stronghold vault)
• IOTA Layer (network adapter, Move VM module)
• Resolver Layer (DID resolution)
• Rectangles for Rust crates
• Clouds for external networks (IOTA node)
• Rounded rectangles for FFI bindings
• Clear Labels: component names, interfaces (e.g., “StorageAdapter”, “__wbindgen_exports__”), protocols (gRPC, HTTP/web).
Putting It All Together
• Within Core, show two sub-flows:
• Crypto Flow → identity_jose + verifier crates → Storage Layer → IOTA Layer → network
• Resolution Flow → identity_resolver → IOTA node fetch → parsing back into core types
• “Supports plugin for custom storage backends” and “Supports multiple signature algorithms via JOSE.”