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

[1.x] Replace write_to_storage with export_state_update #212

Open
Tracked by #211
tomleavy opened this issue Nov 11, 2024 · 0 comments
Open
Tracked by #211

[1.x] Replace write_to_storage with export_state_update #212

tomleavy opened this issue Nov 11, 2024 · 0 comments

Comments

@tomleavy
Copy link
Contributor

tomleavy commented Nov 11, 2024

Background

Part of #211

Before (0.x)

// Make a group state store that conforms to the GroupStateStorage trait
let group_state_store = MyGroupStateStore::new();

let client = Client::builder()
    .group_state_storage(group_state_store) // Transfer the ownership of the group state storage
    ....
    .build();
        
// ..... load and use a chat

chat.write_to_storage().unwrap();

In the above, write_to_storage first calls GroupStateStorage::write with the current GroupState along along with a set of updates to prior epoch data. Updates to prior epoch data include either overwriting secret tree data used for message decryption or completely deleting cached epoch data to lock in forward secrecy.

After (1.x)

Export State Update API

Instead of calling various storage interfaces internally, the export_state_update function will output a full copy of a Group's public and secret information, along with any prior epoch data that has been modified since the last time export_state_update has been called.

Calling export_state_update clears all prior epoch data in order to reduce memory footprint within mls-rs

// New write to storage interface
pub fn export_state_update() -> Result<GroupStateUpdate, MlsError>;

// GroupStateUpdate definition
pub struct GroupStateUpdate {
    pub state: GroupState, // Should expose the properties of internal Snapshot struct in a sane way
    pub past_epoch_data: Vec<EpochRecord>, // Should expose non-secret values of PriorEpoch in some way
}
@tomleavy tomleavy changed the title [WIP] [1.x] Replace write_to_storage with group_state [WIP] [1.x] Replace write_to_storage with export_state_update Nov 11, 2024
@tomleavy tomleavy changed the title [WIP] [1.x] Replace write_to_storage with export_state_update [1.x] Replace write_to_storage with export_state_update Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant