-
Notifications
You must be signed in to change notification settings - Fork 4
/
messages.proto
217 lines (185 loc) · 4.87 KB
/
messages.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
syntax = "proto2";
option java_package = "com.waz.model";
message GenericMessage {
required string message_id = 1; // client generated random id, preferably UUID
oneof content {
Text text = 2;
ImageAsset image = 3;
Knock knock = 4;
LastRead lastRead = 6;
Cleared cleared = 7;
External external = 8;
ClientAction clientAction = 9;
Calling calling = 10;
Asset asset = 11;
MessageHide hidden = 12;
Location location = 13;
MessageDelete deleted = 14;
MessageEdit edited = 15;
Confirmation confirmation = 16;
Reaction reaction = 17;
Ephemeral ephemeral = 18;
}
}
message Ephemeral {
required int64 expire_after_millis = 1;
oneof content {
Text text = 2;
ImageAsset image = 3;
Knock knock = 4;
Asset asset = 5;
Location location = 6;
}
}
message Text {
required string content = 1;
repeated Mention mention = 2;
repeated LinkPreview link_preview = 3;
}
message Knock {
required bool hot_knock = 1 [default = false];
}
message LinkPreview {
required string url = 1;
required int32 url_offset = 2; // url offset from beginning of text message
oneof preview {
Article article = 3; // deprecated - use meta_data
}
optional string permanent_url = 5;
optional string title = 6;
optional string summary = 7;
optional Asset image = 8;
oneof meta_data {
Tweet tweet = 9;
}
}
message Tweet {
optional string author = 1;
optional string username = 2;
}
// deprecated - use the additional fields in LinkPreview
message Article {
required string permanent_url = 1;
optional string title = 2;
optional string summary = 3;
optional Asset image = 4;
}
message Mention {
required string user_id = 1;
required string user_name = 2;
}
message LastRead {
required string conversation_id = 1;
required int64 last_read_timestamp = 2;
}
message Cleared {
required string conversation_id = 1;
required int64 cleared_timestamp = 2;
}
message MessageHide {
required string conversation_id = 1;
required string message_id = 2;
}
message MessageDelete {
required string message_id = 1;
}
message MessageEdit {
required string replacing_message_id = 1;
oneof content {
Text text = 2;
}
}
message Confirmation {
enum Type {
DELIVERED = 0;
READ = 1;
}
required string message_id = 1;
required Type type = 2;
}
message Location {
required float longitude = 1;
required float latitude = 2;
optional string name = 3; // location description/name
optional int32 zoom = 4; // google maps zoom level (check maps api documentation)
}
message ImageAsset {
required string tag = 1;
required int32 width = 2;
required int32 height = 3;
required int32 original_width = 4;
required int32 original_height = 5;
required string mime_type = 6;
required int32 size = 7;
optional bytes otr_key = 8;
optional bytes mac_key = 9; // deprecated - use sha256
optional bytes mac = 10; // deprecated - use sha256
optional bytes sha256 = 11; // sha256 of ciphertext
}
message Asset {
message Original {
required string mime_type = 1;
required uint64 size = 2;
optional string name = 3;
oneof meta_data {
ImageMetaData image = 4;
VideoMetaData video = 5;
AudioMetaData audio = 6;
}
}
message Preview {
required string mime_type = 1;
required uint64 size = 2;
optional RemoteData remote = 3;
oneof meta_data {
ImageMetaData image = 4;
}
}
message ImageMetaData {
required int32 width = 1;
required int32 height = 2;
optional string tag = 3;
}
message VideoMetaData {
optional int32 width = 1;
optional int32 height = 2;
optional uint64 duration_in_millis = 3;
}
message AudioMetaData {
optional uint64 duration_in_millis = 1;
optional bytes normalized_loudness = 3; // each byte represent one loudness value as a byte (char) value.
// e.g. a 100-bytes field here represents 100 loudness values.
// Values are in chronological order and range from 0 to 255.
}
enum NotUploaded {
CANCELLED = 0;
FAILED = 1;
}
message RemoteData {
required bytes otr_key = 1;
required bytes sha256 = 2;
optional string asset_id = 3; //key
optional string asset_token = 5;
}
optional Original original = 1;
oneof status {
NotUploaded not_uploaded = 3;
RemoteData uploaded = 4;
}
optional Preview preview = 5;
}
// Actual message is encrypted with AES and sent as additional data
message External {
required bytes otr_key = 1;
optional bytes sha256 = 2; // sha256 of ciphertext
}
message Reaction {
optional string emoji = 1; // some emoji reaction or the empty string to remove previous reaction(s)
required string message_id = 2;
}
enum ClientAction {
RESET_SESSION = 0;
}
message Calling {
required string content = 1;
}