Skip to content

Commit

Permalink
fixup! crypto: Store device_id in SenderData
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalaam committed Jul 29, 2024
1 parent 3c9c36d commit 7d3e49d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub enum SenderData {
device_id: Option<OwnedDeviceId>,

/// The cross-signing key of the user who established this session.
master_key: Ed25519PublicKey,
master_key: Box<Ed25519PublicKey>,

/// Whether, at the time we checked the signature on the device,
/// we had actively verified that `master_key` belongs to the user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ impl<'a> SenderDataFinder<'a> {

if let Some(master_key) = master_key {
// We have user_id and master_key for the user sending the to-device message.
let master_key = Box::new(master_key);
let master_key_verified = sender_device.is_cross_signing_trusted();
SenderData::SenderKnown { user_id, device_id, master_key, master_key_verified }
} else {
Expand Down Expand Up @@ -448,7 +449,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
assert!(!master_key_verified);
}

Expand Down Expand Up @@ -477,7 +478,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
assert!(!master_key_verified);
}

Expand Down Expand Up @@ -507,7 +508,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
assert!(!master_key_verified);
}

Expand Down Expand Up @@ -536,7 +537,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
assert!(!master_key_verified);
}

Expand Down Expand Up @@ -604,7 +605,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
// Including the fact that it was verified
assert!(master_key_verified);
}
Expand Down Expand Up @@ -637,7 +638,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
// Including the fact that it was verified
assert!(master_key_verified);
}
Expand All @@ -661,7 +662,7 @@ mod tests {
);
assert_eq!(user_id, setup.sender.user_id);
assert_eq!(device_id.unwrap(), setup.sender_device.device_id());
assert_eq!(master_key, setup.sender_master_key());
assert_eq!(*master_key, setup.sender_master_key());
assert!(!master_key_verified);
}

Expand Down

0 comments on commit 7d3e49d

Please sign in to comment.