Skip to content

Commit 14ddf55

Browse files
committed
chore(Cargo): bump rust-nostr to version 0.44
1 parent 21bda1a commit 14ddf55

File tree

11 files changed

+34
-24
lines changed

11 files changed

+34
-24
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ openmls_basic_credential = { git = "https://github.com/openmls/openmls", rev = "
2525
openmls_rust_crypto = { git = "https://github.com/openmls/openmls", rev = "b90ca23b1238d9e189142d06234527b2d344d748", default-features = false }
2626

2727
# Nostr
28-
nostr = { version = "0.43", default-features = false }
28+
nostr = { version = "0.44", default-features = false }
2929

3030
# Serialization
3131
serde = { version = "1.0", default-features = false }

crates/mdk-core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
2424
## Unreleased
2525
26+
### Changed
27+
28+
- Upgraded `nostr` dependency from 0.43 to 0.44, replacing deprecated `Timestamp::as_u64()` calls with `Timestamp::as_secs()`
29+
2630
### Added
2731
2832
- Configurable `out_of_order_tolerance` and `maximum_forward_distance` in `MdkConfig` for MLS sender ratchet settings. Default `out_of_order_tolerance` increased from 5 to 100 for better handling of out-of-order message delivery on Nostr relays. ([`#155`](https://github.com/marmot-protocol/mdk/pull/155))

crates/mdk-core/src/messages.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ where
971971
&group_id,
972972
current_epoch,
973973
&event.id,
974-
event.created_at.as_u64(),
974+
event.created_at.as_secs(),
975975
) {
976976
tracing::warn!(
977977
target: "mdk_core::messages::process_commit_message_for_group",
@@ -1155,24 +1155,24 @@ where
11551155
let now = Timestamp::now();
11561156

11571157
// Reject events from the future (allow configurable clock skew)
1158-
if event.created_at.as_u64()
1158+
if event.created_at.as_secs()
11591159
> now
1160-
.as_u64()
1160+
.as_secs()
11611161
.saturating_add(self.config.max_future_skew_secs)
11621162
{
11631163
return Err(Error::InvalidTimestamp(format!(
11641164
"event timestamp {} is too far in the future (current time: {})",
1165-
event.created_at.as_u64(),
1166-
now.as_u64()
1165+
event.created_at.as_secs(),
1166+
now.as_secs()
11671167
)));
11681168
}
11691169

11701170
// Reject events that are too old (configurable via MdkConfig)
1171-
let min_timestamp = now.as_u64().saturating_sub(self.config.max_event_age_secs);
1172-
if event.created_at.as_u64() < min_timestamp {
1171+
let min_timestamp = now.as_secs().saturating_sub(self.config.max_event_age_secs);
1172+
if event.created_at.as_secs() < min_timestamp {
11731173
return Err(Error::InvalidTimestamp(format!(
11741174
"event timestamp {} is too old (minimum acceptable: {})",
1175-
event.created_at.as_u64(),
1175+
event.created_at.as_secs(),
11761176
min_timestamp
11771177
)));
11781178
}
@@ -1401,7 +1401,7 @@ where
14011401
&group.mls_group_id,
14021402
mls_group.epoch().as_u64(),
14031403
&event.id,
1404-
event.created_at.as_u64(),
1404+
event.created_at.as_secs(),
14051405
)
14061406
.is_err()
14071407
{
@@ -1630,7 +1630,7 @@ where
16301630
self.storage(),
16311631
&group.mls_group_id,
16321632
msg_epoch,
1633-
event.created_at.as_u64(),
1633+
event.created_at.as_secs(),
16341634
&event.id,
16351635
);
16361636

@@ -3165,9 +3165,9 @@ mod tests {
31653165
);
31663166

31673167
// Allow for some clock skew, but message shouldn't be more than a day old
3168-
let one_day_ago = now.as_u64().saturating_sub(86400);
3168+
let one_day_ago = now.as_secs().saturating_sub(86400);
31693169
assert!(
3170-
message_event.created_at.as_u64() > one_day_ago,
3170+
message_event.created_at.as_secs() > one_day_ago,
31713171
"Message timestamp should be recent"
31723172
);
31733173
}
@@ -6562,7 +6562,7 @@ mod tests {
65626562
.expect("Group should exist");
65636563

65646564
// Set timestamp to far future (1 hour ahead, beyond 5 minute skew allowance)
6565-
let future_time = nostr::Timestamp::now().as_u64() + 3600;
6565+
let future_time = nostr::Timestamp::now().as_secs() + 3600;
65666566

65676567
// Create an event with future timestamp
65686568
let message_event = EventBuilder::new(Kind::MlsGroupMessage, "test content")
@@ -6597,7 +6597,7 @@ mod tests {
65976597
.expect("Group should exist");
65986598

65996599
// Set timestamp to 46 days ago (beyond 45 day limit)
6600-
let old_time = nostr::Timestamp::now().as_u64().saturating_sub(46 * 86400);
6600+
let old_time = nostr::Timestamp::now().as_secs().saturating_sub(46 * 86400);
66016601

66026602
// Create an event with old timestamp
66036603
let message_event = EventBuilder::new(Kind::MlsGroupMessage, "test content")

crates/mdk-core/src/test_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl RaceConditionSimulator {
233233

234234
/// Get a timestamp offset from the base by the specified number of seconds
235235
pub fn timestamp_offset(&self, offset_seconds: i64) -> nostr::Timestamp {
236-
let new_timestamp = (self.base_timestamp.as_u64() as i64 + offset_seconds).max(0) as u64;
236+
let new_timestamp = (self.base_timestamp.as_secs() as i64 + offset_seconds).max(0) as u64;
237237
nostr::Timestamp::from(new_timestamp)
238238
}
239239
}

crates/mdk-sqlite-storage/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
### Changed
3131

32+
- Upgraded `nostr` dependency from 0.43 to 0.44, replacing deprecated `Timestamp::as_u64()` calls with `Timestamp::as_secs()`
3233
- **Persistent Snapshots**: Implemented snapshot support by copying group-specific rows to a dedicated snapshot table. `create_group_snapshot`, `rollback_group_to_snapshot`, and `release_group_snapshot` persist across app restarts. ([#152](https://github.com/marmot-protocol/mdk/pull/152))
3334
- **Unified Storage Architecture**: `MdkSqliteStorage` now directly implements OpenMLS's `StorageProvider<1>` trait instead of wrapping `openmls_sqlite_storage`. This enables atomic transactions across MLS and MDK state, which is required for proper commit race resolution per MIP-03. ([#148](https://github.com/marmot-protocol/mdk/pull/148))
3435
- Removed `openmls_sqlite_storage` dependency

crates/mdk-sqlite-storage/src/groups.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl GroupStorage for MdkSqliteStorage {
113113

114114
let last_message_id: Option<&[u8; 32]> =
115115
group.last_message_id.as_ref().map(|id| id.as_bytes());
116-
let last_message_at: Option<u64> = group.last_message_at.as_ref().map(|ts| ts.as_u64());
116+
let last_message_at: Option<u64> = group.last_message_at.as_ref().map(|ts| ts.as_secs());
117117

118118
self.with_connection(|conn| {
119119
conn.execute(

crates/mdk-sqlite-storage/src/messages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl MessageStorage for MdkSqliteStorage {
6565
message.pubkey.as_bytes(),
6666
message.kind.as_u16(),
6767
message.mls_group_id.as_slice(),
68-
message.created_at.as_u64(),
68+
message.created_at.as_secs(),
6969
&message.content,
7070
&tags_json,
7171
&event_json,
@@ -123,7 +123,7 @@ impl MessageStorage for MdkSqliteStorage {
123123
params![
124124
&processed_message.wrapper_event_id.to_bytes(),
125125
&message_event_id,
126-
&processed_message.processed_at.as_u64(),
126+
&processed_message.processed_at.as_secs(),
127127
&processed_message.epoch,
128128
&mls_group_id,
129129
&processed_message.state.to_string(),

crates/mdk-sqlite-storage/src/welcomes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl WelcomeStorage for MdkSqliteStorage {
171171
params![
172172
processed_welcome.wrapper_event_id.as_bytes(),
173173
welcome_event_id,
174-
processed_welcome.processed_at.as_u64(),
174+
processed_welcome.processed_at.as_secs(),
175175
processed_welcome.state.as_str(),
176176
&processed_welcome.failure_reason
177177
],

crates/mdk-uniffi/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
### Breaking changes
2929

3030
- **Security (Audit Issue M)**: Changed `get_message()` to require both `mls_group_id` and `event_id` parameters. This prevents messages from different groups from overwriting each other by scoping lookups to a specific group. ([#124](https://github.com/marmot-protocol/mdk/pull/124))
31+
32+
### Changed
33+
34+
- Upgraded `nostr` dependency from 0.43 to 0.44, replacing deprecated `Timestamp::as_u64()` calls with `Timestamp::as_secs()`
3135
- Changed `get_messages()` to accept optional `limit` and `offset` parameters for pagination control. Existing calls must be updated to pass `None, None` for default behavior (limit: 1000, offset: 0), or specify values for custom pagination. ([#111](https://github.com/marmot-protocol/mdk/pull/111))
3236
- Changed `get_pending_welcomes()` to accept optional `limit` and `offset` parameters for pagination control. Existing calls must be updated to pass `None, None` for default behavior (limit: 1000, offset: 0), or specify values for custom pagination. ([#119](https://github.com/marmot-protocol/mdk/pull/119))
3337
- Changed `new_mdk()`, `new_mdk_with_key()`, and `new_mdk_unencrypted()` to accept an optional `MdkConfig` parameter for customizing MDK behavior. Existing calls must be updated to pass `None` for default behavior. ([`#155`](https://github.com/marmot-protocol/mdk/pull/155))

0 commit comments

Comments
 (0)