safe.proto 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. syntax = "proto3";
  2. package safe;
  3. option java_package = "ch.threema.protobuf";
  4. import "common.proto";
  5. // Threema Safe
  6. // ------------
  7. //
  8. // All strings are UTF-8 encoded.
  9. // Threema Safe backup contents.
  10. message Backup {
  11. // Version of the format
  12. // References: `info.version`
  13. uint32 version = 1;
  14. // Metadata about the device which created the backup
  15. // References: `info.device`
  16. string device = 2;
  17. // The private key associated with the Threema ID
  18. // References: `user.privatekey`
  19. bytes private_key = 3;
  20. // The user's profile
  21. // Note: The data MUST be inlined!
  22. UserProfile user_profile = 4;
  23. // Contacts
  24. // References: `contacts[]`
  25. repeated Contact contacts = 5;
  26. // Groups
  27. // References: `groups[]`
  28. repeated Group groups = 6;
  29. // Distribution lists
  30. // References: `distributionlists[]`
  31. repeated DistributionList distribution_lists = 7;
  32. // App settings
  33. // References: `settings`
  34. Settings settings = 8;
  35. }
  36. // The user's profile.
  37. message UserProfile {
  38. // Nickname
  39. // References: `user.nickname`
  40. string nickname = 1;
  41. // Profile image
  42. // References: `user.profilePic`
  43. common.Image profile_image = 2;
  44. // Profile image share policy
  45. // References: `user.profilePicRelease[]`
  46. enum ProfileImageSharePolicy {
  47. // Don't share
  48. NOBODY = 0;
  49. // Share with everyone
  50. EVERYONE = 1;
  51. // Share with a limited amount of contacts explicitly listed
  52. ALLOW_LIST = 2;
  53. }
  54. ProfileImageSharePolicy profile_image_share_policy = 3;
  55. // Contact IDs the profile image may be shared with. Should only be filled
  56. // when the `ProfileImageSharePolicy` is `ALLOW_LIST`.
  57. // References: `user.profilePicRelease[]`
  58. repeated string profile_image_share_with = 4;
  59. // External entities linked with the identity
  60. // References: `user.links[]`
  61. repeated IdentityLink identity_links = 5;
  62. }
  63. // Threema contact.
  64. message Contact {
  65. // Threema ID of the contact
  66. // References: `contacts[].identity`
  67. string identity = 1;
  68. // Public key of the contact
  69. // References: `contacts[].publickey`
  70. bytes public_key = 2;
  71. // Unix-ish timestamp in milliseconds when the contact has been created
  72. // (added) locally.
  73. // References: `contacts[].createdAt`
  74. uint64 created_at = 3;
  75. // Verification level of the contact
  76. // References: `contacts[].verification`
  77. enum VerificationLevel {
  78. // Unverified, public key has been obtained from the server
  79. UNVERIFIED = 0;
  80. // Verified with one of the account links via the server, or the contact
  81. // has been obtained via the Work API.
  82. SERVER_VERIFIED = 1;
  83. // Verified, public key has been obtained via a secure channel
  84. FULLY_VERIFIED = 2;
  85. }
  86. VerificationLevel verification_level = 4;
  87. // Identity type of the contact
  88. // References: `contacts[].workVerified`
  89. enum IdentityType {
  90. // Regular contact (uses the regular Threema app)
  91. REGULAR = 0;
  92. // Work contact (uses the Threema work app)
  93. WORK = 1;
  94. }
  95. IdentityType identity_type = 5;
  96. // Display policy for the contact
  97. // References: `contacts[].hidden`
  98. enum DisplayPolicy {
  99. // Show contact
  100. SHOW = 0;
  101. // Hide contact (e.g. group contact not explicitly added)
  102. HIDE = 1;
  103. }
  104. DisplayPolicy display_policy = 6;
  105. // Conversation category of the contact
  106. // References: `contacts[].private`
  107. ConversationCategory conversation_category = 7;
  108. // Conversation visbility of the contact
  109. ConversationVisibility conversation_visibility = 8;
  110. // First name of the contact
  111. // References: `contacts[].firstname`
  112. oneof first_name { string first_name_value = 9; }
  113. // Last name of the contact
  114. // References: `contacts[].lastname`
  115. oneof last_name { string last_name_value = 10; }
  116. // Nickname of the contact (without `~` prefix)
  117. // References: `contacts[].nickname`
  118. oneof nickname { string nickname_value = 11; }
  119. // Profile image as received from the contact
  120. common.Image profile_image = 12;
  121. // Custom profile image set by the user
  122. common.Image custom_profile_image = 13;
  123. }
  124. // Threema contacts associated to a group.
  125. message Group {
  126. // Unique group identity
  127. // References: `groups[].id` and `groups[].creator`
  128. common.GroupIdentity group_identity = 1;
  129. // Name of the group
  130. // References: `groups[].groupname`
  131. string name = 2;
  132. // Unix-ish timestamp in milliseconds when the group has been created locally
  133. // References: `groups[].createdAt`
  134. uint64 created_at = 3;
  135. // Conversation category of the group
  136. // References: `groups[].private`
  137. ConversationCategory conversation_category = 4;
  138. // Conversation visbility of the group
  139. ConversationVisibility conversation_visibility = 5;
  140. // The user's state within the group
  141. // References: `groups[].deleted`
  142. enum UserState {
  143. // The user is a member (or an admin) of the group
  144. MEMBER = 0;
  145. // The user has been kicked from the group
  146. KICKED = 1;
  147. // The user left the group
  148. LEFT = 2;
  149. }
  150. UserState user_state = 6;
  151. // Group's profile image as received from the group's administrator
  152. common.Image profile_image = 7;
  153. // Group members (**NOT** including the user itself)
  154. // References: `groups[].members`
  155. repeated string member_identities = 8;
  156. }
  157. // Threema contacts associated to a distribution list.
  158. message DistributionList {
  159. // Unique ID of the distribution list
  160. fixed64 distribution_list_id = 1;
  161. // Name of the distribution list
  162. // References: `distributionlists[].name`
  163. string name = 2;
  164. // Unix-ish timestamp in milliseconds when the group has been created
  165. // References: `distributionlists[].createdAt`
  166. uint64 created_at = 3;
  167. // Conversation category of the distribution list
  168. // References: `distributionlists[].private`
  169. ConversationCategory conversation_category = 4;
  170. // Conversation visbility of the distribution list
  171. ConversationVisibility conversation_visibility = 5;
  172. // Distribution list members
  173. // References: `distributionlists[].members`
  174. repeated string member_identities = 6;
  175. }
  176. // App settings
  177. message Settings {
  178. // Contact synchronisation policy
  179. // References: `settings.syncContacts`
  180. enum ContactSyncPolicy {
  181. // Not synced
  182. NOT_SYNCED = 0;
  183. // Synced
  184. SYNC = 1;
  185. }
  186. ContactSyncPolicy contact_sync_policy = 1;
  187. // Unknown contacts policy
  188. // References: `settings.blockUnknown`
  189. enum UnknownContactPolicy {
  190. // Allowed to contact the user
  191. ALLOW_UNKNOWN = 0;
  192. // Will be blocked by the user
  193. BLOCK_UNKNOWN = 1;
  194. }
  195. UnknownContactPolicy unknown_contact_policy = 2;
  196. // Read message policy (when an unread message has been read)
  197. // References: `settings.readReceipts`
  198. enum ReadMessagePolicy {
  199. // Send *read* receipt when an unread message has been read
  200. SEND_READ_RECEIPT = 0;
  201. // Don't send *read* receipts
  202. IGNORE_READ = 1;
  203. }
  204. ReadMessagePolicy read_message_policy = 3;
  205. // Compose message policy
  206. // References: `settings.sendTyping`
  207. enum ComposeMessagePolicy {
  208. // Send *typing* indicator when a message is being composed
  209. SEND_TYPING_INDICATOR = 0;
  210. // Don't send *typing* indicators
  211. IGNORE_COMPOSE = 1;
  212. }
  213. ComposeMessagePolicy compose_message_policy = 4;
  214. // Threema Call policy
  215. // References: `settings.threemaCalls`
  216. enum CallPolicy {
  217. // Allow creating/receiving Threema Calls
  218. ALLOW_CALL = 0;
  219. // Denied from creating/receiving any Threema Calls
  220. DENY_CALL = 1;
  221. }
  222. CallPolicy call_policy = 5;
  223. // Threema Call connection policy
  224. // References: `settings.relayThreemaCalls`
  225. enum CallConnectionPolicy {
  226. // Allow direct (peer-to-peer) connections for Threema Calls
  227. ALLOW_DIRECT = 0;
  228. // Require relayed connections for Threema Calls
  229. REQUIRE_RELAY = 1;
  230. }
  231. CallConnectionPolicy call_connection_polity = 6;
  232. // Screenshot policy
  233. // References: `settings.disableScreenshots`
  234. enum ScreenshotPolicy {
  235. // Allow taking screenshots
  236. ALLOW_SCREENSHOT = 0;
  237. // Deny taking screenshots, if possible
  238. DENY_SCREENSHOT = 1;
  239. }
  240. ScreenshotPolicy screenshot_policy = 7;
  241. // Keyboard data collection policy (e.g. for personalised suggestions)
  242. // References: `settings.incognitoKeyboard`
  243. enum KeyboardDataCollectionPolicy {
  244. // Allow keyboard input data to be collected
  245. ALLOW_DATA_COLLECTION = 0;
  246. // Deny collecting of keyboard input data
  247. DENY_DATA_COLLECTION = 1;
  248. }
  249. KeyboardDataCollectionPolicy keyboard_data_collection_policy = 8;
  250. // List of Threema IDs whose messages are blocked
  251. // References: `settings.blockedContacts[]`
  252. repeated string blocked_identities = 9;
  253. // Threema IDs to be excluded when syncing
  254. // References: `settings.syncExcludedIds[]`
  255. repeated string exclude_from_sync_identities = 10;
  256. // List of recently used emojis, where the most recently used Emoji comes
  257. // first.
  258. // References: `settings.recentEmojis[]`
  259. repeated string recent_emojis = 11;
  260. }
  261. // Threema ID link.
  262. message IdentityLink {
  263. // Identity link type
  264. // References: `user.links[].type`, `user.links[].value`
  265. oneof type {
  266. // Linked with a verified telephone number (E.164 format without leading
  267. // `+`)
  268. string phone_number = 1;
  269. // Linked with a verified email address
  270. string email = 2;
  271. }
  272. // Identity link description
  273. // References: `user.links[].name`
  274. string description = 3;
  275. }
  276. // Visibility of a conversation.
  277. enum ConversationVisibility {
  278. // Appears in the list of conversations
  279. SHOW = 0;
  280. // Appears in the archived list of conversations
  281. ARCHIVE = 1;
  282. }
  283. // Category of a conversation.
  284. enum ConversationCategory {
  285. // No specific (default) category
  286. DEFAULT = 0;
  287. // Protected conversation (*private chat*)
  288. PROTECTED = 1;
  289. }