From 81a183012a9d2762f5e34cbe13f3c6eb353d2698 Mon Sep 17 00:00:00 2001 From: crStiv Date: Sun, 19 Jan 2025 17:14:49 +0100 Subject: [PATCH] Update convert.rs --- xmtp_proto/src/convert.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xmtp_proto/src/convert.rs b/xmtp_proto/src/convert.rs index 7e265f27c..d434d0850 100644 --- a/xmtp_proto/src/convert.rs +++ b/xmtp_proto/src/convert.rs @@ -41,7 +41,7 @@ impl TryFrom for ClientEnvelope { Ok(ClientEnvelope { aad: Some(AuthenticatedData::with_topic(get_key_package_topic( key_package, - )?)), + )?, None)), payload: Some(Payload::UploadKeyPackage(req)), }) } else { @@ -58,6 +58,7 @@ impl TryFrom for ClientEnvelope { Ok(ClientEnvelope { aad: Some(AuthenticatedData::with_topic( build_identity_topic_from_hex_encoded(&identity_update.inbox_id)?, + None )), payload: Some(Payload::IdentityUpdate(identity_update)), }) @@ -75,7 +76,7 @@ impl TryFrom for ClientEnvelope { Ok(ClientEnvelope { aad: Some(AuthenticatedData::with_topic(get_group_message_topic( version.data.clone(), - )?)), + )?, None)), payload: Some(Payload::GroupMessage(req)), }) } else { @@ -92,7 +93,7 @@ impl TryFrom for ClientEnvelope { Ok(ClientEnvelope { aad: Some(AuthenticatedData::with_topic(build_welcome_message_topic( version.installation_key.as_slice(), - ))), + ), None)), payload: Some(Payload::WelcomeMessage(req)), }) } else { @@ -102,10 +103,9 @@ impl TryFrom for ClientEnvelope { } impl AuthenticatedData { - pub fn with_topic(topic: Vec) -> AuthenticatedData { + pub fn with_topic(topic: Vec, originator: Option) -> AuthenticatedData { AuthenticatedData { - //TODO(mkysel) originator is hardcoded for now, but will have to become configurable - target_originator: 100, + target_originator: originator.unwrap_or(100), target_topic: topic, last_seen: None, }