/
bertyprotocol.proto
302 lines (199 loc) · 10.9 KB
/
bertyprotocol.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
syntax = "proto3";
package berty.protocol;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "berty.tech/go/pkg/bertyprotocol";
option (gogoproto.benchgen_all) = false;
option (gogoproto.compare_all) = false;
option (gogoproto.description_all) = false;
option (gogoproto.enum_stringer_all) = false;
option (gogoproto.enumdecl_all) = true;
option (gogoproto.equal_all) = false;
option (gogoproto.face_all) = false;
option (gogoproto.gogoproto_import) = false;
option (gogoproto.goproto_enum_prefix_all) = true;
option (gogoproto.goproto_enum_stringer_all) = false;
option (gogoproto.goproto_extensions_map_all) = false;
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.goproto_registration) = false;
//option (gogoproto.goproto_sizecache_all) = false;
option (gogoproto.goproto_stringer_all) = false;
//option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.gostring_all) = false;
option (gogoproto.marshaler_all) = false;
option (gogoproto.messagename_all) = false;
option (gogoproto.onlyone_all) = false;
option (gogoproto.populate_all) = false;
option (gogoproto.protosizer_all) = false;
option (gogoproto.sizer_all) = false;
option (gogoproto.stable_marshaler_all) = false;
option (gogoproto.stringer_all) = true;
option (gogoproto.testgen_all) = false;
option (gogoproto.typedecl_all) = true;
option (gogoproto.unmarshaler_all) = false;
option (gogoproto.unsafe_marshaler_all) = false;
option (gogoproto.unsafe_unmarshaler_all) = false;
option (gogoproto.verbose_equal_all) = false;
// Instance is the top-level API to manage an instance of the Berty Protocol.
// Each Berty Protocol Instance is considered as a Berty device and is associated with a Berty user.
service Instance {
// InstanceExportData exports instance data
rpc InstanceExportData (InstanceExportDataRequest) returns (InstanceExportDataReply) { option (google.api.http) = {post: "/instance/export-data"}; };
// InstanceGetConfiguration gets current configuration of this protocol instance
rpc InstanceGetConfiguration (InstanceGetConfigurationRequest) returns (InstanceGetConfigurationReply);
//// AccountManager
// An account is associated with a Berty user
// AccountGetConfiguration get current account global configuration (shared between all devices linked to current account)
rpc AccountGetConfiguration (AccountGetConfigurationRequest) returns (AccountGetConfigurationReply);
// AccountGetInformation get current account global information (shared between all devices linked to current account)
rpc AccountGetInformation (AccountGetInformationRequest) returns (AccountGetInformationReply);
// AccountLinkNewDevice link a new device to this account
rpc AccountLinkNewDevice (AccountLinkNewDeviceRequest) returns (AccountLinkNewDeviceReply);
// AccountDisableIncomingContactRequest disable incoming contact request, under the hood, this will make you undiscoverable for new contact
rpc AccountDisableIncomingContactRequest (AccountDisableIncomingContactRequestRequest) returns (AccountDisableIncomingContactRequestReply);
// AccountEnableIncomingContactRequest enable incoming contact request
rpc AccountEnableIncomingContactRequest (AccountEnableIncomingContactRequestRequest) returns (AccountEnableIncomingContactRequestReply);
// AccountResetIncomingContactRequestLink invalidate the request link
rpc AccountResetIncomingContactRequestLink (AccountResetIncomingContactRequestLinkRequest) returns (AccountResetIncomingContactRequestLinkReply);
//// Event Manager
// Event Stream is a channel on which all the events of the protocol are
// published (contact request, new incoming message, etc...).
// EventSubscribe listen for real time protocol events
rpc EventSubscribe (EventSubscribeRequest) returns (stream EventStream);
//// ContactRequestManager
// Two accounts can be considered as contacts if a contact request from one has been accepted by the other and secrets
// for further communication have been exchanged.
// ContactRequestAccept accepts the given contact request, the requester signature is included so any of their device
// can accept the contact request
rpc ContactRequestAccept (ContactRequestAcceptRequest) returns (ContactRequestAcceptReply);
// ContactRequestDiscard discards the given contact request
rpc ContactRequestDiscard (ContactRequestDiscardRequest) returns (ContactRequestDiscardReply);
// ContactRequestListIncoming lists incoming contact request sent to your account
rpc ContactRequestListIncoming (ContactRequestListIncomingRequest) returns (stream ContactRequestListIncomingReply);
// ContactRequestListIncoming lists pending contact request sent by your account
rpc ContactRequestListOutgoing (ContactRequestListOutgoingRequest) returns (stream ContactRequestListOutgoingReply);
// ContactRequestSend sends a contact request to the given contact
rpc ContactRequestSend (ContactRequestSendRequest) returns (ContactRequestSendReply);
//// Contact Manager
// ContactGet gets contact's information
rpc ContactGet (ContactGetRequest) returns (ContactGetReply);
// ContactList lists contacts of this account
rpc ContactList (ContactListRequest) returns (stream ContactListReply);
// ContactList removes the given contact
rpc ContactRemove (ContactRemoveRequest) returns (ContactRemoveReply);
//// Stream Manager
// StreamManagerRequestToContact requests a stream to a specific contact
rpc StreamManagerRequestToContact (StreamManagerRequestToContactRequest) returns (StreamManagerRequestToContactReply);
// StreamManagerAccept accepts a stream request, and create a stream with the
// contact that sent you this request
rpc StreamManagerAccept (stream StreamManagerAcceptRequest) returns (stream StreamManagerAcceptReply);
//// Group Manager
// A group is a common communication channel shared by a set of devices. It can be devices from different accounts. In
// the context of the Berty messaging application, groups are used for all conversations between contacts, whether
// they include two or more contacts.
// GroupCreate initiate a group locally
rpc GroupCreate (GroupCreateRequest) returns (GroupCreateReply);
// GroupGenerateInviteLink generates an invitation link used to send the invitation to
// the other group members
rpc GroupGenerateInviteLink (GroupGenerateInviteLinkRequest) returns (GroupGenerateInviteLinkReply);
// GroupLeave leaves a group
rpc GroupLeave (GroupLeaveRequest) returns (GroupLeaveReply);
// GroupList lists all group for this account
rpc GroupList (GroupListRequest) returns (stream GroupListReply);
/// Group Message Manager
// GroupMessageCreate creates a new message for the group, and send the invitation to
// the other group members.
rpc GroupMessageCreate (GroupMessageCreateRequest) returns (GroupMessageCreateReply);
// GroupMessageList lists messages from this group
rpc GroupMessageList (GroupMessageListRequest) returns (stream GroupMessageListReply);
// GroupPubSubTopic return a stream used to publish volatile updates to other group members
// on a specific topic
rpc GroupPubSubTopicInit (stream GroupPubSubTopicInitRequest) returns (GroupPubSubTopicInitReply);
// GroupPubSubTopicSubscribe subscribes to a topic to receive volatile message from it
rpc GroupPubSubTopicSubscribe (GroupPubSubTopicSubscribeRequest) returns (stream GroupPubSubTopicSubscribeReply);
//// Group Invitation Manager
// New members will receive a payload similar to the one received on group init. Existing members will receive the
// list of the newly added members and the required secrets to open their messages.
// GroupInvitationAccept accepts an invation to join a group
rpc GroupInvitationAccept (GroupInvitationAcceptRequest) returns (GroupInvitationAcceptReply);
// GroupInvitationCreate creates an invitation, that can be sent to join this group
rpc GroupInvitationCreate (GroupInvitationCreateRequest) returns (GroupInvitationCreateReply);
// GroupInvitationDiscard discards an invtation sent to you to join a group
rpc GroupInvitationDiscard (GroupInvitationDiscardRequest) returns (GroupInvitationDiscardReply);
// GroupInvitationList lists pending invitation to this group
rpc GroupInvitationList (GroupInvitationListRequest) returns (stream GroupInvitationListReply);
}
// Instance Manager
message InstanceExportDataRequest {}
message InstanceExportDataReply {}
message InstanceGetConfigurationRequest {}
message InstanceGetConfigurationReply {}
// AccountManager
message AccountGetConfigurationRequest {}
message AccountGetConfigurationReply {}
message AccountGetInformationRequest {}
message AccountGetInformationReply {}
message AccountLinkNewDeviceRequest {}
message AccountLinkNewDeviceReply {}
message AccountDisableIncomingContactRequestRequest {}
message AccountDisableIncomingContactRequestReply {}
message AccountEnableIncomingContactRequestRequest {}
message AccountEnableIncomingContactRequestReply {}
message AccountResetIncomingContactRequestLinkRequest {}
message AccountResetIncomingContactRequestLinkReply {}
// EventManager
message EventSubscribeRequest {}
message EventStream {}
// ContactRequestManager
message ContactRequestAcceptRequest {}
message ContactRequestAcceptReply {}
message ContactRequestDiscardRequest {}
message ContactRequestDiscardReply {}
message ContactRequestListIncomingRequest {};
message ContactRequestListIncomingReply {};
message ContactRequestListOutgoingRequest {};
message ContactRequestListOutgoingReply {};
message ContactRequestSendRequest {};
message ContactRequestSendReply {};
// ContactManager
message ContactGetRequest {}
message ContactGetReply {}
message ContactRemoveRequest {}
message ContactRemoveReply {}
message ContactListRequest {};
message ContactListReply {};
// Stream
message StreamManagerRequestToContactRequest {}
message StreamManagerRequestToContactReply {}
message StreamManagerAcceptRequest {}
message StreamManagerAcceptReply {}
// Group
message GroupCreateRequest {};
message GroupCreateReply {};
message GroupGenerateInviteLinkRequest {};
message GroupGenerateInviteLinkReply {};
message GroupLeaveRequest {};
message GroupLeaveReply {};
message GroupListRequest {};
message GroupListReply {};
// Group Message
message GroupMessageCreateRequest {};
message GroupMessageCreateReply {};
message GroupMessageListRequest {};
message GroupMessageListReply {};
// Group PubSub
message GroupPubSubTopicInitRequest {};
message GroupPubSubTopicInitReply {};
message GroupPubSubTopicSubscribeRequest {};
message GroupPubSubTopicSubscribeReply {};
// Group Invitation
message GroupInvitationAcceptRequest {};
message GroupInvitationAcceptReply {};
message GroupInvitationCreateRequest {};
message GroupInvitationCreateReply {};
message GroupInvitationDiscardRequest {};
message GroupInvitationDiscardReply {};
message GroupInvitationListRequest {};
message GroupInvitationListReply {};