InboxId and InstallationId
InboxId
TheInboxId is a unique identifier for an inbox, generated from a wallet address and nonce:
member.rs:168-176 for the implementation.
InstallationId
AnInstallationId represents a specific device or application installation:
InboxOwner Trait
TheInboxOwner trait defines how wallets interact with the identity system:
lib.rs:90-123 for the trait definition and implementations.
Implementation Example
InboxOwner trait is automatically implemented for references:
Identity Structure
TheIdentity struct represents a user’s complete identity within the XMTP network:
identity.rs:294-301 for the struct definition.
Key Methods
Creating an Identity
Identities are created through theIdentityStrategy system:
For New Inboxes
For Existing Inboxes
If a wallet is already associated with an inbox:identity.rs:358-441 for the creation flow.
With Legacy Key (V2 Migration)
Installation Management
Querying Installations
Adding an Installation
builder.rs:83-99 for the add_association method.
Revoking Installations
identity_updates.rs:125-140 for the revoke helper.
Key Package Management
Key packages are cryptographic bundles that allow others to add the identity to groups:Generating Key Packages
Rotating Key Packages
Key packages should be rotated periodically:KEY_PACKAGE_ROTATION_INTERVAL_NS.
See identity.rs:640-675 for rotation implementation.
Registration Flow
Registering an identity involves:- Creating or loading the identity
- Generating and uploading key packages
- Storing the identity locally
identity.rs:609-628 for the registration method.
Identity Errors
Common errors when working with identities:identity.rs:188-272 for all error types.
Best Practices
- Cache identities - Use
IdentityStrategy::CachedOnlywhen possible to avoid network calls - Rotate key packages - Implement periodic rotation for forward secrecy
- Limit installations - Be aware of
MAX_INSTALLATIONS_PER_INBOX(typically 100) - Handle legacy migration - Legacy keys can only be used once with nonce 0
- Verify inbox associations - Always load and verify identity updates from the network
Related Pages
- Overview - Identity system concepts
- Associations - Managing wallet and installation associations
References
- Source:
crates/xmtp_id/src/lib.rs - Source:
crates/xmtp_mls/src/identity.rs - Source:
crates/xmtp_id/src/associations/member.rs
