Core Module
The Core module (marmot-ts/core) implements the Marmot protocol layer, providing the fundamental building blocks for privacy-preserving group messaging. It bridges MLS (Message Layer Security) cryptographic operations with Nostr's decentralized event distribution.
What's in the Core Module
The Core module is responsible for:
- Protocol Implementation: MLS group operations following Marmot specifications (MIP-00 through MIP-03)
- Identity Bridging: Converting Nostr public keys to MLS credentials
- Message Encryption: NIP-44 encryption layered over MLS for group messages
- Key Package Management: Creating and handling cryptographic material for member addition
- State Serialization: Encoding/decoding group state for persistence
Key Dependencies
- ts-mls - RFC 9420 compliant MLS implementation
- nostr-tools - Nostr event handling and NIP-44 encryption
- @noble/hashes - Cryptographic hashing
Installation
import {
createCredential,
generateKeyPackage,
createGroup,
// ... other exports
} from "@internet-privacy/marmots";Topics
Protocol Constants & Concepts
Learn about Nostr event kinds, extension types, and core protocol concepts like MarmotGroupData.
Credentials
Understand how Nostr identities are converted to MLS credentials.
Key Packages
Generate and manage key packages for adding members to groups.
Groups
Create and initialize MLS groups with Marmot metadata.
Messages
Handle message encryption, decryption, commit ordering, and application messages.
Members
Query and manage group membership, including multi-device support.
Welcome Messages
Create and process Welcome messages for new members.
Key Package Distribution
Publish and discover key packages using Nostr events.
Client State
Manage and serialize MLS group state for persistence.
Complete API documentation for all Core module functions.
When to Use Core
Use the Core module when you need:
- Fine-grained control over MLS operations
- Custom client implementations with specific requirements
- Protocol extensions or implementing new MIPs
- Research and experimentation with the protocol
- Understanding of the underlying protocol layer
For most applications, use the Client module instead, which provides a higher-level API built on top of Core.
Protocol Compliance
The Core module implements the following Marmot Improvement Proposals:
