2020-08-18 13:49:05 +00:00
|
|
|
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";
|
2020-08-19 14:00:23 +00:00
|
|
|
import "acl/types.proto";
|
2020-08-18 13:49:05 +00:00
|
|
|
|
|
|
|
// Context information for Session Tokens related to ObjectService requests
|
|
|
|
message ObjectSessionContext {
|
|
|
|
// Object request verbs
|
|
|
|
enum Verb {
|
|
|
|
// Unknown verb
|
|
|
|
VERB_UNSPECIFIED = 0;
|
|
|
|
|
|
|
|
// Refers to object.Put RPC call
|
|
|
|
PUT = 1;
|
|
|
|
|
|
|
|
// Refers to object.Get RPC call
|
|
|
|
GET = 2;
|
|
|
|
|
|
|
|
// Refers to object.Head RPC call
|
|
|
|
HEAD = 3;
|
|
|
|
|
|
|
|
// Refers to object.Search RPC call
|
|
|
|
SEARCH = 4;
|
|
|
|
|
|
|
|
// Refers to object.Delete RPC call
|
|
|
|
DELETE = 5;
|
|
|
|
|
|
|
|
// Refers to object.GetRange RPC call
|
|
|
|
RANGE = 6;
|
|
|
|
|
|
|
|
// Refers to object.GetRangeHash RPC call
|
|
|
|
RANGEHASH = 7;
|
|
|
|
}
|
2020-10-16 06:20:47 +00:00
|
|
|
// Type of request for which the token is issued
|
2020-10-19 09:42:24 +00:00
|
|
|
Verb verb = 1 [json_name = "verb"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
|
|
|
// Related Object address
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Address address = 2 [json_name = "address"];
|
2020-08-18 13:49:05 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// NeoFS Session Token.
|
2020-08-18 13:49:05 +00:00
|
|
|
message SessionToken {
|
2020-10-16 06:20:47 +00:00
|
|
|
// Session Token body
|
2020-08-18 13:49:05 +00:00
|
|
|
message Body {
|
2020-10-16 06:20:47 +00:00
|
|
|
// Token identifier is a valid UUIDv4 in binary form
|
2020-10-19 09:42:24 +00:00
|
|
|
bytes id = 1 [json_name = "id"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Identifier of the session initiator
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.OwnerID owner_id = 2 [json_name = "ownerID"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
2020-11-25 10:16:52 +00:00
|
|
|
// Lifetime parameters of the token. Field names taken from rfc7519.
|
2020-08-18 13:49:05 +00:00
|
|
|
message TokenLifetime {
|
|
|
|
// Expiration Epoch
|
2020-10-19 09:42:24 +00:00
|
|
|
uint64 exp = 1 [json_name = "exp"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
|
|
|
// Not valid before Epoch
|
2020-10-19 09:42:24 +00:00
|
|
|
uint64 nbf = 2 [json_name = "nbf"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
|
|
|
// Issued at Epoch
|
2020-10-19 09:42:24 +00:00
|
|
|
uint64 iat = 3 [json_name = "iat"];
|
2020-08-18 13:49:05 +00:00
|
|
|
}
|
2020-10-16 06:20:47 +00:00
|
|
|
// Lifetime of the session
|
2020-10-19 09:42:24 +00:00
|
|
|
TokenLifetime lifetime = 3 [json_name = "lifetime"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Public key used in session
|
2020-10-19 09:42:24 +00:00
|
|
|
bytes session_key = 4 [json_name = "sessionKey"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Session Context information
|
2020-08-18 13:49:05 +00:00
|
|
|
oneof context {
|
2020-10-16 06:20:47 +00:00
|
|
|
// ObjectService session context
|
2020-10-19 09:42:24 +00:00
|
|
|
ObjectSessionContext object = 5 [json_name = "object"];
|
2020-08-18 13:49:05 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-16 06:20:47 +00:00
|
|
|
// Session Token contains the proof of trust between peers to be attached in
|
|
|
|
// requests for further verification. Please see corresponding section of
|
|
|
|
// NeoFS Technical Specification for details.
|
2020-10-19 09:42:24 +00:00
|
|
|
Body body = 1 [json_name = "body"];
|
2020-08-18 13:49:05 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Signature of `SessionToken` information
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature signature = 2 [json_name = "signature"];
|
2020-08-18 13:49:05 +00:00
|
|
|
}
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2021-01-11 14:11:36 +00:00
|
|
|
// Extended headers for Request/Response. May contain any user-defined headers
|
|
|
|
// to be interpreted on application level.
|
|
|
|
//
|
|
|
|
// Key name must be unique valid UTF-8 string. Value can't be empty. Requests or
|
|
|
|
// Responses with duplicated header names or headers with empty values will be
|
|
|
|
// considered invalid.
|
|
|
|
//
|
|
|
|
// There are some "well-known" headers starting with `__NEOFS__` prefix that
|
|
|
|
// affect system behaviour:
|
|
|
|
//
|
|
|
|
// * __NEOFS__NETMAP_EPOCH \
|
|
|
|
// Netmap epoch to use for object placement calculation. The `value` is string
|
|
|
|
// encoded `uint64` in decimal presentation. If set to '0' or not set, the
|
|
|
|
// current epoch only will be used.
|
|
|
|
// * __NEOFS__NETMAP_LOOKUP_DEPTH \
|
|
|
|
// If object can't be found using current epoch's netmap, this header limits
|
|
|
|
// how many past epochs back the node can lookup. The `value` is string
|
|
|
|
// encoded `uint64` in decimal presentation. If set to '0' or not set, the
|
|
|
|
// current epoch only will be used.
|
2020-08-19 14:00:23 +00:00
|
|
|
message XHeader {
|
2020-10-16 06:20:47 +00:00
|
|
|
// Key of the X-Header
|
2020-10-19 09:42:24 +00:00
|
|
|
string key = 1 [json_name = "key"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Value of the X-Header
|
2020-10-19 09:42:24 +00:00
|
|
|
string value = 2 [json_name = "value"];
|
2020-08-19 14:00:23 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Meta information attached to the request. When forwarded between peers,
|
|
|
|
// request meta headers are folded in matryoshka style.
|
2020-08-19 14:00:23 +00:00
|
|
|
message RequestMetaHeader {
|
2020-10-16 06:20:47 +00:00
|
|
|
// Peer's API version used
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Peer's local epoch number. Set to 0 if unknown.
|
2020-10-19 09:42:24 +00:00
|
|
|
uint64 epoch = 2 [json_name = "epoch"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Maximum number of intermediate nodes in the request route
|
2020-10-19 09:42:24 +00:00
|
|
|
uint32 ttl = 3 [json_name = "ttl"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Request X-Headers
|
2020-10-19 09:42:24 +00:00
|
|
|
repeated XHeader x_headers = 4 [json_name = "xHeaders"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Session token within which the request is sent
|
2020-10-19 09:42:24 +00:00
|
|
|
SessionToken session_token = 5 [json_name = "sessionToken"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// `BearerToken` with eACL overrides for the request
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.acl.BearerToken bearer_token = 6 [json_name = "bearerToken"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// `RequestMetaHeader` of the origin request
|
2020-10-19 09:42:24 +00:00
|
|
|
RequestMetaHeader origin = 7 [json_name = "origin"];
|
2020-08-19 14:00:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Information about the response
|
|
|
|
message ResponseMetaHeader {
|
2020-10-16 06:20:47 +00:00
|
|
|
// Peer's API version used
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Version version = 1 [json_name = "version"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Peer's local epoch number
|
2020-10-19 09:42:24 +00:00
|
|
|
uint64 epoch = 2 [json_name = "epoch"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Maximum number of intermediate nodes in the request route
|
2020-10-19 09:42:24 +00:00
|
|
|
uint32 ttl = 3 [json_name = "ttl"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Response X-Headers
|
2020-10-19 09:42:24 +00:00
|
|
|
repeated XHeader x_headers = 4 [json_name = "xHeaders"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// `ResponseMetaHeader` of the origin request
|
2020-10-19 09:42:24 +00:00
|
|
|
ResponseMetaHeader origin = 5 [json_name = "origin"];
|
2020-08-19 14:00:23 +00:00
|
|
|
}
|
|
|
|
|
2020-10-16 06:20:47 +00:00
|
|
|
// Verification info for request signed by all intermediate nodes.
|
2020-08-19 14:00:23 +00:00
|
|
|
message RequestVerificationHeader {
|
|
|
|
// Request Body signature. Should be generated once by request initiator.
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature body_signature = 1 [json_name = "bodySignature"];
|
2020-10-16 06:20:47 +00:00
|
|
|
// Request Meta signature is added and signed by each intermediate node
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature meta_signature = 2 [json_name = "metaSignature"];
|
2020-10-16 06:20:47 +00:00
|
|
|
// Signature of previous hops
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature origin_signature = 3 [json_name = "originSignature"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
|
|
|
// Chain of previous hops signatures
|
2020-10-19 09:42:24 +00:00
|
|
|
RequestVerificationHeader origin = 4 [json_name = "origin"];
|
2020-08-19 14:00:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Verification info for response signed by all intermediate nodes
|
|
|
|
message ResponseVerificationHeader {
|
|
|
|
// Response Body signature. Should be generated once by answering node.
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature body_signature = 1 [json_name = "bodySignature"];
|
2020-10-16 06:20:47 +00:00
|
|
|
// Response Meta signature is added and signed by each intermediate node
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature meta_signature = 2 [json_name = "metaSignature"];
|
2020-10-16 06:20:47 +00:00
|
|
|
// Signature of previous hops
|
2020-10-19 09:42:24 +00:00
|
|
|
neo.fs.v2.refs.Signature origin_signature = 3 [json_name = "originSignature"];
|
2020-08-19 14:00:23 +00:00
|
|
|
|
|
|
|
// Chain of previous hops signatures
|
2020-10-19 09:42:24 +00:00
|
|
|
ResponseVerificationHeader origin = 4 [json_name = "origin"];
|
2020-08-19 14:00:23 +00:00
|
|
|
}
|