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

Add support for authenticated backups (MSC4048) #1677

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

uhoreg
Copy link
Contributor

@uhoreg uhoreg commented Oct 7, 2023

TODO:

  • needs to use unstable prefix
  • should ensure that at least one of mac or mac2 is set

crates/ruma-client-api/src/backup.rs Outdated Show resolved Hide resolved
uhoreg and others added 4 commits October 18, 2023 14:57
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
ruma 0.9.2

Upgrade `ruma-events` and re-export its new `unstable-msc3401` feature.
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, left a couple of nits. You'll have to add a feature flag for this field, you can take a look at this PR on how to do that: #1605.

@@ -135,11 +139,14 @@ pub struct EncryptedSessionDataInit {

/// First 8 bytes of MAC key, encoded in base64.
pub mac: Base64,

/// MAC of the key, encoded in base64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type should not be changed, the point of this type is to have a stable interface and constructor if new fields to the non-init type are added, the docs on the type tell you this as well:

/// This struct will not be updated even if additional fields are added to [EncryptedSessionData]
/// in a new (non-breaking) release of the Matrix specification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed the comment. So, do I create a new ...Init struct for creating v2 data?

@@ -118,6 +118,10 @@ pub struct EncryptedSessionData {

/// First 8 bytes of MAC key, encoded in base64.
pub mac: Base64,

/// MAC of the key, encoded in base64
#[serde(rename = "org.matrix.msc4048.mac2")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field needs to be feature flagged behind a feature called unstable-msc4048.

@jplatte
Copy link
Member

jplatte commented Nov 22, 2023

should ensure that at least one of mac or mac2 is set

If you need help with this, let me know. Otherwise I'll assume priorities have shifted and will let it sit.

@poljar
Copy link
Contributor

poljar commented Nov 22, 2023

should ensure that at least one of mac or mac2 is set

If you need help with this, let me know. Otherwise I'll assume priorities have shifted and will let it sit.

That isn't the case anymore, mac should always be set, while mac2 should remain an Option. Later we'll migrate to a new algorithm where only one of them will survive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants