// Copyright 2018-2020 Cargill Incorporated
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
// The enumerated types of authorization messages.
enum AuthorizationMessageType {
UNSET_AUTHORIZATION_MESSAGE_TYPE = 0;
// Begin a Connection.
CONNECT_REQUEST = 1;
CONNECT_RESPONSE = 2;
// Authorize a peer.
AUTHORIZE = 3;
// Authorization failure.
AUTHORIZATION_ERROR = 4;
// Trust.
TRUST_REQUEST = 10;
}
// The authorization message envelope.
message AuthorizationMessage {
// The type of message.
AuthorizationMessageType message_type = 1;
// the payload.
bytes payload = 2;
}
// A connection request message.
//
// This message provides information from the incoming connection.
message ConnectRequest {
enum HandshakeMode {
UNSET_HANDSHAKE_MODE = 0;
UNIDIRECTIONAL = 1;
BIDIRECTIONAL = 2;
}
HandshakeMode handshake_mode = 1;
}
// A connection response message.
//
// This message provides information for the incoming peer regarding the types
// of authorization accepted.
message ConnectResponse {
enum AuthorizationType {
UNSET_AUTHORIZATION_TYPE = 0;
TRUST = 1;
}
// A list of available authorization types accepted by the sending node.
repeated AuthorizationType accepted_authorization_types = 1;
}
// A trust request.
//
// A trust request is sent in response to a Connect Message, if the node is using trust
// authentication as its means of allowing a node to connect.
message TrustRequest {
// The requesting node's identity.
string identity = 1;
}
// A successful authorization message.
//
// This message is returned after either a TrustResponse or a ChallengeResponse has been returned
// by the connecting node.
message AuthorizedMessage {
}
// A message indicating an error in authorization.
//
// This includes failed authorizations, or invalid messages during the authorization
// handshake conversation.
message AuthorizationError {
enum AuthorizationErrorType {
UNSET_AUTHORIZATION_ERROR_TYPE = 0;
AUTHORIZATION_REJECTED = 1;
}
// The type of error.
AuthorizationErrorType error_type = 1;
// The error details.
string error_message = 2;
}