This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathchaincode_owner.proto
148 lines (128 loc) · 4.06 KB
/
chaincode_owner.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
// Chaincode owner service
syntax = "proto3";
option go_package = "github.com/s7techlab/cckit/extensions/owner";
package extensions.owner;
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "mwitkow/go-proto-validators/validator.proto";
// ChaincodeOwnerService allows to store information about chaincode "owners" in chaincode state
service ChaincodeOwnerService {
// Checks tx creator is owner
rpc GetOwnerByTxCreator (google.protobuf.Empty) returns (ChaincodeOwner) {
option (google.api.http) = {
get: "/chaincode/owners/whoami"
};
}
// Get owners list
rpc ListOwners (google.protobuf.Empty) returns (ChaincodeOwners) {
option (google.api.http) = {
get: "/chaincode/owners"
};
}
// Get owner by msp_id and certificate subject
rpc GetOwner (OwnerId) returns (ChaincodeOwner) {
option (google.api.http) = {
get: "/chaincode/owners/{msp_id}/{subject}"
};
}
// Register new chaincode owner, method can be call by current owner or if no owner exists
// If chaincode owner with same MspID, certificate subject and issuer exists - throws error
rpc CreateOwner (CreateOwnerRequest) returns (ChaincodeOwner) {
option (google.api.http) = {
post: "/chaincode/owners"
body: "*"
};
}
// Register tx creator as chaincode owner
rpc CreateOwnerTxCreator (google.protobuf.Empty) returns (ChaincodeOwner) {
option (google.api.http) = {
post: "/chaincode/owners/txcreator"
body: "*"
};
}
// Update chaincode owner. Msp id and certificate subject must be equal to current owner certificate
rpc UpdateOwner (UpdateOwnerRequest) returns (ChaincodeOwner) {
option (google.api.http) = {
put: "/chaincode/owners"
body: "*"
};
}
// Delete owner
rpc DeleteOwner (OwnerId) returns (ChaincodeOwner) {
option (google.api.http) = {
delete: "/chaincode/owners/{msp_id}/{subject}"
};
}
}
// List: Chaincode owners
message ChaincodeOwners {
repeated ChaincodeOwner items = 1;
}
// State: information stored in chaincode state about chaincode owner
message ChaincodeOwner {
// Msp Id
string msp_id = 1;
// certificate subject
string subject = 2;
// certificate issuer
string issuer = 3;
// cert valid not after
google.protobuf.Timestamp expires_at = 4;
// Certificate
bytes cert = 5;
// Creator identity info
string updated_by_msp_id = 6;
// Certificate
bytes updated_by_cert = 7;
// Updated at
google.protobuf.Timestamp updated_at = 8;
}
// Request: register owner
message CreateOwnerRequest {
// Msp Id
string msp_id = 1 [(validator.field) = {string_not_empty: true}];
// Certificate
bytes cert = 2 [(validator.field) = {length_gt: 0}];
}
// Request: update owner certificate
message UpdateOwnerRequest {
// Msp Id
string msp_id = 1 [(validator.field) = {string_not_empty: true}];
// Current certificate
bytes cert = 2 [(validator.field) = {length_gt: 0}];
}
// Id: owner identifier
message OwnerId {
// Msp Id
string msp_id = 1 [(validator.field) = {string_not_empty: true}];
// Certificate subject
string subject = 2 [(validator.field) = {string_not_empty: true}];
}
// Event: new chaincode owner registered
message ChaincodeOwnerCreated {
// Msp Id
string msp_id = 1;
// certificate subject
string subject = 2;
// certificate issuer
string issuer = 3;
// cert valid not after
google.protobuf.Timestamp expires_at = 4;
}
// Event: new chaincode owner registered
message ChaincodeOwnerUpdated {
// Msp Id
string msp_id = 1;
// certificate subject
string subject = 2;
// cert valid not after
google.protobuf.Timestamp expires_at = 3;
}
// Event: chaincode owner deleted`
message ChaincodeOwnerDeleted {
// Msp Id
string msp_id = 1;
// certificate subject
string subject = 2;
}