-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.proto
61 lines (54 loc) · 1.47 KB
/
message.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
syntax = "proto3";
message MessageWrapper {
// 128-bit initialization vector for the AES-256-CBC algorithm. Can be
// an empty string, in this case we assume that the message is not
// encrypted.
bytes aes_init_vector = 1;
// Possibly encrypted binary representation of the Message proto.
bytes message = 2;
}
message Message {
oneof payload {
DataOperation data_operation = 1;
Info info = 2;
SessionKey session_key = 3;
RsaPublicKey rsa_public_key = 4;
}
}
message DataOperation {
enum Type {
GET = 0;
UPDATE = 1;
DELETE = 2;
}
// Type of the operation. Set by the client, not set by the server.
Type type = 1;
bytes key = 2;
bytes content = 3;
// Initialization vector used to encrypt the content of the message. The
// client's secret key, which is not known by the server, is used as an
// encryption key in this case. Necessary for client to decrypt the content
// after receiving it from the server (the client doesn't save this
// initialization vectors).
bytes content_encryption_init_vector = 4;
}
message Info {
enum Status {
OK = 0;
DATA_NOT_FOUND_ERROR = 1;
NO_VALID_SESSION_KEY_ERROR = 2;
NO_VALID_RSA_PUBLIC_KEY_ERROR = 3;
MESSAGE_CORRUPTED_ERROR = 4;
UNEXPECTED_MESSAGE_ERROR = 5;
INTERNAL_SERVER_ERROR = 6;
}
Status status = 1;
string description = 2;
}
message SessionKey {
bytes encryption_key = 1;
int64 expiration_time = 3;
}
message RsaPublicKey {
bytes key = 1;
}