-
Notifications
You must be signed in to change notification settings - Fork 307
Fix error loading older sender data from storage #4425
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
Changes from all commits
10ed99d
3ace3bc
3c9aa7e
d17ba70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,7 @@ enum SenderDataReader { | |
legacy_session: bool, | ||
}, | ||
|
||
#[serde(alias = "SenderUnverifiedButPreviouslyVerified")] | ||
VerificationViolation(KnownSenderData), | ||
Comment on lines
+218
to
219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a whole bunch of other renames in #4067 that we need to check for; notably There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, was rushing to find a fix and missed the other places. Will expand this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added commits dealing with the other cases |
||
|
||
SenderUnverified(KnownSenderData), | ||
|
@@ -286,7 +287,10 @@ mod tests { | |
use vodozemac::Ed25519PublicKey; | ||
|
||
use super::SenderData; | ||
use crate::types::{DeviceKeys, Signatures}; | ||
use crate::{ | ||
olm::KnownSenderData, | ||
types::{DeviceKeys, Signatures}, | ||
}; | ||
|
||
#[test] | ||
fn serializing_unknown_device_correctly_preserves_owner_check_failed_if_true() { | ||
|
@@ -360,6 +364,47 @@ mod tests { | |
assert_let!(SenderData::SenderVerified { .. } = end); | ||
} | ||
|
||
#[test] | ||
fn deserializing_sender_unverified_but_previously_verified_migrates_to_verification_violation() | ||
{ | ||
let json = r#" | ||
{ | ||
"SenderUnverifiedButPreviouslyVerified":{ | ||
"user_id":"@u:s.co", | ||
"master_key":[ | ||
150,140,249,139,141,29,63,230,179,14,213,175,176,61,11,255, | ||
26,103,10,51,100,154,183,47,181,117,87,204,33,215,241,92 | ||
], | ||
"master_key_verified":true | ||
} | ||
} | ||
"#; | ||
|
||
let end: SenderData = serde_json::from_str(json).expect("Failed to parse!"); | ||
assert_let!(SenderData::VerificationViolation(KnownSenderData { user_id, .. }) = end); | ||
assert_eq!(user_id, owned_user_id!("@u:s.co")); | ||
} | ||
|
||
#[test] | ||
fn deserializing_verification_violation() { | ||
let json = r#" | ||
{ | ||
"VerificationViolation":{ | ||
"user_id":"@u:s.co", | ||
"master_key":[ | ||
150,140,249,139,141,29,63,230,179,14,213,175,176,61,11,255, | ||
26,103,10,51,100,154,183,47,181,117,87,204,33,215,241,92 | ||
], | ||
"master_key_verified":true | ||
} | ||
} | ||
"#; | ||
|
||
let end: SenderData = serde_json::from_str(json).expect("Failed to parse!"); | ||
assert_let!(SenderData::VerificationViolation(KnownSenderData { user_id, .. }) = end); | ||
assert_eq!(user_id, owned_user_id!("@u:s.co")); | ||
} | ||
|
||
#[test] | ||
fn equal_sessions_have_same_trust_level() { | ||
let unknown = SenderData::unknown(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.