Skip to content

Commit d048e50

Browse files
author
whatsapp
committedMay 10, 2022
feat: add proto files
1 parent fb699c5 commit d048e50

5 files changed

+513
-0
lines changed
 

‎protobuf/ClientHello.proto

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package ClientHello;
2+
syntax = "proto2";
3+
4+
5+
enum UserAgentPlatform
6+
{
7+
ANDROID = 0;
8+
IOS = 1;
9+
WINDOWS_PHONE = 2;
10+
BLACKBERRY = 3;
11+
BLACKBERRYX = 4;
12+
S40 = 5;
13+
S60 = 6;
14+
PYTHON_CLIENT = 7;
15+
TIZEN = 8;
16+
ENTERPRISE = 9;
17+
SMB_ANDROID = 10;
18+
KAIOS = 11;
19+
SMB_IOS = 12;
20+
WINDOWS = 13;
21+
WEB = 14;
22+
}
23+
24+
enum ConnectType
25+
{
26+
CELLULAR_UNKNOWN = 0;
27+
WIFI_UNKNOWN = 1;
28+
CELLULAR_EDGE = 100;
29+
CELLULAR_IDEN = 101;
30+
CELLULAR_UMTS = 102;
31+
CELLULAR_EVDO = 103;
32+
CELLULAR_GPRS = 104;
33+
CELLULAR_HSDPA = 105;
34+
CELLULAR_HSUPA = 106;
35+
CELLULAR_HSPA = 107;
36+
CELLULAR_CDMA = 108;
37+
CELLULAR_1XRTT = 109;
38+
CELLULAR_EHRPD = 110;
39+
CELLULAR_LTE = 111;
40+
CELLULAR_HSPAP = 112;
41+
}
42+
43+
enum ReleaseChannel{
44+
RELEASE = 0;
45+
BETA = 1;
46+
ALPHA = 2;
47+
DEBUG = 3;
48+
}
49+
50+
message AppVersion
51+
{
52+
required uint32 primary = 1;
53+
required uint32 secondary = 2;
54+
required uint32 tertiary = 3;
55+
optional uint32 quaternary = 4;
56+
}
57+
58+
message UserAgent
59+
{
60+
optional UserAgentPlatform platform = 1;
61+
optional AppVersion app_version = 2;
62+
optional string mcc = 3;
63+
optional string mnc = 4;
64+
optional string os_version = 5;
65+
optional string manufacturer = 6;
66+
optional string device = 7;
67+
optional string os_build_number = 8;
68+
optional string phone_id = 9;
69+
optional ReleaseChannel release_channel = 10;
70+
optional string locale_language_iso_639_1 = 11;
71+
optional string locale_country_iso_3166_1_alpha_2 = 12;
72+
optional string device2 = 13;
73+
}
74+
75+
message C2S
76+
{
77+
enum ClientFeature { NONE = 0; }
78+
enum ConnectType {
79+
UNKNOWN = 0;
80+
WIFI = 1;
81+
EDGE = 100;
82+
IDEN = 101;
83+
UMTS = 102;
84+
EVDO = 103;
85+
GPRS = 104;
86+
HSDPA = 105;
87+
HSUPA = 106;
88+
HSPA = 107;
89+
CDMA = 108;
90+
ONExRTT = 109;
91+
EHRPD = 110;
92+
LTE = 111;
93+
HSPAP = 112;
94+
}
95+
enum ConnectReason {
96+
PUSH = 0;
97+
USER_ACTIVATED = 1;
98+
SCHEDULED = 2;
99+
ERROR_RECONNECT = 3;
100+
NETWORK_SWITCH = 4;
101+
PING_RECONNECT = 5;
102+
}
103+
message DnsSource {
104+
enum DnsMethod {
105+
METHOD_0 = 0;
106+
METHOD_1 = 1;
107+
METHOD_2 = 2;
108+
METHOD_3 = 3;
109+
}
110+
111+
optional DnsMethod dnsMethod = 15;
112+
optional bool appCached = 16;
113+
}
114+
enum IosAppExtension {
115+
EXT_0 = 0;
116+
EXT_1 = 1;
117+
EXT_2 = 2;
118+
}
119+
120+
message WebInfo {
121+
message WebdPayload {
122+
optional bool uses_participant_in_key = 1;
123+
optional bool supports_starred_messages = 2;
124+
optional bool supports_document_messages = 3;
125+
optional bool supports_url_messages = 4;
126+
optional bool supports_media_retry = 5;
127+
optional bool supports_e2e_image = 6;
128+
optional bool supports_e2e_video = 7;
129+
optional bool supports_e2e_audio = 8;
130+
optional bool supports_e2e_document = 9;
131+
optional string document_types = 10;
132+
}
133+
134+
optional string ref_token = 1;
135+
optional string version = 2;
136+
optional WebdPayload webd_payload = 3;
137+
}
138+
139+
message CompanionRegData{
140+
optional bytes e_regid = 1;
141+
optional bytes e_keytype = 2;
142+
optional bytes e_ident = 3;
143+
optional bytes e_skey_id = 4;
144+
optional bytes e_skey_val = 5;
145+
optional bytes e_skey_sig = 6;
146+
optional bytes build_hash = 7;
147+
optional bytes companion_props = 8;
148+
}
149+
150+
optional uint64 username = 1;
151+
optional bool passive = 3;
152+
repeated ClientFeature client_features = 4;
153+
optional UserAgent useragent = 5;
154+
optional WebInfo web_info = 6;
155+
optional string push_name = 7;
156+
optional sfixed32 session_id = 9;
157+
optional bool short_connect = 10;
158+
optional ConnectType connect_type = 12;
159+
optional ConnectReason connect_reason = 13;
160+
repeated sfixed32 shards = 14;
161+
optional DnsSource dns_source = 15;
162+
optional uint32 connect_attempt_count = 16;
163+
optional CompanionRegData reg_data = 19;
164+
optional uint32 tag23 = 23;
165+
optional uint32 tag24 = 24;
166+
optional IosAppExtension ios_app_extension = 30;
167+
}

‎protobuf/HandshakeMessage.proto

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package HandshakeMessage;
2+
syntax = "proto2";
3+
4+
5+
message ClientHello {
6+
optional bytes ephemeral = 1;
7+
optional bytes static = 2;
8+
optional bytes payload = 3;
9+
}
10+
11+
message ServerHello {
12+
optional bytes ephemeral = 1;
13+
optional bytes static = 2;
14+
optional bytes payload = 3;
15+
}
16+
17+
message ClientFinish{
18+
optional bytes static = 1;
19+
optional bytes payload = 2;
20+
}
21+
22+
message HandshakeMessage{
23+
optional ClientHello client_hello = 2;
24+
optional ServerHello server_hello = 3;
25+
optional ClientFinish client_finish = 4;
26+
}

‎protobuf/Message.proto

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
package Message;
2+
syntax = "proto2";
3+
4+
5+
message SenderKeyMessage {
6+
optional uint32 id = 1;
7+
optional uint32 iteration = 2;
8+
optional bytes ciphertext = 3;
9+
}
10+
11+
message SenderChainKey {
12+
optional uint32 iteration = 1;
13+
optional bytes seed = 2;
14+
}
15+
16+
message SenderMessageKey {
17+
optional uint32 iteration = 1;
18+
optional bytes seed = 2;
19+
}
20+
21+
message SenderSigningKey {
22+
optional bytes public = 1;
23+
optional bytes private = 2;
24+
}
25+
26+
message SenderKeyStateStructure {
27+
optional uint32 senderKeyId = 1;
28+
optional SenderChainKey senderChainKey = 2;
29+
optional SenderSigningKey senderSigningKey = 3;
30+
repeated SenderMessageKey senderMessageKeys = 4;
31+
}
32+
33+
message SenderKeyRecordStructure {
34+
repeated SenderKeyStateStructure senderKeyStates = 1;
35+
}
36+
37+
message SenderKeyDistributionMessage {
38+
optional int32 id = 1;
39+
optional int32 iteration = 2;
40+
optional bytes chainKey = 3;
41+
optional bytes signingKey = 4;
42+
}
43+
44+
message WhisperSenderKeyDistributionMessage {
45+
optional string groupId = 1;
46+
optional bytes axolotl_sender_key_distribution_message = 2;
47+
}
48+
49+
message ImageMessage {
50+
optional string url = 1;
51+
optional string mimetype = 2;
52+
optional string caption = 3;
53+
optional bytes file_sha256 = 4;
54+
optional int64 file_length = 5;
55+
optional int32 height = 6;
56+
optional int32 width = 7;
57+
optional bytes media_key = 8;
58+
optional bytes jpeg_thumbnail = 16;
59+
optional string context_info = 17;
60+
}
61+
62+
message ContactMessage {
63+
optional string display_name = 1;
64+
optional string vcard = 2;
65+
optional string context_info = 3;
66+
}
67+
68+
message LocationMessage {
69+
optional string degrees_latitude = 1;
70+
optional string degrees_longitude = 2;
71+
optional string name = 3;
72+
optional string address = 4;
73+
optional string url = 5;
74+
optional string duration = 6;
75+
optional string accuracy_in_meters = 7;
76+
optional string speed_in_mps = 8;
77+
optional string degrees_clockwise_from_magnetic_north = 9;
78+
optional string axolotl_sender_key_distribution_message = 10;
79+
optional string jpeg_thumbnail = 16;
80+
optional string context_info = 17;
81+
}
82+
83+
message ExtendedTextMessage {
84+
optional string text = 1;
85+
optional string matched_text = 2;
86+
optional string canonical_url = 4;
87+
optional string description = 5;
88+
optional string title = 6;
89+
optional string jpeg_thumbnail = 16;
90+
optional string context_info = 17;
91+
}
92+
93+
message DocumentMessage {
94+
optional string url = 1;
95+
optional string mimetype = 2;
96+
optional string title = 3;
97+
optional string file_sha256 = 4;
98+
optional string file_length = 5;
99+
optional string page_count = 6;
100+
optional string media_key = 7;
101+
optional string file_name = 8;
102+
optional string jpeg_thumbnail = 16;
103+
optional string context_info = 17;
104+
}
105+
106+
message AudioMessage {
107+
optional string url = 1;
108+
optional string mimetype = 2;
109+
optional string file_sha256 = 3;
110+
optional string file_length = 4;
111+
optional string seconds = 5;
112+
optional string ptt = 6;
113+
optional string media_key = 7;
114+
optional string context_info = 17;
115+
optional string streaming_sidecar = 18;
116+
}
117+
118+
message VideoMessage {
119+
optional string url = 1;
120+
optional string mimetype = 2;
121+
optional string file_sha256 = 3;
122+
optional string file_length = 4;
123+
optional string seconds = 5;
124+
optional string media_key = 6;
125+
optional string caption = 7;
126+
optional string gif_playback = 8;
127+
optional string height = 9;
128+
optional string width = 10;
129+
optional string jpeg_thumbnail = 16;
130+
optional string context_info = 17;
131+
optional string streaming_sidecar = 18;
132+
optional string gif_attribution = 19;
133+
}
134+
135+
message Call {
136+
optional string call_key = 1;
137+
}
138+
139+
message Chat {
140+
optional string display_name = 1;
141+
optional string id = 2;
142+
}
143+
144+
message ProtocolMessage {
145+
optional string key = 1;
146+
optional string type = 2;
147+
}
148+
149+
message ContactsArrayMessage {
150+
optional string display_name = 1;
151+
optional string contacts = 2;
152+
optional string context_info = 3;
153+
}
154+
155+
message HighlyStructuredMessage {
156+
optional string namespace = 1;
157+
optional string element_name = 2;
158+
optional string params = 3;
159+
optional string fallback_lg = 4;
160+
optional string fallback_lc = 5;
161+
}
162+
163+
message Message {
164+
optional string conversation = 1;
165+
optional WhisperSenderKeyDistributionMessage sender_key_distribution_message = 2;
166+
optional ImageMessage image_message = 3;
167+
optional ContactMessage contact_message = 4;
168+
optional LocationMessage location_message = 5;
169+
optional ExtendedTextMessage extended_text_message = 6;
170+
optional DocumentMessage document_message = 7;
171+
optional AudioMessage audio_message = 8;
172+
optional VideoMessage video_message = 9;
173+
optional Call call = 10;
174+
optional Chat chat = 11;
175+
optional ProtocolMessage protocol_message = 12;
176+
optional ContactsArrayMessage contacts_array_message = 13;
177+
optional HighlyStructuredMessage highly_structured_message = 14;
178+
}

‎protobuf/SessionStructure.proto

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
syntax = "proto2";
2+
3+
package textsecure;
4+
5+
option java_package = "org.whispersystems.libsignal.state";
6+
option java_outer_classname = "StorageProtos";
7+
8+
message SessionStructure {
9+
message Chain {
10+
optional bytes senderRatchetKey = 1;
11+
optional bytes senderRatchetKeyPrivate = 2;
12+
13+
message ChainKey {
14+
optional uint32 index = 1;
15+
optional bytes key = 2;
16+
}
17+
18+
optional ChainKey chainKey = 3;
19+
20+
message MessageKey {
21+
optional uint32 index = 1;
22+
optional bytes cipherKey = 2;
23+
optional bytes macKey = 3;
24+
optional bytes iv = 4;
25+
}
26+
27+
repeated MessageKey messageKeys = 4;
28+
}
29+
30+
message PendingKeyExchange {
31+
optional uint32 sequence = 1;
32+
optional bytes localBaseKey = 2;
33+
optional bytes localBaseKeyPrivate = 3;
34+
optional bytes localRatchetKey = 4;
35+
optional bytes localRatchetKeyPrivate = 5;
36+
optional bytes localIdentityKey = 7;
37+
optional bytes localIdentityKeyPrivate = 8;
38+
}
39+
40+
message PendingPreKey {
41+
optional uint32 preKeyId = 1;
42+
optional int32 signedPreKeyId = 3;
43+
optional bytes baseKey = 2;
44+
}
45+
46+
optional uint32 sessionVersion = 1;
47+
optional bytes localIdentityPublic = 2;
48+
optional bytes remoteIdentityPublic = 3;
49+
50+
optional bytes rootKey = 4;
51+
optional uint32 previousCounter = 5;
52+
53+
optional Chain senderChain = 6;
54+
repeated Chain receiverChains = 7;
55+
56+
optional PendingKeyExchange pendingKeyExchange = 8;
57+
optional PendingPreKey pendingPreKey = 9;
58+
59+
optional uint32 remoteRegistrationId = 10;
60+
optional uint32 localRegistrationId = 11;
61+
62+
optional bool needsRefresh = 12;
63+
optional bytes aliceBaseKey = 13;
64+
}
65+
66+
message RecordStructure {
67+
optional SessionStructure currentSession = 1;
68+
repeated SessionStructure previousSessions = 2;
69+
}
70+
71+
message PreKeyRecordStructure {
72+
optional uint32 id = 1;
73+
optional bytes publicKey = 2;
74+
optional bytes privateKey = 3;
75+
}
76+
77+
message SignedPreKeyRecordStructure {
78+
optional uint32 id = 1;
79+
optional bytes publicKey = 2;
80+
optional bytes privateKey = 3;
81+
optional bytes signature = 4;
82+
optional fixed64 timestamp = 5;
83+
}
84+
85+
message IdentityKeyPairStructure {
86+
optional bytes publicKey = 1;
87+
optional bytes privateKey = 2;
88+
}
89+
90+
message SenderKeyStateStructure {
91+
message SenderChainKey {
92+
optional uint32 iteration = 1;
93+
optional bytes seed = 2;
94+
}
95+
96+
message SenderMessageKey {
97+
optional uint32 iteration = 1;
98+
optional bytes seed = 2;
99+
}
100+
101+
message SenderSigningKey {
102+
optional bytes public = 1;
103+
optional bytes private = 2;
104+
}
105+
106+
optional uint32 senderKeyId = 1;
107+
optional SenderChainKey senderChainKey = 2;
108+
optional SenderSigningKey senderSigningKey = 3;
109+
repeated SenderMessageKey senderMessageKeys = 4;
110+
}
111+
112+
message SenderKeyRecordStructure {
113+
repeated SenderKeyStateStructure senderKeyStates = 1;
114+
}

‎protobuf/WhisperTextProtocol.proto

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package textsecure;
2+
3+
option java_package = "org.whispersystems.libsignal.protocol";
4+
option java_outer_classname = "WhisperProtos";
5+
6+
message WhisperMessage {
7+
optional bytes ephemeralKey = 1;
8+
optional uint32 counter = 2;
9+
optional uint32 previousCounter = 3;
10+
optional bytes ciphertext = 4; // PushMessageContent
11+
}
12+
13+
message PreKeyWhisperMessage {
14+
optional uint32 preKeyId = 1;
15+
optional bytes baseKey = 2;
16+
optional bytes identityKey = 3;
17+
optional bytes message = 4; // WhisperMessage
18+
optional uint32 registrationId = 5;
19+
optional uint32 signedPreKeyId = 6;
20+
}
21+
22+
message KeyExchangeMessage {
23+
optional uint32 id = 1;
24+
optional bytes baseKey = 2;
25+
optional bytes ephemeralKey = 3;
26+
optional bytes identityKey = 4;
27+
optional bytes baseKeySignature = 5;
28+
}

0 commit comments

Comments
 (0)
Please sign in to comment.