Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/codeql/codeql-config.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/codeql.yml

This file was deleted.

120 changes: 120 additions & 0 deletions .github/workflows/publish-crates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Publish to crates.io

on:
release:
types: [published]

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

jobs:
publish-storage-traits:
runs-on: ubuntu-latest
name: Publish mdk-storage-traits

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: publish-storage-traits

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config

- name: Publish mdk-storage-traits
run: cargo publish -p mdk-storage-traits
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-memory-storage:
needs: publish-storage-traits
runs-on: ubuntu-latest
name: Publish mdk-memory-storage

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: publish-memory-storage

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config

- name: Wait for mdk-storage-traits to be indexed
run: sleep 30

- name: Publish mdk-memory-storage
run: cargo publish -p mdk-memory-storage
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-sqlite-storage:
needs: publish-storage-traits
runs-on: ubuntu-latest
name: Publish mdk-sqlite-storage

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: publish-sqlite-storage

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config

- name: Wait for mdk-storage-traits to be indexed
run: sleep 30

- name: Publish mdk-sqlite-storage
run: cargo publish -p mdk-sqlite-storage
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-core:
needs: [publish-memory-storage, publish-sqlite-storage]
runs-on: ubuntu-latest
name: Publish mdk-core

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: publish-core

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config

- name: Wait for dependencies to be indexed
run: sleep 30

- name: Publish mdk-core
run: cargo publish -p mdk-core --all-features
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024-2025 Parres
Copyright (c) 2024-2026 Internet Privacy Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ Add MDK to your `Cargo.toml`:

```toml
[dependencies]
mdk-core = "0.5.0"
mdk-memory-storage = "0.5.0" # For in-memory storage
mdk-core = "0.6.0"
mdk-memory-storage = "0.6.0" # For in-memory storage
# OR
mdk-sqlite-storage = "0.5.0" # For persistent SQLite storage
mdk-sqlite-storage = "0.6.0" # For persistent SQLite storage
```

### Feature Flags
Expand All @@ -110,7 +110,7 @@ mdk-sqlite-storage = "0.5.0" # For persistent SQLite storage

```toml
[dependencies]
mdk-core = { version = "0.5.0", features = ["mip04"] }
mdk-core = { version = "0.6.0", features = ["mip04"] }
```

## 🚀 Quick Start
Expand Down
6 changes: 2 additions & 4 deletions crates/mdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@

### Added

- **`clear_pending_commit` method**: Added `MDK::clear_pending_commit(group_id)` to allow callers to roll back an uncommitted pending MLS commit. This is essential for recovering from failed relay publishes — without it, a single failed publish permanently blocks all future group operations with "pending commit exists" errors. Wraps OpenMLS's `MlsGroup::clear_pending_commit` with MDK's group-loading and error handling. ([#192](https://github.com/marmot-protocol/mdk/pull/192))

### Fixed

- **`clear_pending_commit` orphaned keypair**: When `clear_pending_commit` rolls back a `self_update` pending commit, it now deletes the new `SignatureKeyPair` that was eagerly stored in the provider during `self_update`. Previously, repeated failed self-update publishes would accumulate unreachable private key material in storage. ([#197](https://github.com/marmot-protocol/mdk/pull/197))

### Removed

### Deprecated
Expand Down Expand Up @@ -93,6 +89,7 @@

### Added

- **`clear_pending_commit` method**: Added `MDK::clear_pending_commit(group_id)` to allow callers to roll back an uncommitted pending MLS commit. This is essential for recovering from failed relay publishes — without it, a single failed publish permanently blocks all future group operations with "pending commit exists" errors. Wraps OpenMLS's `MlsGroup::clear_pending_commit` with MDK's group-loading and error handling. ([#192](https://github.com/marmot-protocol/mdk/pull/192))
- **Self-update tracking**: `accept_welcome()` now sets `self_update_state` to `SelfUpdateState::Required` on the joined group (MIP-02 post-join obligation). `merge_pending_commit()` detects pure self-update commits and transitions the state to `SelfUpdateState::CompletedAt(now)`, recording the rotation timestamp for MIP-00 periodic staleness checks. `create_group()` initializes the state to `SelfUpdateState::NotRequired` (creator has no immediate obligation). ([#184](https://github.com/marmot-protocol/mdk/pull/184))
- **`groups_needing_self_update()` method**: Returns group IDs of active groups that need a self-update, either because the state is `Required` or because the last rotation is older than a configurable threshold. ([#184](https://github.com/marmot-protocol/mdk/pull/184))
- **KeyPackageRef `i` tag for efficient relay queries**: KeyPackage events now include an `i` tag with the hex-encoded `KeyPackageRef` (computed per RFC 9420 Section 5.2). This enables efficient relay queries for specific KeyPackages when processing Welcome messages, avoiding the need to download and decode all KeyPackage events. ([#182](https://github.com/marmot-protocol/mdk/pull/182))
Expand Down Expand Up @@ -128,6 +125,7 @@

### Fixed

- **`clear_pending_commit` orphaned keypair**: When `clear_pending_commit` rolls back a `self_update` pending commit, it now deletes the new `SignatureKeyPair` that was eagerly stored in the provider during `self_update`. Previously, repeated failed self-update publishes would accumulate unreachable private key material in storage. ([#197](https://github.com/marmot-protocol/mdk/pull/197))
- **Welcome validation no longer requires `client` tag**: The `validate_welcome_event` function now correctly treats the `client` tag as optional per MIP-02. Previously, welcome events without a `client` tag were rejected, which would cause spec-compliant third-party implementations to be unable to send Welcome events to MDK-based clients. ([#186](https://github.com/marmot-protocol/mdk/pull/186))
- **Security dependency updates**: Updated `time` (0.3.44 → 0.3.47), `bytes` (1.11.0 → 1.11.1), and `lru` (0.16.2 → 0.16.3) to resolve Dependabot security advisories. ([#174](https://github.com/marmot-protocol/mdk/pull/174))
- **Message Ordering Consistency**: Fixed inconsistency where `group.last_message_id` might not match `get_messages()[0].id` due to different sorting logic. The `last_message_id` update logic now uses `created_at DESC, processed_at DESC, id DESC` ordering to match the `messages()` query, ensuring the first message returned is always the same as `last_message_id`. Added `last_message_processed_at` field to `Group` to track this secondary sort key. ([#166](https://github.com/marmot-protocol/mdk/pull/166))
Expand Down
21 changes: 21 additions & 0 deletions crates/mdk-core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-2026 Internet Privacy Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 5 additions & 11 deletions crates/mdk-core/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# Nostr Messaging Layer Security (MLS)
# mdk-core

## Description

A simplified interface to build secure messaging apps on nostr with MLS ([RFC 9420](https://datatracker.ietf.org/doc/html/rfc9420)),
according to [NIP-EE](https://github.com/nostr-protocol/nips/pull/1427).
A simplified interface to build secure messaging apps on Nostr with MLS ([RFC 9420](https://www.rfc-editor.org/rfc/rfc9420.html)),
implementing the [Marmot Protocol](https://github.com/marmot-protocol/marmot).

## Changelog

All notable changes to this library are documented in the [CHANGELOG.md](CHANGELOG.md).

## State

**This library is in an ALPHA state**, things that are implemented generally work but the API will change in breaking ways.

## Donations

`rust-nostr` is free and open-source. This means we do not earn any revenue by selling it. Instead, we rely on your financial support. If you actively use any of the `rust-nostr` libs/software/services, then please [donate](https://rust-nostr.org/donate).
**This library is in an ALPHA state.** Things that are implemented generally work, but the API may change in breaking ways.

## License

This project is distributed under the MIT software license - see the [LICENSE](../../LICENSE) file for details
This project is distributed under the MIT software license - see the [LICENSE](https://github.com/marmot-protocol/mdk/blob/master/LICENSE) file for details, or visit <https://opensource.org/licenses/MIT>.
2 changes: 1 addition & 1 deletion crates/mdk-memory-storage/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
- **Epoch Lookup by Tag Content**: Implemented `find_message_epoch_by_tag_content` for in-memory storage, scanning cached group messages and matching serialized tags. ([#167](https://github.com/marmot-protocol/mdk/pull/167))
- **Retryable Message Support**: Updated storage implementation to handle `ProcessedMessageState::Retryable` transitions and persistence. ([#161](https://github.com/marmot-protocol/mdk/pull/161))
- **MLS Storage Module**: New `mls_storage` module with complete `StorageProvider<1>` implementation for OpenMLS integration ([#148](https://github.com/marmot-protocol/mdk/pull/148))
- JSON codec for serializing/deserializing OpenMLS types
- Postcard codec (`MlsCodec`) for serializing/deserializing OpenMLS types ([#179](https://github.com/marmot-protocol/mdk/pull/179))
- Support for all 53 `StorageProvider<1>` methods
- In-memory storage using `HashMap` for all MLS data types
- **Snapshot Support**: New `snapshot` module for creating and restoring storage snapshots, useful for testing rollback scenarios ([#148](https://github.com/marmot-protocol/mdk/pull/148))
Expand Down
21 changes: 21 additions & 0 deletions crates/mdk-memory-storage/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-2026 Internet Privacy Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading