Overview
Thexmtp_id crate implements XMTP’s identity system as specified in XIP-46. It provides identity management, wallet associations, signature verification, and smart contract wallet support for the XMTP protocol.
Installation
Key Exports
Global InboxID owned type. Represents a unique identifier for a user’s inbox.
Reference type for InboxID. Used for passing inbox IDs without ownership transfer.
String type representing a blockchain wallet address.
Represents an update to an inbox’s identity state.Fields:
sequence_id: u64- Sequential identifier for ordering updatesserver_timestamp_ns: u64- Server timestamp in nanosecondsupdate: UnverifiedIdentityUpdate- The identity update payload
Core Modules
associations
Manages identity associations between wallets and installations:- Creating inbox associations
- Adding new wallet associations
- Revoking associations
- Verifying association states
scw_verifier
Smart Contract Wallet (SCW) signature verification:- ERC-1271 signature validation
- Chain-specific verification
- Contract interaction for signature checks
constants
Protocol constants and configuration values.utils
Utility functions for identity operations.Main Types and Traits
Trait for types that can own an inbox and sign messages.Methods:
get_identifier() -> Result<Identifier>- Get the wallet/account identifiersign(text: &str) -> Result<UnverifiedSignature>- Sign a text message
Trait for types that can be referenced as an InboxId.Method:
as_ref() -> InboxIdRef- Get a reference to the inbox ID
Represents different types of identifiers in the system:
- Ethereum addresses
- Installation keys
- Other blockchain addresses
Identifies a member in an association state (wallet or installation).
Represents the current state of an inbox’s associations.Key Fields:
- List of associated wallet addresses
- List of associated installations
- Recovery addresses
- Association history
A signature that has not yet been verified.Variants:
RecoverableEcdsa- ECDSA signature with recovery IDInstallationKey- EdDSA signature from installation keyLegacyDelegated- Legacy delegated signature format
A signature that has been cryptographically verified.Key Methods:
verify()- Verify the signaturesigner()- Get the signer identifier
Usage Examples
Implementing InboxOwner for a Wallet
Working with Inbox IDs
Managing Associations
Verifying Identity Updates
Smart Contract Wallet Verification
Association Types
Action to create a new inbox with initial wallet association.Fields:
nonce: u64- Unique nonce for inbox creationaccount_identifier: Identifier- Initial wallet/accountinitial_identifier_signature: VerifiedSignature- Signature proof
Action to add a new member to an inbox.Fields:
existing_member_signature: VerifiedSignature- Signature from existing membernew_member_signature: VerifiedSignature- Signature from new membernew_member_identifier: MemberIdentifier- New member to add
Action to revoke an existing association.Fields:
recovery_address_signature: VerifiedSignature- Signature from recovery addressrevoked_member: MemberIdentifier- Member to revoke
Action to change the recovery address.Fields:
existing_recovery_address_signature: VerifiedSignaturenew_recovery_address: String
Error Types
Features
Testing utilities including mock implementations and test helpers.
Platform Support
- Native (all platforms)
- WebAssembly (with getrandom wasm_js feature)
Dependencies
Key dependencies:alloy- Ethereum wallet and signinged25519-dalek- EdDSA signaturesxmtp_cryptography- Cryptographic primitivesxmtp_proto- Protocol buffer definitions
