Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Key Update Before Every New GroupIntent #658

Closed
wants to merge 34 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8e87ba7
queue_key_update
Apr 15, 2024
9df8308
lint
Apr 15, 2024
60e8adc
lint
Apr 15, 2024
cb88c9e
merge main
Apr 15, 2024
3438591
queue key update test
Apr 16, 2024
0e9d812
key-update
Apr 22, 2024
1624a05
Fix paths in update-schema script
richardhuaaa Apr 22, 2024
7d0dade
merge master and add rotated_at_ns item
Apr 30, 2024
e62cdfc
add get_rotated_at_ns
Apr 30, 2024
5f35add
fetch rotated_at_ns
May 1, 2024
928bca4
Merge remote-tracking branch 'origin' into dz/key-update
May 1, 2024
b319f56
add pre_intent_hook
May 6, 2024
ed6e1dd
Revert unneeded fix, and specify the correct directory in the README …
richardhuaaa May 13, 2024
cd28efd
apply pre_intent_hook
May 16, 2024
c160c14
Merge remote-tracking branch 'origin' into dz/key-update
May 16, 2024
e1b5f56
merge master and resolve comments
May 16, 2024
c6ed2c0
fix tests
May 17, 2024
79d714e
test 1
May 30, 2024
4a317b4
merge master
May 31, 2024
ceb8d34
modify test
May 31, 2024
ecc3dc0
merge main
Jun 20, 2024
48ad52a
modify
Jun 20, 2024
059df1c
solve db connection and update
Jun 21, 2024
e8a3308
more key updates and test updates
Jun 24, 2024
a4482c6
add
Jun 24, 2024
dc2ba36
test
Jun 28, 2024
b4d676e
finish key update test
Jul 2, 2024
979dcea
Merge remote-tracking branch 'origin/main' into dz/key-update
richardhuaaa Oct 1, 2024
41a7618
Small fixes
richardhuaaa Oct 1, 2024
3d143eb
Fix group initialization error - no need to rotate keys if you are th…
richardhuaaa Oct 1, 2024
6377d85
Undo unit test changes
richardhuaaa Oct 1, 2024
71478f1
Make it impossible to miss a pre_intent_hook, add missing locations
richardhuaaa Oct 2, 2024
bb75ed4
Reduce duplication of maybe_update_installations
richardhuaaa Oct 2, 2024
8750c10
Progress on key rotation for optimistic message sends
richardhuaaa Oct 2, 2024
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
18 changes: 13 additions & 5 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ where
let to_store = StoredGroup::new(group_id, now_ns(), GroupMembershipState::Pending);
let stored_group = provider.conn().insert_or_ignore_group(to_store)?;

Ok(Self::new(
client,
stored_group.id,
stored_group.created_at_ns,
))
let xmtp_group = Self::new(client, stored_group.id, stored_group.created_at_ns);

let _ = xmtp_group.queue_key_update();
richardhuaaa marked this conversation as resolved.
Show resolved Hide resolved

Ok(xmtp_group)
}

// Decrypt a welcome message using HPKE and then create and save a group from the stored message
Expand Down Expand Up @@ -403,6 +403,14 @@ where
self.sync_with_conn(conn).await
}

// Update the installation's leaf key in a synchronous way.
pub fn queue_key_update(&self) -> Result<(), GroupError> {
let conn = &mut self.client.store.conn()?;
let intent = NewGroupIntent::new(IntentKind::KeyUpdate, self.group_id.clone(), vec![]);
intent.store(conn)?;
Ok(())
}

pub fn is_active(&self) -> Result<bool, GroupError> {
let conn = &self.client.store.conn()?;
let provider = XmtpOpenMlsProvider::new(conn);
Expand Down
Loading