gRPCServices.proto 2.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
syntax = "proto3";

package api;

service Platform {
	rpc Register(RegisterRequest) returns (ErrorCode) {}
	rpc Auth(AuthRequest) returns (RegisteredUser) {}
	rpc Unregister(Empty) returns (ErrorCode) {}
	rpc PostContract(PostContractRequest) returns (ErrorCode) {}
	rpc JoinSignature(JoinSignatureRequest) returns (ErrorCode) {}
	rpc ReadySign(ReadySignRequest) returns (ErrorCode) {}
}

// RegisterRequest message contains the client's email adress and his
Loïck Bonniot's avatar
Loïck Bonniot committed
15
// request (ie the PEM-encoded certificate request)
16 17
message RegisterRequest {
	string email = 1;
18
	string request = 2;
19 20 21 22 23
}

// ErrorCode message contains an error code (see dffs/dfssp/api/errorCodes.go)
// and a message
message ErrorCode {
24 25 26 27 28 29 30 31 32 33 34 35 36
	enum Code {
		// SUCCESS is the error code for a successful request
		SUCCESS = 0;
		// INVARG is the error code for an invalid argument
		INVARG = 1;
		// BADAUTH is the error code for a bad authentication
		BADAUTH = 2;
		// WARNING is the error code for a success state containing a specific warning message
		WARNING = 3;
		// INTERR is the error code for an internal server error
		INTERR = -1;
	}
	Code code = 1;
37 38 39 40 41 42 43 44 45 46 47
	string message = 2;
}

// AuthRequest message contains the client's email adress and the token used
// for authentication
message AuthRequest {
	string email = 1;
	string token = 2;
}

// RegisteredUser message contains the generated client certificate
48
// (PEM-encoded)
49
message RegisteredUser {
50
	string clientCert = 1;
51 52 53 54 55 56
}

// Empty message is an empty message
message Empty {
}

57 58
// PostContractRequest message contains the contract as SHA-512 hash, its filename,
// the list of signers as an array of strings, and a comment
59
message PostContractRequest {
60
	bytes hash = 1;
61 62 63
	string filename = 2;
	repeated string signer = 3;
	string comment = 4;
64 65 66 67 68 69
}

// JoinSignatureRequest message contains the contract to join unique identifier
// and the port the client will be listening at
message JoinSignatureRequest {
	string contractUuid = 1;
70
	uint32 port = 2;
71 72 73 74 75 76
}

// ReadySignRequest contains the contract unique identitier that is ready to be signed
message ReadySignRequest {
	string contractUuid = 1;
}