common.proto 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. // # Common Types
  2. syntax = "proto3";
  3. package common;
  4. option java_package = "ch.threema.protobuf";
  5. // A unit that may be used in a `oneof` option without any values.
  6. // Note: We're using this to simulate tagged unions.
  7. message Unit {}
  8. // Threema Blob to be uploaded/downloaded from the Blob server.
  9. message Blob {
  10. // Blob ID as given by the Blob server
  11. bytes id = 1;
  12. // Nonce used for encrypting/decrypting the Blob.
  13. // Note: May be omitted if unambigously defined by the context.
  14. bytes nonce = 2;
  15. // Secret (or public) key used for encrypting/decrypting the Blob.
  16. // Note: May be omitted if unambigously defined by the context.
  17. bytes key = 3;
  18. // Unix-ish timestamp in milliseconds when the blob has been uploaded
  19. uint64 uploaded_at = 4;
  20. }
  21. // Inline Blob data.
  22. message BlobData {
  23. // Associated Blob ID
  24. bytes id = 1;
  25. // The Blob's data
  26. bytes data = 2;
  27. }
  28. // Generic image.
  29. message Image {
  30. // Format type of the image
  31. enum Type {
  32. JPEG = 0;
  33. }
  34. Type type = 1;
  35. // The image's associated blob.
  36. Blob blob = 2;
  37. }
  38. // Unique group identity.
  39. message GroupIdentity {
  40. // Group id as chosen by the group's creator
  41. fixed64 group_id = 1;
  42. // Threema ID of the group's creator
  43. string creator_identity = 2;
  44. }
  45. // Generic image allowing delta updates
  46. //
  47. // Note: Lack of presence generally means that the image should remain
  48. // unchanged.
  49. message DeltaImage {
  50. oneof image {
  51. // The image is empty or was explicitly removed
  52. Unit removed = 1;
  53. // The new updated image
  54. Image updated = 2;
  55. }
  56. }
  57. // Timespan (year 1970+) with milliseconds accuracy.
  58. //
  59. // Note: This message is invalid if `to` is smaller than `from`.
  60. message Timespan {
  61. // Start of the timespan (Unix-ish timestamp in milliseconds, inclusive)
  62. uint64 from = 1;
  63. // End of the timespan (Unix-ish timestamp in miliseconds, inclusive)
  64. uint64 to = 2;
  65. }
  66. // Container for a list of identities.
  67. message Identities {
  68. // List of identities
  69. repeated string identities = 1;
  70. }
  71. // Generic 2D resolution
  72. message Resolution {
  73. uint32 width = 1;
  74. uint32 height = 2;
  75. }
  76. // CSP features supported by a device or available for a contact (64 bit mask).
  77. //
  78. // IMPORTANT: The flags determine what a device/contact is capable of, not
  79. // whether the settings allow for it. For example, group calls may be supported
  80. // but ignored if disabled in the settings.
  81. enum CspFeatureMaskFlag {
  82. // No features available
  83. NONE = 0x0000;
  84. // Supports voice messages.
  85. VOICE_MESSAGE_SUPPORT = 0x0001;
  86. // Supports groups.
  87. GROUP_SUPPORT = 0x0002;
  88. // Supports polls.
  89. POLL_SUPPORT = 0x0004;
  90. // Supports file messages.
  91. FILE_MESSAGE_SUPPORT = 0x0008;
  92. // Supports 1:1 audio calls.
  93. O2O_AUDIO_CALL_SUPPORT = 0x0010;
  94. // Supports 1:1 video calls.
  95. O2O_VIDEO_CALL_SUPPORT = 0x0020;
  96. // Supports forward security.
  97. FORWARD_SECURITY_SUPPORT = 0x0040;
  98. // Supports group calls.
  99. GROUP_CALL_SUPPORT = 0x0080;
  100. // Supports editing messages.
  101. EDIT_MESSAGE_SUPPORT = 0x0100;
  102. // Supports deleting messages.
  103. DELETE_MESSAGE_SUPPORT = 0x0200;
  104. // Supports (new-style) reactions.
  105. REACTION_SUPPORT = 0x0400;
  106. }
  107. // E2E message type as defined by the Chat Server Protocol.
  108. enum CspE2eMessageType {
  109. // Invalid message type
  110. _INVALID_TYPE = 0x00;
  111. // [`empty`](ref:e2e.empty)
  112. EMPTY = 0xfc;
  113. // 1:1 messages
  114. // ------------
  115. // [`text`](ref:e2e.text)
  116. TEXT = 0x01;
  117. // [`deprecated-image`](ref:e2e.deprecated-image)
  118. DEPRECATED_IMAGE = 0x02;
  119. // [`location`](ref:e2e.location)
  120. LOCATION = 0x10;
  121. // [`deprecated-audio`](ref:e2e.deprecated-audio)
  122. DEPRECATED_AUDIO = 0x14;
  123. // [`deprecated-video`](ref:e2e.deprecated-video)
  124. DEPRECATED_VIDEO = 0x13;
  125. // [`file`](ref:e2e.file)
  126. FILE = 0x17;
  127. // [`poll-setup`](ref:e2e.poll-setup)
  128. POLL_SETUP = 0x15;
  129. // [`poll-vote`](ref:e2e.poll-vote)
  130. POLL_VOTE = 0x16;
  131. // [`call-offer`](ref:e2e.call-offer)
  132. CALL_OFFER = 0x60;
  133. // [`call-answer`](ref:e2e.call-answer)
  134. CALL_ANSWER = 0x61;
  135. // [`call-ice-candidate`](ref:e2e.call-ice-candidate)
  136. CALL_ICE_CANDIDATE = 0x62;
  137. // [`call-hangup`](ref:e2e.call-hangup)
  138. CALL_HANGUP = 0x63;
  139. // [`call-ringing`](ref:e2e.call-ringing)
  140. CALL_RINGING = 0x64;
  141. // 1:1 message updates
  142. // -------------------
  143. // [`delivery-receipt`](ref:e2e.delivery-receipt)
  144. DELIVERY_RECEIPT = 0x80;
  145. // [`typing-indicator`](ref:e2e.typing-indicator)
  146. TYPING_INDICATOR = 0x90;
  147. // `csp-e2e.Reaction`
  148. REACTION = 0x82;
  149. // `csp-e2e.EditMessage`
  150. EDIT_MESSAGE = 0x91;
  151. // `csp-e2e.DeleteMessage`
  152. DELETE_MESSAGE = 0x92;
  153. // 1:1 contact control
  154. // -------------------
  155. // [`set-profile-picture`](ref:e2e.set-profile-picture) of a contact
  156. CONTACT_SET_PROFILE_PICTURE = 0x18;
  157. // [`delete-profile-picture`](ref:e2e.delete-profile-picture) of a contact
  158. CONTACT_DELETE_PROFILE_PICTURE = 0x19;
  159. // [`contact-request-profile-picture`](ref:e2e.contact-request-profile-picture)
  160. CONTACT_REQUEST_PROFILE_PICTURE = 0x1a;
  161. // Group invitations
  162. // -----------------
  163. // `csp-e2e.GroupJoinRequest`
  164. GROUP_JOIN_REQUEST = 0x4d;
  165. // `csp-e2e.GroupJoinResponse`
  166. GROUP_JOIN_RESPONSE = 0x4e;
  167. // Group control
  168. // -------------
  169. // [`group-setup`](ref:e2e.group-setup) wrapped by
  170. // [`group-creator-container`](ref:e2e.group-creator-container)
  171. GROUP_SETUP = 0x4a;
  172. // [`group-name`](ref:e2e.group-name) wrapped by
  173. // [`group-creator-container`](ref:e2e.group-creator-container)
  174. GROUP_NAME = 0x4b;
  175. // [`group-leave`](ref:e2e.group-leave) wrapped by
  176. // [`group-member-container`](ref:e2e.group-member-container)
  177. GROUP_LEAVE = 0x4c;
  178. // [`set-profile-picture`](ref:e2e.set-profile-picture) wrapped by
  179. // [`group-creator-container`](ref:e2e.group-creator-container)
  180. GROUP_SET_PROFILE_PICTURE = 0x50;
  181. // [`delete-profile-picture`](ref:e2e.delete-profile-picture) wrapped by
  182. // [`group-creator-container`](ref:e2e.group-creator-container)
  183. GROUP_DELETE_PROFILE_PICTURE = 0x54;
  184. // [`group-sync-request`](ref:e2e.group-sync-request) wrapped by
  185. // [`group-creator-container`](ref:e2e.group-creator-container)
  186. GROUP_SYNC_REQUEST = 0x51;
  187. // `csp-e2e.GroupCallStart` wrapped by
  188. // [`group-member-container`](ref:e2e.group-member-container)
  189. GROUP_CALL_START = 0x4f;
  190. // Group messages
  191. // --------------
  192. // `0x41`: [`text`](ref:e2e.text) wrapped by
  193. // [`group-member-container`](ref:e2e.group-member-container)
  194. GROUP_TEXT = 0x41;
  195. // [`location`](ref:e2e.location) wrapped by
  196. // [`group-member-container`](ref:e2e.group-member-container)
  197. GROUP_LOCATION = 0x42;
  198. // [`deprecated-group-image`](ref:e2e.deprecated-group-image) wrapped by
  199. // [`group-member-container`](ref:e2e.group-member-container)
  200. GROUP_IMAGE = 0x43;
  201. // [`deprecated-audio`](ref:e2e.deprecated-audio) wrapped by
  202. // [`group-member-container`](ref:e2e.group-member-container)
  203. GROUP_AUDIO = 0x45;
  204. // [`deprecated-video`](ref:e2e.deprecated-video) wrapped by
  205. // [`group-member-container`](ref:e2e.group-member-container)
  206. GROUP_VIDEO = 0x44;
  207. // [`file`](ref:e2e.file) wrapped by
  208. // [`group-member-container`](ref:e2e.group-member-container)
  209. GROUP_FILE = 0x46;
  210. // [`poll-setup`](ref:e2e.poll-setup) wrapped by
  211. // [`group-member-container`](ref:e2e.group-member-container)
  212. GROUP_POLL_SETUP = 0x52;
  213. // [`poll-vote`](ref:e2e.poll-vote) wrapped by
  214. // [`group-member-container`](ref:e2e.group-member-container)
  215. GROUP_POLL_VOTE = 0x53;
  216. // Group message updates
  217. // ---------------------
  218. // [`delivery-receipt`](ref:e2e.delivery-receipt) wrapped by
  219. // [`group-member-container`](ref:e2e.group-member-container)
  220. GROUP_DELIVERY_RECEIPT = 0x81;
  221. // `csp-e2e.EditMessage` wrapped by
  222. // [`group-member-container`](ref:e2e.group-member-container)
  223. GROUP_EDIT_MESSAGE = 0x93;
  224. // `csp-e2e.DeleteMessage` wrapped by
  225. // [`group-member-container`](ref:e2e.group-member-container)
  226. GROUP_DELETE_MESSAGE = 0x94;
  227. // `csp-e2e.Reaction` wrapped by
  228. // [`group-member-container`](ref:e2e.group-member-container)
  229. GROUP_REACTION = 0x83;
  230. // Forward security
  231. // ----------------
  232. // `csp-e2e-fs.Envelope`
  233. FORWARD_SECURITY_ENVELOPE = 0xa0;
  234. // Push control
  235. // ------------
  236. // [`web-session-resume`](ref:e2e.web-session-resume)
  237. WEB_SESSION_RESUME = 0xfe;
  238. }