Validation Levels
LibXMTP performs validation at two levels:- MLS protocol validation - Implemented by OpenMLS
- Application-level validation - XMTP-specific credential and identity validation
MLS Credentials
The MLS credential used in key packages and leaf nodes contains a single field:inbox_id.
Credential Structure
- Resolve the state of the
inbox_id(as described in XIP-46) - Ensure the installation key that signed the credential is a current member of the inbox
XMTP does not implement credential rotation because credentials represent a long-lived connection between the MLS client and the
inbox_id.Identity Association Types
When linking installation keys to an inbox, XMTP supports three signature types:1. EOA (Externally Owned Account) Wallet Signatures
Standard Ethereum wallet signatures using ECDSA. Validation process:- Recover the signer address using ECDSA signature recovery
- Verify the recovered address matches the expected address
- Ensure the signature text matches exactly (prevents random address recovery)
crates/xmtp_id/src/associations/ident/ethereum.rs
2. Smart Contract Wallet Signatures
Smart contract wallets require on-chain validation per ERC-1271. Key characteristics:- Signatures are not recoverable (unlike EOA)
- Validation requires calling the smart contract’s
isValidSignature()function - Smart contract code is mutable - a valid signature may become invalid later
- Deployed smart contract wallets
- Counterfactual smart contract wallets (not yet deployed)
crates/xmtp_id/src/scw_verifier/
3. V2 Legacy Key Signatures
XMTP V2 used a different identity model. To enable migration, V2 keys can create associations under strict limitations. Enforcement mechanisms:- V2 keys can only be used on an Inbox ID with
nonce = 0 - Replay protection prevents reuse of V2 keys on the same inbox
- Recover wallet address from the signature on the V2 public key
- Verify the signature on the association challenge recovers to the same V2 public key
- If both validate, treat the association as if signed by the wallet
crates/xmtp_id/src/associations/signature.rs:194-267
Inbox ID Creation
Inbox IDs are deterministically derived from wallet addresses:CreateInbox Action
When creating a new inbox, the signature must be from an address where:nonce = 0 and V2 keys are available, CreateInbox can be signed with V2 keys instead of the wallet (one-time migration).
AddAssociation Action
When adding an installation to an existing inbox:- Installation keys sign the association text
- An existing member of the inbox must also sign (wallet or installation key)
- The existing member must not be revoked
V2 keys can only sign
AddAssociation if nonce = 0 and the V2 keys have not been used for any previous identity updates.Signature Re-use Protection
The system prevents signature replay attacks:Between Inboxes
Theinbox_id is included in all signature challenge text, making signatures inbox-specific.
Within an Inbox
Raw signature bytes are stored in theAssociationState:
seen_signatures to prevent replay.
Location: crates/xmtp_id/src/associations/state.rs:62-63
Key Package Validation
When validating another user’s key package:Standard MLS Validation
- Signature verification
- Message authenticity checks
- Lifetime validation
- Protocol version compatibility
XMTP-Specific Validation
-
Extract the credential:
-
Download identity updates:
-
Resolve association state:
-
Verify installation key is associated:
crates/xmtp_mls/src/verified_key_package_v2.rs
Commit Validation
In addition to OpenMLS validation, libxmtp validates commits by:- Permission checks: Ensure the commit is allowed per group policies
- Credential validation: Validate credentials and key packages of new members
- Membership consistency: Ensure MLS group member changes match the expected diff from the
GroupMembershipextension
What happens if an invalid commit is received?
What happens if an invalid commit is received?
Currently, there is no mechanism to detect, report, or recover from group splits due to invalid commits. This may need to be handled at the application level.
Signature Normalization
To prevent signature malleability, XMTP normalizes ECDSA signatures to use the lower-s value:crates/xmtp_id/src/associations/signature.rs:270-295
Related Documentation
- Security Overview - Overall security properties
- Key Rotation - Key package lifecycle
- Revocation - How to revoke installations
