Open mulmarta opened 4 hours ago
Thanks for the write-up, Marta! This looks very nice to me.
I believe that this will overall make all method calls to Client
and Group
be "idempotent" (if that's the right word?)? That is, if I call it Client::join_group
twice with the same arguments, I get the same (group, new_member_info)
values back?
(Module any randomness that might be picked when the values are created, but semantically the values would compare equal after two calls.)
Background:
As laid out in #207, we want to externalize all storage objects that interact with mls-rs so internal functionality is not directly dependent on a user-provided storage mechanism.
Description of feature:
Key Package Storage
Currently when a
Client
joins a group with Client::join_group, it will retrieve the private key that corresponds with the key package that was used to add it to the group. Later when the createdGroup
is saved with Group::write_to_storage, it will delete that private key in theKeyPackageStorage
implementation.Before (0.x)
Join Group API
In the above,
join_group
internally finds the key package private key by calling KeyPackageStorage::get on (a clone of) thekey_package_store
with all key package references included in thewelcome_message
.Write to Storage API
In the above,
write_to_storage
internally deletes the key package private key used to join by calling KeyPackageStorage::delete on (a clone of) thekey_package_store
owned byclient
.After (1.x)
Join Group API
Client
joins a group in three steps. First, it parses the Welcome message which returns information needed to fetch the private key from the storage. The same function will be used to parse other MLSMessage types like Commit, Proposal. Second,Client
retrieves the private key and, third, it joins using the private key.Write to Storage API
Instead of calling various storage interfaces internally, the
write_to_storage
function outputs a diff between the last write and the current state, which is used by the application to update the storage. Here we focus on key packages.