Private Messages on Nostr with MLS

What is MLS (Message Layer Security)? How is it different from what we had in Nostr? Read on!

rod ✪

14. Juli 2025July 14, 2025 · 10 Min. Lesezeit10 min read

With 0xChat Lite and White Noise appearing in the Nostr Ecosystem, some wonder, What is the difference? What is the novelty?

The answer is the implementation of the MLS NIP (NIP-EE, as proposed in Pull Request #1427), which introduces a new approach to private messaging on Nostr using the Messaging Layer Security (MLS) protocol, differing significantly from older NIPs like the obsolete NIP-04 (which leaks metadata) and NIP-17 (a quite decent and safe option, currently in 0xChat and Amethyst), which were designed for private direct messages (DMs) and small group chats.

Below is a detailed comparison of MLS NIP (NIP-EE) and the older NIPs (NIP-04 and NIP-17) in terms of their approach to private messaging on Nostr:

1. Protocol Foundation#


2. Security Features#

Key Difference: MLS NIP provides robust FS and PCS through key rotation and MLS’s tree-based key management, making it far more secure for both direct and group messaging. NIP-04 lacks FS, PCS, and message authentication, while NIP-17 improves metadata privacy but still lacks inherent FS and PCS and is inefficient for large groups.


3. Group Messaging Support#

Key Difference: MLS NIP is optimized for group messaging with efficient key management and scalability, while NIP-04 is limited to one-to-one DMs, and NIP-17’s group messaging is inefficient and not scalable for large groups.


4. Metadata Privacy#

Key Difference: NIP-17 offers stronger metadata privacy through gift-wrapping and timestamp randomization, while MLS NIP relies on careful relay selection and client-side mitigations, as MLS focuses more on content encryption than metadata hiding.


5. Encryption Mechanism#

Key Difference: MLS NIP uses a dynamic, tree-based encryption system with key rotation for FS and PCS, while NIP-04 and NIP-17 use simpler, static key-based encryption (AES-256-CBC and ChaCha20, respectively), with NIP-17 adding metadata protections but no inherent key rotation.


6. Implementation Complexity#

Key Difference: MLS NIP is more complex due to its advanced cryptographic framework and group messaging support, while NIP-04 and NIP-17 are simpler but less secure and scalable.


7. Use Case Suitability#

Key Difference: MLS NIP is better for scalable, high-security group messaging, while NIP-04 is limited to basic one-to-one DMs, and NIP-17 balances metadata privacy with small group support but lacks scalability and advanced security.


Summary Table#

Feature MLS NIP (NIP-EE) NIP-04 NIP-17
Protocol MLS (tree-based, scalable group messaging) AES-256-CBC (static key, one-to-one) NIP-44 (ChaCha20) + NIP-59 gift-wrapping (small groups)
Forward Secrecy Yes (key rotation per epoch) No (static conversation key) Optional (via expiration tags, not inherent)
Post-Compromise Security Yes (via key rotation) No No
Group Messaging Scalable (logarithmic key updates) Not supported Supported (up to ~100, inefficient)
Metadata Privacy Moderate (relies on relay selection, freshness checks) Poor (recipient pubkey in tags) Strong (gift-wrapping, randomized timestamps)
Encryption MLS encryption + NIP-44 for content AES-256-CBC (no authentication) ChaCha20 (NIP-44) with HKDF-derived keys
Complexity High (MLS library integration, key management) Low (simple ECDH + AES) Moderate (NIP-44 + NIP-59)
Use Case High-security group and direct messaging Basic one-to-one DMs (outdated) Private DMs and small groups with metadata privacy

Conclusion#

The MLS NIP (NIP-EE) is a significant advancement over NIP-04 and NIP-17, offering scalable group messaging, forward secrecy, and post-compromise security through the MLS protocol. It is better suited for modern, secure, and scalable private messaging, particularly for larger groups or high-security scenarios. However, it is more complex to implement and relies on careful relay selection for metadata privacy. NIP-04 is outdated due to its lack of FS, PCS, and metadata protections, while NIP-17 improves on NIP-04 with better metadata privacy and small group support but remains inefficient for large groups and lacks inherent FS and PCS. For high-risk use cases, MLS NIP is the preferred choice, but NIP-17 may suffice for smaller, less sensitive conversations where metadata privacy is a priority.

#1427

Written by

Comments

No comments yet. Start the conversation.