Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate-dev / src / main / proto / signal_service.proto
signal_service.proto1038 lines · 28.5 KiBRaw
| 1 | /* |
| 2 | * Copyright 2020-2022 Signal Messenger, LLC |
| 3 | * SPDX-License-Identifier: AGPL-3.0-only |
| 4 | */ |
| 5 | |
| 6 | syntax = "proto2"; |
| 7 | |
| 8 | package signalservice; |
| 9 | |
| 10 | option java_package = "org.whispersystems.signalservice.internal.push"; |
| 11 | option java_outer_classname = "SignalServiceProtos"; |
| 12 | |
| 13 | message Envelope { |
| 14 | enum Type { |
| 15 | UNKNOWN = 0; |
| 16 | |
| 17 | /** |
| 18 | * A double-ratchet message represents a "normal," "unsealed-sender" message |
| 19 | * encrypted using the Double Ratchet within an established Signal session. |
| 20 | * Double-ratchet messages include sender information in the plaintext |
| 21 | * portion of the `Envelope`. |
| 22 | */ |
| 23 | DOUBLE_RATCHET = 1; // content => (version byte | SignalMessage{Content}) |
| 24 | |
| 25 | reserved 2; |
| 26 | reserved "KEY_EXCHANGE"; |
| 27 | |
| 28 | /** |
| 29 | * A prekey message begins a new Signal session. The `content` of a prekey |
| 30 | * message is a superset of a double-ratchet message's `content` and |
| 31 | * contains the sender's identity public key and information identifying the |
| 32 | * pre-keys used in the message's ciphertext. Like double-ratchet messages, |
| 33 | * prekey messages contain sender information in the plaintext portion of |
| 34 | * the `Envelope`. |
| 35 | */ |
| 36 | PREKEY_MESSAGE = 3; // content => (version byte | PreKeySignalMessage{Content}) |
| 37 | |
| 38 | /** |
| 39 | * Server delivery receipts are generated by the server when |
| 40 | * "unsealed-sender" messages are delivered to and acknowledged by the |
| 41 | * destination device. Server delivery receipts identify the sender in the |
| 42 | * plaintext portion of the `Envelope` and have no `content`. Note that |
| 43 | * receipts for sealed-sender messages are generated by clients as |
| 44 | * `UNIDENTIFIED_SENDER` messages. |
| 45 | * |
| 46 | * Note that, with server delivery receipts, the "client timestamp" on |
| 47 | * the envelope refers to the timestamp of the original message (i.e. the |
| 48 | * message the server just delivered) and not to the time of delivery. The |
| 49 | * "server timestamp" refers to the time of delivery. |
| 50 | */ |
| 51 | SERVER_DELIVERY_RECEIPT = 5; // content => [] |
| 52 | |
| 53 | /** |
| 54 | * An unidentified sender message represents a message with no sender |
| 55 | * information in the plaintext portion of the `Envelope`. Unidentified |
| 56 | * sender messages always contain an additional `subtype` in their |
| 57 | * `content`. They may or may not be part of an existing Signal session |
| 58 | * (i.e. an unidentified sender message may have a "prekey message" |
| 59 | * subtype or may indicate an encryption error). |
| 60 | */ |
| 61 | UNIDENTIFIED_SENDER = 6; // content => ((version byte | UnidentifiedSenderMessage) OR (version byte | Multi-Recipient Sealed Sender Format)) |
| 62 | |
| 63 | reserved 7; |
| 64 | reserved "SENDERKEY_MESSAGE"; |
| 65 | |
| 66 | /** |
| 67 | * A plaintext message is used solely to convey encryption error receipts |
| 68 | * and never contains encrypted message content. Encryption error receipts |
| 69 | * must be delivered in plaintext because, encryption/decryption of a prior |
| 70 | * message failed and there is no reason to believe that |
| 71 | * encryption/decryption of subsequent messages with the same key material |
| 72 | * would succeed. |
| 73 | * |
| 74 | * Critically, plaintext messages never have "real" message content |
| 75 | * generated by users. Plaintext messages include sender information. |
| 76 | */ |
| 77 | PLAINTEXT_CONTENT = 8; // content => (marker byte | Content) |
| 78 | |
| 79 | // next: 9 |
| 80 | } |
| 81 | |
| 82 | optional Type type = 1; |
| 83 | reserved 2; // formerly optional string sourceE164 = 2; |
| 84 | optional string sourceServiceId = 11; |
| 85 | optional uint32 sourceDeviceId = 7; |
| 86 | optional string destinationServiceId = 13; |
| 87 | reserved 3; // formerly optional string relay = 3; |
| 88 | optional uint64 clientTimestamp = 5; |
| 89 | 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 |
| 90 | optional bytes content = 8; // Contains an encrypted Content |
| 91 | optional string serverGuid = 9; |
| 92 | optional uint64 serverTimestamp = 10; |
| 93 | optional bool ephemeral = 12; // indicates that the message should not be persisted if the recipient is offline |
| 94 | optional bool urgent = 14 [default = true]; // indicates that the content is considered timely by the sender; defaults to true so senders have to opt-out to say something isn't time critical |
| 95 | optional string updatedPni = 15; // for number-change synchronization messages, provides the new server-assigned phone number identifier associated with the changed number |
| 96 | optional bool story = 16; // indicates that the content is a story. |
| 97 | optional bytes report_spam_token = 17; // token sent when reporting spam |
| 98 | reserved 18; // internal server use |
| 99 | optional bytes sourceServiceIdBinary = 19; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 100 | optional bytes destinationServiceIdBinary = 20; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 101 | optional bytes serverGuidBinary = 21; // 16-byte UUID |
| 102 | optional bytes updatedPniBinary = 22; // 16-byte UUID |
| 103 | // next: 22 |
| 104 | } |
| 105 | |
| 106 | message Content { |
| 107 | oneof content { |
| 108 | DataMessage dataMessage = 1; |
| 109 | SyncMessage syncMessage = 2; |
| 110 | CallMessage callMessage = 3; |
| 111 | NullMessage nullMessage = 4; |
| 112 | ReceiptMessage receiptMessage = 5; |
| 113 | TypingMessage typingMessage = 6; |
| 114 | bytes /* DecryptionErrorMessage */ decryptionErrorMessage = 8; |
| 115 | StoryMessage storyMessage = 9; |
| 116 | EditMessage editMessage = 11; |
| 117 | } |
| 118 | |
| 119 | optional bytes /* SenderKeyDistributionMessage */ senderKeyDistributionMessage = 7; |
| 120 | optional PniSignatureMessage pniSignatureMessage = 10; |
| 121 | } |
| 122 | |
| 123 | message CallMessage { |
| 124 | message Offer { |
| 125 | enum Type { |
| 126 | OFFER_AUDIO_CALL = 0; |
| 127 | OFFER_VIDEO_CALL = 1; |
| 128 | reserved /* OFFER_NEED_PERMISSION */ 2; // removed |
| 129 | } |
| 130 | optional uint64 id = 1; |
| 131 | reserved /* sdp */ 2; |
| 132 | optional Type type = 3; |
| 133 | optional bytes opaque = 4; |
| 134 | } |
| 135 | |
| 136 | message Answer { |
| 137 | optional uint64 id = 1; |
| 138 | reserved /* sdp */ 2; |
| 139 | optional bytes opaque = 3; |
| 140 | } |
| 141 | |
| 142 | message IceUpdate { |
| 143 | optional uint64 id = 1; |
| 144 | reserved /* mid */ 2; |
| 145 | reserved /* line */ 3; |
| 146 | reserved /* sdp */ 4; |
| 147 | optional bytes opaque = 5; |
| 148 | } |
| 149 | |
| 150 | message Busy { |
| 151 | optional uint64 id = 1; |
| 152 | } |
| 153 | |
| 154 | message Hangup { |
| 155 | enum Type { |
| 156 | HANGUP_NORMAL = 0; |
| 157 | HANGUP_ACCEPTED = 1; |
| 158 | HANGUP_DECLINED = 2; |
| 159 | HANGUP_BUSY = 3; |
| 160 | HANGUP_NEED_PERMISSION = 4; |
| 161 | } |
| 162 | optional uint64 id = 1; |
| 163 | optional Type type = 2; |
| 164 | optional uint32 deviceId = 3; |
| 165 | } |
| 166 | |
| 167 | message Opaque { |
| 168 | enum Urgency { |
| 169 | DROPPABLE = 0; |
| 170 | HANDLE_IMMEDIATELY = 1; |
| 171 | } |
| 172 | optional bytes data = 1; |
| 173 | optional Urgency urgency = 2; // If missing, treat as DROPPABLE. |
| 174 | } |
| 175 | |
| 176 | optional Offer offer = 1; |
| 177 | optional Answer answer = 2; |
| 178 | repeated IceUpdate iceUpdate = 3; |
| 179 | reserved /* legacyHangup */ 4; |
| 180 | optional Busy busy = 5; |
| 181 | reserved /* profileKey */ 6; |
| 182 | optional Hangup hangup = 7; |
| 183 | reserved /* multiRing */ 8; |
| 184 | optional uint32 destinationDeviceId = 9; |
| 185 | optional Opaque opaque = 10; |
| 186 | } |
| 187 | |
| 188 | message DataMessage { |
| 189 | enum Flags { |
| 190 | reserved /*END_SESSION*/ 1; |
| 191 | EXPIRATION_TIMER_UPDATE = 2; |
| 192 | PROFILE_KEY_UPDATE = 4; |
| 193 | FORWARD = 8; |
| 194 | } |
| 195 | |
| 196 | message Payment { |
| 197 | message Amount { |
| 198 | message MobileCoin { |
| 199 | optional uint64 picoMob = 1; // 1,000,000,000,000 picoMob per Mob |
| 200 | } |
| 201 | |
| 202 | oneof Amount { |
| 203 | MobileCoin mobileCoin = 1; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | message Notification { |
| 208 | message MobileCoin { |
| 209 | optional bytes receipt = 1; |
| 210 | } |
| 211 | |
| 212 | oneof Transaction { |
| 213 | MobileCoin mobileCoin = 1; |
| 214 | } |
| 215 | |
| 216 | // Optional, Refers to the PaymentRequest message, if any. |
| 217 | optional string note = 2; |
| 218 | reserved /*requestId*/ 1003; |
| 219 | } |
| 220 | |
| 221 | message Activation { |
| 222 | enum Type { |
| 223 | REQUEST = 0; |
| 224 | ACTIVATED = 1; |
| 225 | } |
| 226 | |
| 227 | optional Type type = 1; |
| 228 | } |
| 229 | |
| 230 | oneof Item { |
| 231 | Notification notification = 1; |
| 232 | Activation activation = 2; |
| 233 | } |
| 234 | |
| 235 | reserved /*request*/ 1002; |
| 236 | reserved /*cancellation*/ 1003; |
| 237 | } |
| 238 | |
| 239 | message Quote { |
| 240 | enum Type { |
| 241 | NORMAL = 0; |
| 242 | GIFT_BADGE = 1; |
| 243 | POLL = 2; |
| 244 | } |
| 245 | |
| 246 | message QuotedAttachment { |
| 247 | optional string contentType = 1; |
| 248 | optional string fileName = 2; |
| 249 | optional AttachmentPointer thumbnail = 3; |
| 250 | } |
| 251 | |
| 252 | optional uint64 id = 1; |
| 253 | reserved /*authorE164*/ 2; |
| 254 | optional string authorAci = 5; |
| 255 | optional string text = 3; |
| 256 | repeated QuotedAttachment attachments = 4; |
| 257 | repeated BodyRange bodyRanges = 6; |
| 258 | optional Type type = 7; |
| 259 | optional bytes authorAciBinary = 8; // 16-byte UUID |
| 260 | } |
| 261 | |
| 262 | message Contact { |
| 263 | message Name { |
| 264 | optional string givenName = 1; |
| 265 | optional string familyName = 2; |
| 266 | optional string prefix = 3; |
| 267 | optional string suffix = 4; |
| 268 | optional string middleName = 5; |
| 269 | reserved /*displayName*/ 6; |
| 270 | optional string nickname = 7; |
| 271 | } |
| 272 | |
| 273 | message Phone { |
| 274 | enum Type { |
| 275 | HOME = 1; |
| 276 | MOBILE = 2; |
| 277 | WORK = 3; |
| 278 | CUSTOM = 4; |
| 279 | } |
| 280 | |
| 281 | optional string value = 1; |
| 282 | optional Type type = 2; |
| 283 | optional string label = 3; |
| 284 | } |
| 285 | |
| 286 | message Email { |
| 287 | enum Type { |
| 288 | HOME = 1; |
| 289 | MOBILE = 2; |
| 290 | WORK = 3; |
| 291 | CUSTOM = 4; |
| 292 | } |
| 293 | |
| 294 | optional string value = 1; |
| 295 | optional Type type = 2; |
| 296 | optional string label = 3; |
| 297 | } |
| 298 | |
| 299 | message PostalAddress { |
| 300 | enum Type { |
| 301 | HOME = 1; |
| 302 | WORK = 2; |
| 303 | CUSTOM = 3; |
| 304 | } |
| 305 | |
| 306 | optional Type type = 1; |
| 307 | optional string label = 2; |
| 308 | optional string street = 3; |
| 309 | optional string pobox = 4; |
| 310 | optional string neighborhood = 5; |
| 311 | optional string city = 6; |
| 312 | optional string region = 7; |
| 313 | optional string postcode = 8; |
| 314 | optional string country = 9; |
| 315 | } |
| 316 | |
| 317 | message Avatar { |
| 318 | optional AttachmentPointer avatar = 1; |
| 319 | optional bool isProfile = 2; |
| 320 | } |
| 321 | |
| 322 | optional Name name = 1; |
| 323 | repeated Phone number = 3; |
| 324 | repeated Email email = 4; |
| 325 | repeated PostalAddress address = 5; |
| 326 | optional Avatar avatar = 6; |
| 327 | optional string organization = 7; |
| 328 | } |
| 329 | |
| 330 | message Sticker { |
| 331 | optional bytes packId = 1; |
| 332 | optional bytes packKey = 2; |
| 333 | optional uint32 stickerId = 3; |
| 334 | optional AttachmentPointer data = 4; |
| 335 | optional string emoji = 5; |
| 336 | } |
| 337 | |
| 338 | message Reaction { |
| 339 | optional string emoji = 1; |
| 340 | optional bool remove = 2; |
| 341 | reserved /* targetAuthorE164 */ 3; |
| 342 | optional string targetAuthorAci = 4; |
| 343 | optional uint64 targetSentTimestamp = 5; |
| 344 | optional bytes targetAuthorAciBinary = 6; // 16-byte UUID |
| 345 | } |
| 346 | |
| 347 | message Delete { |
| 348 | optional uint64 targetSentTimestamp = 1; |
| 349 | } |
| 350 | |
| 351 | message GroupCallUpdate { |
| 352 | optional string eraId = 1; |
| 353 | } |
| 354 | |
| 355 | message StoryContext { |
| 356 | optional string authorAci = 1; |
| 357 | optional uint64 sentTimestamp = 2; |
| 358 | optional bytes authorAciBinary = 3; // 16-byte UUID |
| 359 | } |
| 360 | |
| 361 | enum ProtocolVersion { |
| 362 | option allow_alias = true; |
| 363 | |
| 364 | INITIAL = 0; |
| 365 | MESSAGE_TIMERS = 1; |
| 366 | VIEW_ONCE = 2; |
| 367 | VIEW_ONCE_VIDEO = 3; |
| 368 | REACTIONS = 4; |
| 369 | CDN_SELECTOR_ATTACHMENTS = 5; |
| 370 | MENTIONS = 6; |
| 371 | PAYMENTS = 7; |
| 372 | POLLS = 8; |
| 373 | CURRENT = 8; |
| 374 | } |
| 375 | |
| 376 | message GiftBadge { |
| 377 | optional bytes receiptCredentialPresentation = 1; |
| 378 | } |
| 379 | |
| 380 | message PollCreate { |
| 381 | optional string question = 1; |
| 382 | optional bool allowMultiple = 2; |
| 383 | repeated string options = 3; |
| 384 | } |
| 385 | |
| 386 | message PollTerminate { |
| 387 | optional uint64 targetSentTimestamp = 1; |
| 388 | } |
| 389 | |
| 390 | message PollVote { |
| 391 | optional bytes targetAuthorAciBinary = 1; |
| 392 | optional uint64 targetSentTimestamp = 2; |
| 393 | repeated uint32 optionIndexes = 3; |
| 394 | optional uint32 voteCount = 4; |
| 395 | } |
| 396 | |
| 397 | message PinMessage { |
| 398 | optional bytes targetAuthorAciBinary = 1; // 16-byte UUID |
| 399 | optional uint64 targetSentTimestamp = 2; |
| 400 | oneof pinDuration { |
| 401 | uint32 pinDurationSeconds = 3; |
| 402 | bool pinDurationForever = 4; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | message UnpinMessage { |
| 407 | optional bytes targetAuthorAciBinary = 1; // 16-byte UUID |
| 408 | optional uint64 targetSentTimestamp = 2; |
| 409 | } |
| 410 | |
| 411 | message AdminDelete { |
| 412 | optional bytes targetAuthorAciBinary = 1; // 16-byte UUID |
| 413 | optional uint64 targetSentTimestamp = 2; |
| 414 | } |
| 415 | |
| 416 | optional string body = 1; |
| 417 | repeated AttachmentPointer attachments = 2; |
| 418 | reserved /*groupV1*/ 3; |
| 419 | optional GroupContextV2 groupV2 = 15; |
| 420 | optional uint32 flags = 4; |
| 421 | optional uint32 expireTimer = 5; |
| 422 | optional uint32 expireTimerVersion = 23; |
| 423 | optional bytes profileKey = 6; |
| 424 | optional uint64 timestamp = 7; |
| 425 | optional Quote quote = 8; |
| 426 | repeated Contact contact = 9; |
| 427 | repeated Preview preview = 10; |
| 428 | optional Sticker sticker = 11; |
| 429 | optional uint32 requiredProtocolVersion = 12; |
| 430 | optional bool isViewOnce = 14; |
| 431 | optional Reaction reaction = 16; |
| 432 | optional Delete delete = 17; |
| 433 | repeated BodyRange bodyRanges = 18; |
| 434 | optional GroupCallUpdate groupCallUpdate = 19; |
| 435 | optional Payment payment = 20; |
| 436 | optional StoryContext storyContext = 21; |
| 437 | optional GiftBadge giftBadge = 22; |
| 438 | optional PollCreate pollCreate = 24; |
| 439 | optional PollTerminate pollTerminate = 25; |
| 440 | optional PollVote pollVote = 26; |
| 441 | optional PinMessage pinMessage = 27; |
| 442 | optional UnpinMessage unpinMessage = 28; |
| 443 | optional AdminDelete adminDelete = 29; |
| 444 | // NEXT ID: 30 |
| 445 | } |
| 446 | |
| 447 | message NullMessage { |
| 448 | optional bytes padding = 1; |
| 449 | } |
| 450 | |
| 451 | message ReceiptMessage { |
| 452 | enum Type { |
| 453 | DELIVERY = 0; |
| 454 | READ = 1; |
| 455 | VIEWED = 2; |
| 456 | } |
| 457 | |
| 458 | optional Type type = 1; |
| 459 | repeated uint64 timestamp = 2; |
| 460 | } |
| 461 | |
| 462 | message TypingMessage { |
| 463 | enum Action { |
| 464 | STARTED = 0; |
| 465 | STOPPED = 1; |
| 466 | } |
| 467 | |
| 468 | optional uint64 timestamp = 1; |
| 469 | optional Action action = 2; |
| 470 | optional bytes groupId = 3; |
| 471 | } |
| 472 | |
| 473 | message StoryMessage { |
| 474 | optional bytes profileKey = 1; |
| 475 | optional GroupContextV2 group = 2; |
| 476 | oneof attachment { |
| 477 | AttachmentPointer fileAttachment = 3; |
| 478 | TextAttachment textAttachment = 4; |
| 479 | } |
| 480 | optional bool allowsReplies = 5; |
| 481 | repeated BodyRange bodyRanges = 6; |
| 482 | } |
| 483 | |
| 484 | message Preview { |
| 485 | optional string url = 1; |
| 486 | optional string title = 2; |
| 487 | optional AttachmentPointer image = 3; |
| 488 | optional string description = 4; |
| 489 | optional uint64 date = 5; |
| 490 | } |
| 491 | |
| 492 | message TextAttachment { |
| 493 | enum Style { |
| 494 | DEFAULT = 0; |
| 495 | REGULAR = 1; |
| 496 | BOLD = 2; |
| 497 | SERIF = 3; |
| 498 | SCRIPT = 4; |
| 499 | CONDENSED = 5; |
| 500 | } |
| 501 | |
| 502 | message Gradient { |
| 503 | // Color ordering: |
| 504 | // 0 degrees: bottom-to-top |
| 505 | // 90 degrees: left-to-right |
| 506 | // 180 degrees: top-to-bottom |
| 507 | // 270 degrees: right-to-left |
| 508 | |
| 509 | optional uint32 startColor = 1; // deprecated: this field will be removed in a future release. |
| 510 | optional uint32 endColor = 2; // deprecated: this field will be removed in a future release. |
| 511 | optional uint32 angle = 3; // degrees |
| 512 | repeated uint32 colors = 4; |
| 513 | repeated float positions = 5; // percent from 0 to 1 |
| 514 | } |
| 515 | |
| 516 | optional string text = 1; |
| 517 | optional Style textStyle = 2; |
| 518 | optional uint32 textForegroundColor = 3; // integer representation of hex color |
| 519 | optional uint32 textBackgroundColor = 4; |
| 520 | optional Preview preview = 5; |
| 521 | oneof background { |
| 522 | Gradient gradient = 6; |
| 523 | uint32 color = 7; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | message Verified { |
| 528 | enum State { |
| 529 | DEFAULT = 0; |
| 530 | VERIFIED = 1; |
| 531 | UNVERIFIED = 2; |
| 532 | } |
| 533 | |
| 534 | reserved /*destinationE164*/ 1; |
| 535 | optional string destinationAci = 5; |
| 536 | optional bytes identityKey = 2; |
| 537 | optional State state = 3; |
| 538 | optional bytes nullMessage = 4; |
| 539 | optional bytes destinationAciBinary = 6; // 16-byte UUID |
| 540 | } |
| 541 | |
| 542 | message SyncMessage { |
| 543 | message Sent { |
| 544 | message UnidentifiedDeliveryStatus { |
| 545 | reserved /*destinationE164*/ 1; |
| 546 | optional string destinationServiceId = 3; |
| 547 | optional bool unidentified = 2; |
| 548 | reserved /*destinationPni */ 4; |
| 549 | optional bytes destinationPniIdentityKey = 5; // Only set for PNI destinations |
| 550 | optional bytes destinationServiceIdBinary = 6; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 551 | } |
| 552 | |
| 553 | message StoryMessageRecipient { |
| 554 | optional string destinationServiceId = 1; |
| 555 | repeated string distributionListIds = 2; |
| 556 | optional bool isAllowedToReply = 3; |
| 557 | reserved /*destinationPni */ 4; |
| 558 | optional bytes destinationServiceIdBinary = 5; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 559 | } |
| 560 | |
| 561 | optional string destinationE164 = 1; |
| 562 | optional string destinationServiceId = 7; |
| 563 | optional uint64 timestamp = 2; |
| 564 | optional DataMessage message = 3; |
| 565 | optional uint64 expirationStartTimestamp = 4; |
| 566 | repeated UnidentifiedDeliveryStatus unidentifiedStatus = 5; |
| 567 | optional bool isRecipientUpdate = 6 [default = false]; |
| 568 | optional StoryMessage storyMessage = 8; |
| 569 | repeated StoryMessageRecipient storyMessageRecipients = 9; |
| 570 | optional EditMessage editMessage = 10; |
| 571 | reserved /*destinationPni */ 11; |
| 572 | optional bytes destinationServiceIdBinary = 12; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 573 | // Next ID: 13 |
| 574 | } |
| 575 | |
| 576 | message Contacts { |
| 577 | optional AttachmentPointer blob = 1; |
| 578 | optional bool complete = 2 [default = false]; |
| 579 | } |
| 580 | |
| 581 | message Blocked { |
| 582 | repeated string numbers = 1; // deprecated: this field will be removed in a future release. |
| 583 | repeated string acis = 3; |
| 584 | repeated bytes groupIds = 2; // deprecated: this field will be removed in a future release. |
| 585 | repeated bytes acisBinary = 4; // deprecated: this field will be removed in a future release. |
| 586 | |
| 587 | message BlockedE164 { |
| 588 | optional string e164 = 1; |
| 589 | optional uint64 timestamp = 2; |
| 590 | } |
| 591 | |
| 592 | message BlockedAci { |
| 593 | optional bytes aciBinary = 1; // 16-byte UUID |
| 594 | optional uint64 timestamp = 2; |
| 595 | } |
| 596 | |
| 597 | message BlockedGroup { |
| 598 | optional bytes groupId = 1; |
| 599 | optional uint64 timestamp = 2; |
| 600 | } |
| 601 | |
| 602 | repeated BlockedE164 blockedE164s = 5; |
| 603 | repeated BlockedAci blockedAcis = 6; |
| 604 | repeated BlockedGroup blockedGroups = 7; |
| 605 | } |
| 606 | |
| 607 | message Request { |
| 608 | enum Type { |
| 609 | UNKNOWN = 0; |
| 610 | CONTACTS = 1; |
| 611 | reserved /*GROUPS*/ 2; |
| 612 | BLOCKED = 3; |
| 613 | CONFIGURATION = 4; |
| 614 | KEYS = 5; |
| 615 | reserved /*PNI_IDENTITY*/ 6; |
| 616 | } |
| 617 | |
| 618 | optional Type type = 1; |
| 619 | } |
| 620 | |
| 621 | message Read { |
| 622 | reserved /*senderE164*/ 1; |
| 623 | optional string senderAci = 3; |
| 624 | optional uint64 timestamp = 2; |
| 625 | optional bytes senderAciBinary = 4; // 16-byte UUID |
| 626 | } |
| 627 | |
| 628 | message Viewed { |
| 629 | reserved /*senderE164*/ 1; |
| 630 | optional string senderAci = 3; |
| 631 | optional uint64 timestamp = 2; |
| 632 | optional bytes senderAciBinary = 4; // 16-byte UUID |
| 633 | } |
| 634 | |
| 635 | message Configuration { |
| 636 | optional bool readReceipts = 1; |
| 637 | optional bool unidentifiedDeliveryIndicators = 2; |
| 638 | optional bool typingIndicators = 3; |
| 639 | reserved /* linkPreviews */ 4; |
| 640 | reserved /* provisioningVersion */ 5; |
| 641 | optional bool linkPreviews = 6; |
| 642 | } |
| 643 | |
| 644 | message StickerPackOperation { |
| 645 | enum Type { |
| 646 | INSTALL = 0; |
| 647 | REMOVE = 1; |
| 648 | } |
| 649 | |
| 650 | optional bytes packId = 1; |
| 651 | optional bytes packKey = 2; |
| 652 | optional Type type = 3; |
| 653 | } |
| 654 | |
| 655 | message ViewOnceOpen { |
| 656 | reserved /*senderE164*/ 1; |
| 657 | optional string senderAci = 3; |
| 658 | optional uint64 timestamp = 2; |
| 659 | optional bytes senderAciBinary = 4; // 16-byte UUID |
| 660 | } |
| 661 | |
| 662 | message FetchLatest { |
| 663 | enum Type { |
| 664 | UNKNOWN = 0; |
| 665 | LOCAL_PROFILE = 1; |
| 666 | STORAGE_MANIFEST = 2; |
| 667 | SUBSCRIPTION_STATUS = 3; |
| 668 | } |
| 669 | |
| 670 | optional Type type = 1; |
| 671 | } |
| 672 | |
| 673 | message Keys { |
| 674 | reserved /* storageService */ 1; |
| 675 | reserved /* master */ 2; |
| 676 | optional string accountEntropyPool = 3; |
| 677 | optional bytes mediaRootBackupKey = 4; |
| 678 | } |
| 679 | |
| 680 | message PniIdentity { |
| 681 | optional bytes publicKey = 1; |
| 682 | optional bytes privateKey = 2; |
| 683 | } |
| 684 | |
| 685 | message MessageRequestResponse { |
| 686 | enum Type { |
| 687 | UNKNOWN = 0; |
| 688 | ACCEPT = 1; |
| 689 | DELETE = 2; |
| 690 | BLOCK = 3; |
| 691 | BLOCK_AND_DELETE = 4; |
| 692 | SPAM = 5; |
| 693 | BLOCK_AND_SPAM = 6; |
| 694 | } |
| 695 | |
| 696 | reserved /*threadE164*/ 1; |
| 697 | optional string threadAci = 2; |
| 698 | optional bytes groupId = 3; |
| 699 | optional Type type = 4; |
| 700 | optional bytes threadAciBinary = 5; // 16-byte UUID |
| 701 | } |
| 702 | |
| 703 | message OutgoingPayment { |
| 704 | message MobileCoin { |
| 705 | optional bytes recipientAddress = 1; |
| 706 | optional uint64 amountPicoMob = 2; |
| 707 | optional uint64 feePicoMob = 3; |
| 708 | optional bytes receipt = 4; |
| 709 | optional uint64 ledgerBlockTimestamp = 5; |
| 710 | optional uint64 ledgerBlockIndex = 6; |
| 711 | repeated bytes spentKeyImages = 7; |
| 712 | repeated bytes outputPublicKeys = 8; |
| 713 | } |
| 714 | optional string recipientServiceId = 1; |
| 715 | optional string note = 2; |
| 716 | oneof attachment_identifier { |
| 717 | MobileCoin mobileCoin = 3; |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | message PniChangeNumber { |
| 722 | optional bytes identityKeyPair = 1; // Serialized libsignal-client IdentityKeyPair |
| 723 | optional bytes signedPreKey = 2; // Serialized libsignal-client SignedPreKeyRecord |
| 724 | optional bytes lastResortKyberPreKey = 5; // Serialized libsignal-client KyberPreKeyRecord |
| 725 | optional uint32 registrationId = 3; |
| 726 | optional string newE164 = 4; // The e164 we have changed our number to |
| 727 | // Next ID: 6 |
| 728 | } |
| 729 | |
| 730 | message CallEvent { |
| 731 | enum Type { |
| 732 | UNKNOWN_TYPE = 0; |
| 733 | AUDIO_CALL = 1; |
| 734 | VIDEO_CALL = 2; |
| 735 | GROUP_CALL = 3; |
| 736 | AD_HOC_CALL = 4; |
| 737 | } |
| 738 | |
| 739 | enum Direction { |
| 740 | UNKNOWN_DIRECTION = 0; |
| 741 | INCOMING = 1; |
| 742 | OUTGOING = 2; |
| 743 | } |
| 744 | |
| 745 | enum Event { |
| 746 | UNKNOWN_EVENT = 0; |
| 747 | ACCEPTED = 1; |
| 748 | NOT_ACCEPTED = 2; |
| 749 | DELETE = 3; |
| 750 | OBSERVED = 4; |
| 751 | } |
| 752 | |
| 753 | /* Data identifying a conversation. The service ID for 1:1, the group ID for |
| 754 | * group, or the room ID for an ad-hoc call. See also |
| 755 | * `CallLogEvent/conversationId`. */ |
| 756 | optional bytes conversationId = 1; |
| 757 | /* An identifier for a call. Generated directly for 1:1, or derived from |
| 758 | * the era ID for group and ad-hoc calls. See also `CallLogEvent/callId`. */ |
| 759 | optional uint64 callId = 2; |
| 760 | optional uint64 timestamp = 3; |
| 761 | optional Type type = 4; |
| 762 | optional Direction direction = 5; |
| 763 | optional Event event = 6; |
| 764 | } |
| 765 | |
| 766 | message CallLinkUpdate { |
| 767 | enum Type { |
| 768 | UPDATE = 0; |
| 769 | reserved 1; // was DELETE, superseded by storage service |
| 770 | } |
| 771 | |
| 772 | optional bytes rootKey = 1; |
| 773 | optional bytes adminPasskey = 2; |
| 774 | optional Type type = 3; // defaults to UPDATE |
| 775 | reserved /*epoch*/ 4; |
| 776 | } |
| 777 | |
| 778 | message CallLogEvent { |
| 779 | enum Type { |
| 780 | CLEAR = 0; |
| 781 | MARKED_AS_READ = 1; |
| 782 | MARKED_AS_READ_IN_CONVERSATION = 2; |
| 783 | CLEAR_IN_CONVERSATION = 3; |
| 784 | } |
| 785 | |
| 786 | optional Type type = 1; |
| 787 | optional uint64 timestamp = 2; |
| 788 | /* Data identifying a conversation. The service ID for 1:1, the group ID for |
| 789 | * group, or the room ID for an ad-hoc call. See also |
| 790 | * `CallEvent/conversationId`. */ |
| 791 | optional bytes conversationId = 3; |
| 792 | /* An identifier for a call. Generated directly for 1:1, or derived from |
| 793 | * the era ID for group and ad-hoc calls. See also `CallEvent/callId`. */ |
| 794 | optional uint64 callId = 4; |
| 795 | } |
| 796 | |
| 797 | message DeleteForMe { |
| 798 | message MessageDeletes { |
| 799 | optional ConversationIdentifier conversation = 1; |
| 800 | repeated AddressableMessage messages = 2; |
| 801 | } |
| 802 | |
| 803 | message AttachmentDelete { |
| 804 | optional ConversationIdentifier conversation = 1; |
| 805 | optional AddressableMessage targetMessage = 2; |
| 806 | // The `clientUuid` from `AttachmentPointer`. |
| 807 | optional bytes clientUuid = 3; |
| 808 | // SHA256 hash of the (encrypted, padded, etc.) attachment blob on the CDN. |
| 809 | optional bytes fallbackDigest = 4; |
| 810 | // SHA256 hash of the plaintext content of the attachment. |
| 811 | optional bytes fallbackPlaintextHash = 5; |
| 812 | } |
| 813 | |
| 814 | message ConversationDelete { |
| 815 | optional ConversationIdentifier conversation = 1; |
| 816 | repeated AddressableMessage mostRecentMessages = 2; |
| 817 | optional bool isFullDelete = 3; |
| 818 | repeated AddressableMessage mostRecentNonExpiringMessages = 4; |
| 819 | } |
| 820 | |
| 821 | message LocalOnlyConversationDelete { |
| 822 | optional ConversationIdentifier conversation = 1; |
| 823 | } |
| 824 | |
| 825 | repeated MessageDeletes messageDeletes = 1; |
| 826 | repeated ConversationDelete conversationDeletes = 2; |
| 827 | repeated LocalOnlyConversationDelete localOnlyConversationDeletes = 3; |
| 828 | repeated AttachmentDelete attachmentDeletes = 4; |
| 829 | } |
| 830 | |
| 831 | message DeviceNameChange { |
| 832 | reserved /*name*/ 1; |
| 833 | optional uint32 deviceId = 2; |
| 834 | } |
| 835 | |
| 836 | message AttachmentBackfillRequest { |
| 837 | optional AddressableMessage targetMessage = 1; |
| 838 | optional ConversationIdentifier targetConversation = 2; |
| 839 | } |
| 840 | |
| 841 | message AttachmentBackfillResponse { |
| 842 | message AttachmentData { |
| 843 | enum Status { |
| 844 | PENDING = 0; |
| 845 | TERMINAL_ERROR = 1; |
| 846 | } |
| 847 | |
| 848 | oneof data { |
| 849 | AttachmentPointer attachment = 1; |
| 850 | Status status = 2; |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | enum Error { |
| 855 | MESSAGE_NOT_FOUND = 0; |
| 856 | } |
| 857 | |
| 858 | message AttachmentDataList { |
| 859 | repeated AttachmentData attachments = 1; |
| 860 | optional AttachmentData longText = 2; |
| 861 | } |
| 862 | |
| 863 | optional AddressableMessage targetMessage = 1; |
| 864 | optional ConversationIdentifier targetConversation = 2; |
| 865 | |
| 866 | oneof data { |
| 867 | AttachmentDataList attachments = 3; |
| 868 | Error error = 4; |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | message UsernameChange {} |
| 873 | |
| 874 | oneof content { |
| 875 | Sent sent = 1; |
| 876 | Contacts contacts = 2; |
| 877 | Request request = 4; |
| 878 | Blocked blocked = 6; |
| 879 | Verified verified = 7; |
| 880 | Configuration configuration = 9; |
| 881 | ViewOnceOpen viewOnceOpen = 11; |
| 882 | FetchLatest fetchLatest = 12; |
| 883 | Keys keys = 13; |
| 884 | MessageRequestResponse messageRequestResponse = 14; |
| 885 | OutgoingPayment outgoingPayment = 15; |
| 886 | PniChangeNumber pniChangeNumber = 18; |
| 887 | CallEvent callEvent = 19; |
| 888 | CallLinkUpdate callLinkUpdate = 20; |
| 889 | CallLogEvent callLogEvent = 21; |
| 890 | DeleteForMe deleteForMe = 22; |
| 891 | DeviceNameChange deviceNameChange = 23; |
| 892 | AttachmentBackfillRequest attachmentBackfillRequest = 24; |
| 893 | AttachmentBackfillResponse attachmentBackfillResponse = 25; |
| 894 | UsernameChange usernameChange = 26; |
| 895 | } |
| 896 | |
| 897 | reserved /*groups*/ 3; |
| 898 | |
| 899 | // Protobufs don't allow `repeated` fields to be inside of `oneof` so while |
| 900 | // the fields below are mutually exclusive with the rest of the values above |
| 901 | // we have to place them outside of `oneof`. |
| 902 | repeated Read read = 5; |
| 903 | repeated StickerPackOperation stickerPackOperation = 10; |
| 904 | repeated Viewed viewed = 16; |
| 905 | |
| 906 | reserved /*pniIdentity*/ 17; |
| 907 | |
| 908 | optional bytes padding = 8; |
| 909 | } |
| 910 | |
| 911 | message AttachmentPointer { |
| 912 | enum Flags { |
| 913 | VOICE_MESSAGE = 1; |
| 914 | BORDERLESS = 2; |
| 915 | reserved 4; |
| 916 | GIF = 8; |
| 917 | } |
| 918 | |
| 919 | oneof attachment_identifier { |
| 920 | fixed64 cdnId = 1; |
| 921 | string cdnKey = 15; |
| 922 | } |
| 923 | // Cross-client identifier for this attachment among all attachments on the |
| 924 | // owning message. |
| 925 | optional bytes clientUuid = 20; |
| 926 | optional string contentType = 2; |
| 927 | optional bytes key = 3; |
| 928 | optional uint32 size = 4; |
| 929 | optional bytes thumbnail = 5; |
| 930 | optional bytes digest = 6; |
| 931 | reserved /* incrementalMac with implicit chunk sizing */ 16; |
| 932 | reserved /* incrementalMac for all attachment types */ 18; |
| 933 | optional bytes incrementalMac = 19; |
| 934 | optional uint32 chunkSize = 17; |
| 935 | optional string fileName = 7; |
| 936 | optional uint32 flags = 8; |
| 937 | optional uint32 width = 9; |
| 938 | optional uint32 height = 10; |
| 939 | optional string caption = 11; |
| 940 | optional string blurHash = 12; |
| 941 | optional uint64 uploadTimestamp = 13; |
| 942 | optional uint32 cdnNumber = 14; |
| 943 | // Next ID: 21 |
| 944 | } |
| 945 | |
| 946 | message GroupContextV2 { |
| 947 | optional bytes masterKey = 1; |
| 948 | optional uint32 revision = 2; |
| 949 | optional bytes groupChange = 3; |
| 950 | } |
| 951 | |
| 952 | message ContactDetails { |
| 953 | message Avatar { |
| 954 | optional string contentType = 1; |
| 955 | optional uint32 length = 2; |
| 956 | } |
| 957 | |
| 958 | optional string number = 1; |
| 959 | optional string aci = 9; |
| 960 | optional bytes aciBinary = 13; // 16-byte UUID |
| 961 | optional string name = 2; |
| 962 | optional Avatar avatar = 3; |
| 963 | reserved /* color */ 4; |
| 964 | reserved /* verified */ 5; |
| 965 | reserved /* profileKey */ 6; |
| 966 | reserved /* blocked */ 7; |
| 967 | optional uint32 expireTimer = 8; |
| 968 | optional uint32 expireTimerVersion = 12; |
| 969 | optional uint32 inboxPosition = 10; |
| 970 | reserved /* archived */ 11; |
| 971 | // NEXT ID: 14 |
| 972 | } |
| 973 | |
| 974 | message PaymentAddress { |
| 975 | message MobileCoin { |
| 976 | optional bytes publicAddress = 1; |
| 977 | optional bytes signature = 2; |
| 978 | } |
| 979 | |
| 980 | oneof Address { |
| 981 | MobileCoin mobileCoin = 1; |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | message DecryptionErrorMessage { |
| 986 | optional bytes ratchetKey = 1; // set to the public ratchet key from the SignalMessage if a 1-1 payload fails to decrypt |
| 987 | optional uint64 timestamp = 2; |
| 988 | optional uint32 deviceId = 3; |
| 989 | } |
| 990 | |
| 991 | message PniSignatureMessage { |
| 992 | optional bytes pni = 1; |
| 993 | // Signature *by* the PNI identity key *of* the ACI identity key |
| 994 | optional bytes signature = 2; |
| 995 | } |
| 996 | |
| 997 | message EditMessage { |
| 998 | optional uint64 targetSentTimestamp = 1; |
| 999 | optional DataMessage dataMessage = 2; |
| 1000 | } |
| 1001 | |
| 1002 | message BodyRange { |
| 1003 | enum Style { |
| 1004 | NONE = 0; |
| 1005 | BOLD = 1; |
| 1006 | ITALIC = 2; |
| 1007 | SPOILER = 3; |
| 1008 | STRIKETHROUGH = 4; |
| 1009 | MONOSPACE = 5; |
| 1010 | } |
| 1011 | |
| 1012 | optional uint32 start = 1; // Starting index in UTF-16 code units/raw string representation |
| 1013 | optional uint32 length = 2; // Length of range in UTF-16 code units/raw string representation |
| 1014 | |
| 1015 | oneof associatedValue { |
| 1016 | string mentionAci = 3; |
| 1017 | Style style = 4; |
| 1018 | bytes mentionAciBinary = 5; // 16-byte UUID |
| 1019 | } |
| 1020 | } |
| 1021 | |
| 1022 | message AddressableMessage { |
| 1023 | oneof author { |
| 1024 | string authorServiceId = 1; |
| 1025 | string authorE164 = 2; |
| 1026 | bytes authorServiceIdBinary = 4; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 1027 | } |
| 1028 | optional uint64 sentTimestamp = 3; |
| 1029 | } |
| 1030 | |
| 1031 | message ConversationIdentifier { |
| 1032 | oneof identifier { |
| 1033 | string threadServiceId = 1; |
| 1034 | bytes threadGroupId = 2; |
| 1035 | string threadE164 = 3; |
| 1036 | bytes threadServiceIdBinary = 4; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI) |
| 1037 | } |
| 1038 | } |