This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontracts.proto
100 lines (80 loc) · 2.96 KB
/
contracts.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
syntax = "proto3";
package wirepact.contracts;
// Empty object used to return empty response
// We don't need external google apis for one object.
message Empty {}
// Contract participant. A participant in the contract shares
// its public key with the contract. All participants can then
// communicate via mTLS with each other.
message Participant {
// Name of the participant
string name = 1;
// Public key of the certificate. PEM encoded.
bytes public_key = 2;
// SHA-256 hash of the public key. Read Only Field. Used for
// searching participants.
string hash = 3;
}
// Contract between multiple participants in the WirePact network.
// A participant can have multiple contracts. Contracts allow
// mTLS connections between all participants.
message Contract {
// The ID of the contract, this is a hash of all participants
// public keys.
string id = 1;
// List of participants in the contract.
repeated Participant participants = 2;
}
// Service for managing contracts. Allows creation and deletion
// of contracts as well as "listing" with query options.
// Note that all calls are not authorized.
service ContractsService {
// List all contracts available in the repository.
rpc List(ListRequest) returns (ListResponse);
// Fetch a specific contract from the repository.
rpc Get(GetRequest) returns (Contract);
// Create a new contract between multiple parties.
rpc Create(CreateRequest) returns (Contract);
// Delete a specific contract.
rpc Delete(DeleteRequest) returns (Empty);
// Create a certificate for a participant that contains all public
// keys of all contracts that the participant is involved in.
rpc GetCertificates(GetCertificatesRequest) returns (GetCertificatesResponse);
}
// Empty request object. In the future, this object may support filtering
// the contracts.
message ListRequest {}
message ListResponse {
// List of contracts in the repository.
repeated Contract contracts = 1;
}
message GetRequest {
// The ID of the contract.
string id = 1;
}
message CreateRequest {
// Map of participants. Maps the name of a participant
// to its public certificate key.
map<string, bytes> participants = 1;
}
message DeleteRequest {
// ID of the contract to delete.
string id = 1;
}
message GetCertificatesRequest {
// Identifier of the participant. Can be the public key of the certificate
// or the certificate digest (fingerprint, SHA-256 hash).
oneof participant_identifier {
// Certificate public key of the participant.
bytes public_key = 1;
// The certificate digest (SHA-256 hash) of the participant.
string hash = 2;
}
}
message GetCertificatesResponse {
// PEM encoded certificates (public keys) of all participants
// that the given public key is involved in.
// Note that the certificate of the "requested participant"
// is not included.
repeated bytes certificates = 1;
}