mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Use new compact representations in protobufs
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
@@ -3,32 +3,89 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package signalservice;
|
||||
|
||||
option java_package = "org.whispersystems.signalservice.internal.push";
|
||||
option java_outer_classname = "SignalServiceProtos";
|
||||
|
||||
message Envelope {
|
||||
// Our parser does not handle reserved in enums: DESKTOP-1569
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
CIPHERTEXT = 1; // content => (version byte | SignalMessage{Content})
|
||||
// reserved 2;
|
||||
// reserved "KEY_EXCHANGE";
|
||||
PREKEY_BUNDLE = 3; // content => (version byte | PreKeySignalMessage{Content})
|
||||
SERVER_DELIVERY_RECEIPT = 5; // legacyMessage => [] AND content => []
|
||||
UNIDENTIFIED_SENDER = 6; // legacyMessage => [] AND content => ((version byte | UnidentifiedSenderMessage) OR (version byte | Multi-Recipient Sealed Sender Format))
|
||||
SENDERKEY_MESSAGE = 7; // legacyMessage => [] AND content => (version byte | SenderKeyMessage)
|
||||
PLAINTEXT_CONTENT = 8; // legacyMessage => [] AND content => (marker byte | Content)
|
||||
|
||||
/**
|
||||
* A double-ratchet message represents a "normal," "unsealed-sender" message
|
||||
* encrypted using the Double Ratchet within an established Signal session.
|
||||
* Double-ratchet messages include sender information in the plaintext
|
||||
* portion of the `Envelope`.
|
||||
*/
|
||||
DOUBLE_RATCHET = 1; // content => (version byte | SignalMessage{Content})
|
||||
|
||||
reserved 2;
|
||||
reserved "KEY_EXCHANGE";
|
||||
|
||||
/**
|
||||
* A prekey message begins a new Signal session. The `content` of a prekey
|
||||
* message is a superset of a double-ratchet message's `content` and
|
||||
* contains the sender's identity public key and information identifying the
|
||||
* pre-keys used in the message's ciphertext. Like double-ratchet messages,
|
||||
* prekey messages contain sender information in the plaintext portion of
|
||||
* the `Envelope`.
|
||||
*/
|
||||
PREKEY_MESSAGE = 3; // content => (version byte | PreKeySignalMessage{Content})
|
||||
|
||||
/**
|
||||
* Server delivery receipts are generated by the server when
|
||||
* "unsealed-sender" messages are delivered to and acknowledged by the
|
||||
* destination device. Server delivery receipts identify the sender in the
|
||||
* plaintext portion of the `Envelope` and have no `content`. Note that
|
||||
* receipts for sealed-sender messages are generated by clients as
|
||||
* `UNIDENTIFIED_SENDER` messages.
|
||||
*
|
||||
* Note that, with server delivery receipts, the "client timestamp" on
|
||||
* the envelope refers to the timestamp of the original message (i.e. the
|
||||
* message the server just delivered) and not to the time of delivery. The
|
||||
* "server timestamp" refers to the time of delivery.
|
||||
*/
|
||||
SERVER_DELIVERY_RECEIPT = 5; // content => []
|
||||
|
||||
/**
|
||||
* An unidentified sender message represents a message with no sender
|
||||
* information in the plaintext portion of the `Envelope`. Unidentified
|
||||
* sender messages always contain an additional `subtype` in their
|
||||
* `content`. They may or may not be part of an existing Signal session
|
||||
* (i.e. an unidentified sender message may have a "prekey message"
|
||||
* subtype or may indicate an encryption error).
|
||||
*/
|
||||
UNIDENTIFIED_SENDER = 6; // content => ((version byte | UnidentifiedSenderMessage) OR (version byte | Multi-Recipient Sealed Sender Format))
|
||||
|
||||
reserved 7;
|
||||
reserved "SENDERKEY_MESSAGE";
|
||||
|
||||
/**
|
||||
* A plaintext message is used solely to convey encryption error receipts
|
||||
* and never contains encrypted message content. Encryption error receipts
|
||||
* must be delivered in plaintext because, encryption/decryption of a prior
|
||||
* message failed and there is no reason to believe that
|
||||
* encryption/decryption of subsequent messages with the same key material
|
||||
* would succeed.
|
||||
*
|
||||
* Critically, plaintext messages never have "real" message content
|
||||
* generated by users. Plaintext messages include sender information.
|
||||
*/
|
||||
PLAINTEXT_CONTENT = 8; // content => (marker byte | Content)
|
||||
|
||||
// next: 9
|
||||
}
|
||||
|
||||
optional Type type = 1;
|
||||
reserved 2; // formerly optional string sourceE164 = 2;
|
||||
optional string sourceServiceId = 11;
|
||||
optional uint32 sourceDevice = 7;
|
||||
optional uint32 sourceDeviceId = 7;
|
||||
optional string destinationServiceId = 13;
|
||||
reserved 3; // formerly optional string relay = 3;
|
||||
optional uint64 timestamp = 5;
|
||||
optional uint64 clientTimestamp = 5;
|
||||
reserved 6; // formerly optional bytes legacyMessage = 6; // Contains an encrypted DataMessage; this field could have been set historically for type 1 or 3 messages; no longer in use
|
||||
optional bytes content = 8; // Contains an encrypted Content
|
||||
optional string serverGuid = 9;
|
||||
@@ -39,7 +96,11 @@ message Envelope {
|
||||
optional bool story = 16; // indicates that the content is a story.
|
||||
optional bytes report_spam_token = 17; // token sent when reporting spam
|
||||
reserved 18; // internal server use
|
||||
// next: 19
|
||||
optional bytes sourceServiceIdBinary = 19; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
optional bytes destinationServiceIdBinary = 20; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
optional bytes serverGuidBinary = 21; // 16-byte UUID
|
||||
optional bytes updatedPniBinary = 22; // 16-byte UUID
|
||||
// next: 22
|
||||
}
|
||||
|
||||
message Content {
|
||||
@@ -191,6 +252,7 @@ message DataMessage {
|
||||
repeated QuotedAttachment attachments = 4;
|
||||
repeated BodyRange bodyRanges = 6;
|
||||
optional Type type = 7;
|
||||
optional bytes authorAciBinary = 8; // 16-byte UUID
|
||||
}
|
||||
|
||||
message Contact {
|
||||
@@ -275,6 +337,7 @@ message DataMessage {
|
||||
reserved /* targetAuthorE164 */ 3;
|
||||
optional string targetAuthorAci = 4;
|
||||
optional uint64 targetSentTimestamp = 5;
|
||||
optional bytes targetAuthorAciBinary = 6; // 16-byte UUID
|
||||
}
|
||||
|
||||
message Delete {
|
||||
@@ -288,6 +351,7 @@ message DataMessage {
|
||||
message StoryContext {
|
||||
optional string authorAci = 1;
|
||||
optional uint64 sentTimestamp = 2;
|
||||
optional bytes authorAciBinary = 3; // 16-byte UUID
|
||||
}
|
||||
|
||||
enum ProtocolVersion {
|
||||
@@ -419,6 +483,7 @@ message Verified {
|
||||
optional bytes identityKey = 2;
|
||||
optional State state = 3;
|
||||
optional bytes nullMessage = 4;
|
||||
optional bytes destinationAciBinary = 6; // 16-byte UUID
|
||||
}
|
||||
|
||||
message SyncMessage {
|
||||
@@ -429,6 +494,7 @@ message SyncMessage {
|
||||
optional bool unidentified = 2;
|
||||
reserved /*destinationPni */ 4;
|
||||
optional bytes destinationPniIdentityKey = 5; // Only set for PNI destinations
|
||||
optional bytes destinationServiceIdBinary = 6; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
}
|
||||
|
||||
message StoryMessageRecipient {
|
||||
@@ -436,6 +502,7 @@ message SyncMessage {
|
||||
repeated string distributionListIds = 2;
|
||||
optional bool isAllowedToReply = 3;
|
||||
reserved /*destinationPni */ 4;
|
||||
optional bytes destinationServiceIdBinary = 5; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
}
|
||||
|
||||
optional string destinationE164 = 1;
|
||||
@@ -449,7 +516,8 @@ message SyncMessage {
|
||||
repeated StoryMessageRecipient storyMessageRecipients = 9;
|
||||
optional EditMessage editMessage = 10;
|
||||
reserved /*destinationPni */ 11;
|
||||
// Next ID: 12
|
||||
optional bytes destinationServiceIdBinary = 12; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
// Next ID: 13
|
||||
}
|
||||
|
||||
message Contacts {
|
||||
@@ -461,6 +529,7 @@ message SyncMessage {
|
||||
repeated string numbers = 1;
|
||||
repeated string acis = 3;
|
||||
repeated bytes groupIds = 2;
|
||||
repeated bytes acisBinary = 4; // 16-byte UUID
|
||||
}
|
||||
|
||||
message Request {
|
||||
@@ -481,12 +550,14 @@ message SyncMessage {
|
||||
reserved /*senderE164*/ 1;
|
||||
optional string senderAci = 3;
|
||||
optional uint64 timestamp = 2;
|
||||
optional bytes senderAciBinary = 4; // 16-byte UUID
|
||||
}
|
||||
|
||||
message Viewed {
|
||||
reserved /*senderE164*/ 1;
|
||||
optional string senderAci = 3;
|
||||
optional uint64 timestamp = 2;
|
||||
optional bytes senderAciBinary = 4; // 16-byte UUID
|
||||
}
|
||||
|
||||
message Configuration {
|
||||
@@ -513,6 +584,7 @@ message SyncMessage {
|
||||
reserved /*senderE164*/ 1;
|
||||
optional string senderAci = 3;
|
||||
optional uint64 timestamp = 2;
|
||||
optional bytes senderAciBinary = 4; // 16-byte UUID
|
||||
}
|
||||
|
||||
message FetchLatest {
|
||||
@@ -553,6 +625,25 @@ message SyncMessage {
|
||||
optional string threadAci = 2;
|
||||
optional bytes groupId = 3;
|
||||
optional Type type = 4;
|
||||
optional bytes threadAciBinary = 5; // 16-byte UUID
|
||||
}
|
||||
|
||||
message OutgoingPayment {
|
||||
message MobileCoin {
|
||||
optional bytes recipientAddress = 1;
|
||||
optional uint64 amountPicoMob = 2;
|
||||
optional uint64 feePicoMob = 3;
|
||||
optional bytes receipt = 4;
|
||||
optional uint64 ledgerBlockTimestamp = 5;
|
||||
optional uint64 ledgerBlockIndex = 6;
|
||||
repeated bytes spentKeyImages = 7;
|
||||
repeated bytes outputPublicKeys = 8;
|
||||
}
|
||||
optional string recipientServiceId = 1;
|
||||
optional string note = 2;
|
||||
oneof attachment_identifier {
|
||||
MobileCoin mobileCoin = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PniChangeNumber {
|
||||
@@ -719,6 +810,7 @@ message SyncMessage {
|
||||
optional FetchLatest fetchLatest = 12;
|
||||
optional Keys keys = 13;
|
||||
optional MessageRequestResponse messageRequestResponse = 14;
|
||||
optional OutgoingPayment outgoingPayment = 15;
|
||||
repeated Viewed viewed = 16;
|
||||
reserved /*pniIdentity*/ 17;
|
||||
optional PniChangeNumber pniChangeNumber = 18;
|
||||
@@ -732,11 +824,10 @@ message SyncMessage {
|
||||
}
|
||||
|
||||
message AttachmentPointer {
|
||||
// Our parser does not handle reserved in enums: DESKTOP-1569
|
||||
enum Flags {
|
||||
VOICE_MESSAGE = 1;
|
||||
BORDERLESS = 2;
|
||||
// reserved 4;
|
||||
reserved 4;
|
||||
GIF = 8;
|
||||
}
|
||||
|
||||
@@ -781,6 +872,7 @@ message ContactDetails {
|
||||
|
||||
optional string number = 1;
|
||||
optional string aci = 9;
|
||||
optional bytes aciBinary = 13; // 16-byte UUID
|
||||
optional string name = 2;
|
||||
optional Avatar avatar = 3;
|
||||
reserved /* color */ 4;
|
||||
@@ -791,7 +883,18 @@ message ContactDetails {
|
||||
optional uint32 expireTimerVersion = 12;
|
||||
optional uint32 inboxPosition = 10;
|
||||
reserved /* archived */ 11;
|
||||
// NEXT ID: 13
|
||||
// NEXT ID: 14
|
||||
}
|
||||
|
||||
message PaymentAddress {
|
||||
message MobileCoin {
|
||||
optional bytes publicAddress = 1;
|
||||
optional bytes signature = 2;
|
||||
}
|
||||
|
||||
oneof Address {
|
||||
MobileCoin mobileCoin = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message DecryptionErrorMessage {
|
||||
@@ -827,6 +930,7 @@ message BodyRange {
|
||||
oneof associatedValue {
|
||||
string mentionAci = 3;
|
||||
Style style = 4;
|
||||
bytes mentionAciBinary = 5; // 16-byte UUID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,6 +938,7 @@ message AddressableMessage {
|
||||
oneof author {
|
||||
string authorServiceId = 1;
|
||||
string authorE164 = 2;
|
||||
bytes authorServiceIdBinary = 4; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
}
|
||||
optional uint64 sentTimestamp = 3;
|
||||
}
|
||||
@@ -843,5 +948,6 @@ message ConversationIdentifier {
|
||||
string threadServiceId = 1;
|
||||
bytes threadGroupId = 2;
|
||||
string threadE164 = 3;
|
||||
bytes threadServiceIdBinary = 4; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user