From 086ced7620fae17bf884bd83f9db94acec6c2411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Higueras?= Date: Sat, 14 Sep 2024 22:15:13 +0200 Subject: [PATCH] Add support for versioned expire timers --- .../protobuf/SignalService.proto | 26 ++++++++++--------- libsignal-service/src/models.rs | 2 ++ libsignal-service/src/push_service.rs | 6 ++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/libsignal-service/protobuf/SignalService.proto b/libsignal-service/protobuf/SignalService.proto index 37506c78a..96c581b97 100644 --- a/libsignal-service/protobuf/SignalService.proto +++ b/libsignal-service/protobuf/SignalService.proto @@ -331,6 +331,7 @@ message DataMessage { optional GroupContextV2 groupV2 = 15; optional uint32 flags = 4; optional uint32 expireTimer = 5; + optional uint32 expireTimerVersion = 23; optional bytes profileKey = 6; optional uint64 timestamp = 7; optional Quote quote = 8; @@ -792,17 +793,18 @@ message ContactDetails { optional uint32 length = 2; } - optional string number = 1; - optional string aci = 9; - optional string name = 2; - optional Avatar avatar = 3; - optional string color = 4; - optional Verified verified = 5; - optional bytes profileKey = 6; - reserved /*blocked*/ 7; - optional uint32 expireTimer = 8; - optional uint32 inboxPosition = 10; - optional bool archived = 11; + optional string number = 1; + optional string aci = 9; + optional string name = 2; + optional Avatar avatar = 3; + optional string color = 4; + optional Verified verified = 5; + optional bytes profileKey = 6; + reserved /*blocked*/ 7; + optional uint32 expireTimer = 8; + optional uint32 expireTimerVersion = 12; + optional uint32 inboxPosition = 10; + optional bool archived = 11; } message GroupDetails { @@ -854,4 +856,4 @@ message PniSignatureMessage { message EditMessage { optional uint64 targetSentTimestamp = 1; optional DataMessage dataMessage = 2; -} \ No newline at end of file +} diff --git a/libsignal-service/src/models.rs b/libsignal-service/src/models.rs index a780dc0f9..08698bebe 100644 --- a/libsignal-service/src/models.rs +++ b/libsignal-service/src/models.rs @@ -29,6 +29,7 @@ pub struct Contact { pub verified: Verified, pub profile_key: Vec, pub expire_timer: u32, + pub expire_timer_version: u32, pub inbox_position: u32, pub archived: bool, #[serde(skip)] @@ -69,6 +70,7 @@ impl Contact { verified: contact_details.verified.clone().unwrap_or_default(), profile_key: contact_details.profile_key().to_vec(), expire_timer: contact_details.expire_timer(), + expire_timer_version: contact_details.expire_timer_version(), inbox_position: contact_details.inbox_position(), archived: contact_details.archived(), avatar: contact_details.avatar.and_then(|avatar| { diff --git a/libsignal-service/src/push_service.rs b/libsignal-service/src/push_service.rs index 339439514..7bdec5912 100644 --- a/libsignal-service/src/push_service.rs +++ b/libsignal-service/src/push_service.rs @@ -435,12 +435,16 @@ pub struct LinkAccountAttributes { #[serde(rename_all = "camelCase")] pub struct LinkCapabilities { pub delete_sync: bool, + pub versioned_expiration_timer: bool, } // https://github.com/signalapp/Signal-Desktop/blob/1e57db6aa4786dcddc944349e4894333ac2ffc9e/ts/textsecure/WebAPI.ts#L1287 impl Default for LinkCapabilities { fn default() -> Self { - Self { delete_sync: true } + Self { + delete_sync: true, + versioned_expiration_timer: true, + } } }