forked from hyperledger/fabric-private-chaincode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtl_session.proto
96 lines (78 loc) · 2.49 KB
/
tl_session.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
// Copyright IBM Corp. All Rights Reserved.
// Copyright 2020 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
import "google/protobuf/any.proto";
package tl_session;
option go_package = "github.com/hyperledger/fabric-private-chaincode/internal/protos/tl_session";
message SessionSetupInitRequest {
string channel_id = 1;
string chaincode_id = 2;
string enclave_id = 3;
}
message SessionSetupInitResponse {
uint64 session_id = 1;
// serialized struct sgx_dh_msg1_t
bytes msg1 = 2;
}
message SessionSetupCompleteRequest {
uint64 session_id = 1;
// serialized struct sgx_dh_msg2_t
bytes msg2 = 2;
}
message SessionSetupCompleteResponse {
uint64 session_id = 1;
// serialized struct sgx_dh_msg2_t
bytes msg3 = 2;
string channel_id = 3;
bytes channel_hash = 4;
string chaincode_id = 5;
string enclave_id = 6;
}
message SessionCloseRequest {
uint64 session_id = 1;
}
message SessionCloseResponse {
uint64 session_id = 1;
}
message SessionTXRequest {
uint64 session_id = 1;
bytes nonce = 2;
bytes request = 3;
}
message SessionTXResponse {
uint64 session_id = 1;
// should be same as in request: somewhat redundant but makes processing of MAC easier/more uniform.
bytes nonce = 2;
bytes respoonse = 3;
}
message SessionError {
uint64 session_id = 1;
int32 error_code = 2;
string error_msg = 3;
}
message SessionMsgPayload {
oneof payload {
SessionSetupInitRequest stp_int_req = 1;
SessionSetupInitResponse stp_int_rsp = 2;
SessionSetupCompleteRequest stp_cmp_req = 3;
SessionSetupCompleteResponse stp_cmp_rsp = 4;
SessionCloseRequest cls_req = 5;
SessionCloseResponse cls_rsp = 6;
SessionTXRequest tx_req = 7;
SessionTXResponse tx_rsp = 8;
SessionError error = 9;
}
}
message SessionMsg {
google.protobuf.Any serialized_payload = 1; // This should be a serialization of SessionMsgPayload
bytes mac = 2;
// Notes:
// - MAC is over serialized_payload, unless payload is in set
// { SessionSetupInitRequest, SessionSetupInitResponse, SessionSetupCompleteRequest, SessionError }
// in which case it is undefined/ignored
// - we use ANY rather than directly including the oneof record so there is no need to re-serialize
// during the verification of the MAC which is somewhat problematic in protobuf as it doesn't have
// a unique encoding format across libraries and versions
}