Skip to content

Commit

Permalink
Update convert.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
crStiv authored Jan 19, 2025
1 parent d67625b commit 81a1830
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xmtp_proto/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl TryFrom<UploadKeyPackageRequest> for ClientEnvelope {
Ok(ClientEnvelope {
aad: Some(AuthenticatedData::with_topic(get_key_package_topic(
key_package,
)?)),
)?, None)),
payload: Some(Payload::UploadKeyPackage(req)),
})
} else {
Expand All @@ -58,6 +58,7 @@ impl TryFrom<PublishIdentityUpdateRequest> 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)),
})
Expand All @@ -75,7 +76,7 @@ impl TryFrom<GroupMessageInput> for ClientEnvelope {
Ok(ClientEnvelope {
aad: Some(AuthenticatedData::with_topic(get_group_message_topic(
version.data.clone(),
)?)),
)?, None)),
payload: Some(Payload::GroupMessage(req)),
})
} else {
Expand All @@ -92,7 +93,7 @@ impl TryFrom<WelcomeMessageInput> 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 {
Expand All @@ -102,10 +103,9 @@ impl TryFrom<WelcomeMessageInput> for ClientEnvelope {
}

impl AuthenticatedData {
pub fn with_topic(topic: Vec<u8>) -> AuthenticatedData {
pub fn with_topic(topic: Vec<u8>, originator: Option<i32>) -> 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,
}
Expand Down

0 comments on commit 81a1830

Please sign in to comment.