Add proper parse logic for the SSv2 SentMessage format

This isn't hooked up to anything that the fan_out test method wasn't,
but it will come in handy for future testing.
This commit is contained in:
Jordan Rose
2023-10-19 13:12:31 -07:00
parent 1f44ccfad7
commit 5c841ef281
7 changed files with 417 additions and 111 deletions

View File

@@ -196,6 +196,16 @@ pub fn initialize_sessions_v4() -> Result<(SessionRecord, SessionRecord), Signal
Ok((alice_session, bob_session))
}
pub fn extract_single_ssv2_received_message(input: &[u8]) -> (ServiceId, Vec<u8>) {
let message = SealedSenderV2SentMessage::parse(input).expect("valid");
assert_eq!(1, message.recipients.len());
let result = message
.received_message_parts_for_recipient(&message.recipients[0])
.as_ref()
.concat();
(message.recipients[0].service_id, result)
}
pub enum IdChoice {
Exactly(u32),
Next,