syntax = "proto3";

package neo.fs.v2.session;

option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session/grpc;session";
option csharp_namespace = "NeoFS.API.v2.Session";

import "refs/types.proto";
import "session/types.proto";

// Create Session record on Node side
service SessionService {
  // Create opens new session between the client and the server.
  rpc Create (CreateRequest) returns (CreateResponse);
}

// CreateRequest carries an information necessary for opening a session.
message CreateRequest {
  // Request body
  message Body {
    // Carries an identifier of a session initiator.
    neo.fs.v2.refs.OwnerID owner_id = 1;
    // Expiration Epoch
    uint64 expiration = 2;
  }
  // Body of create session token request message.
  Body body = 1;

  // Carries request meta information. Header data is used only to regulate message
  // transport and does not affect request execution.
  neo.fs.v2.session.RequestMetaHeader meta_header = 2;

  // Carries request verification information. This header is used to authenticate
  // the nodes of the message route and check the correctness of transmission.
  neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
}

// CreateResponse carries an information about the opened session.
message CreateResponse {
  // Response body
  message Body {
    // id carries an identifier of session token.
    bytes id = 1;

    // session_key carries a session public key.
    bytes session_key = 2;
  }

  // Body of create session token response message.
  Body body = 1;

  // Carries response meta information. Header data is used only to regulate
  // message transport and does not affect request execution.
  neo.fs.v2.session.ResponseMetaHeader meta_header = 2;

  // Carries response verification information. This header is used to
  // authenticate the nodes of the message route and check the correctness
  // of transmission.
  neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
}