/**
 * Communication protocol used to obtain client session.
 * @author Tomasz Lichon
 * @copyright (C) 2015 ACK CYFRONET AGH
 * @copyright This software is released under the MIT license cited in
 * 'LICENSE.txt'
 */

syntax = "proto2";
package one.clproto;

enum HandshakeStatus {
    OK                               = 1;
    TOKEN_EXPIRED                    = 2;
    TOKEN_NOT_FOUND                  = 3;
    INVALID_METHOD                   = 4;
    ROOT_RESOURCE_NOT_FOUND          = 5;
    INVALID_PROVIDER                 = 6;
    BAD_SIGNATURE_FOR_MACAROON       = 7;
    FAILED_TO_DESCRYPT_CAVEAT        = 8;
    NO_DISCHARGE_MACAROON_FOR_CAVEAT = 9;
    INVALID_TOKEN                    = 10;
    INCOMPATIBLE_VERSION             = 11;
    INTERNAL_SERVER_ERROR            = 12;
}

message HandshakeRequest {
    optional bytes session_id = 1;
    optional Token token      = 2;
    required bytes version    = 3;
}

message HandshakeResponse {
    required HandshakeStatus status = 1;
}

message Token {
    required bytes value            = 1;
    repeated bytes secondary_values = 2;
}
