diff --git a/object/types.proto b/object/types.proto index 356ad8b..5c448c3 100644 --- a/object/types.proto +++ b/object/types.proto @@ -6,7 +6,7 @@ option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object/grpc;object"; option csharp_namespace = "NeoFS.API.v2.Object"; import "refs/types.proto"; -import "service/types.proto"; +import "session/types.proto"; // Type of the object payload content enum ObjectType { @@ -77,7 +77,7 @@ message Header { // Session token, if it was used during Object creation. // Need it to verify integrity and authenticity out of Request scope. - neo.fs.v2.service.SessionToken session_token = 9; + neo.fs.v2.session.SessionToken session_token = 9; // Attribute groups the user-defined Key-Value pairs attached to the object message Attribute { diff --git a/service/types.proto b/service/types.proto index f657d5f..3f9db75 100644 --- a/service/types.proto +++ b/service/types.proto @@ -7,6 +7,7 @@ option csharp_namespace = "NeoFS.API.v2.Service"; import "acl/types.proto"; import "refs/types.proto"; +import "session/types.proto"; // Extended headers for Request/Response message XHeader { @@ -17,80 +18,6 @@ message XHeader { string value = 2; } -// 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; - } - // Verb is a type of request for which the token is issued - Verb verb = 1; - - // Related Object address - neo.fs.v2.refs.Address address = 2; -} - -// NeoFS session token. -message SessionToken { - // Session token body - message Body { - // ID is a token identifier. valid UUIDv4 represented in bytes - bytes id = 1; - - // OwnerID carries identifier of the session initiator. - neo.fs.v2.refs.OwnerID owner_id = 2; - - // Lifetime parameters of the token. Filed names taken from rfc7519. - message TokenLifetime { - // Expiration Epoch - uint64 exp = 1; - - // Not valid before Epoch - uint64 nbf = 2; - - // Issued at Epoch - uint64 iat = 3; - } - // Lifetime is a lifetime of the session - TokenLifetime lifetime = 3; - - // SessionKey is a public key of session key - bytes session_key = 4; - - // Carries context of the session. - oneof context { - // ObjectService session context. - ObjectSessionContext object = 5; - } - } - // Session Token body - Body body = 1; - - // Signature is a signature of session token information - neo.fs.v2.refs.Signature signature = 2; -} // Information about the request message RequestMetaHeader { @@ -107,7 +34,7 @@ message RequestMetaHeader { repeated XHeader x_headers = 4; // Token is a token of the session within which the request is sent - SessionToken session_token = 5; + neo.fs.v2.session.SessionToken session_token = 5; // Bearer is a Bearer token of the request neo.fs.v2.acl.BearerToken bearer_token = 6; diff --git a/session/types.proto b/session/types.proto new file mode 100644 index 0000000..84ba10c --- /dev/null +++ b/session/types.proto @@ -0,0 +1,83 @@ +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"; + +// 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; + } + // Verb is a type of request for which the token is issued + Verb verb = 1; + + // Related Object address + neo.fs.v2.refs.Address address = 2; +} + +// NeoFS session token. +message SessionToken { + // Session token body + message Body { + // ID is a token identifier. valid UUIDv4 represented in bytes + bytes id = 1; + + // OwnerID carries identifier of the session initiator. + neo.fs.v2.refs.OwnerID owner_id = 2; + + // Lifetime parameters of the token. Filed names taken from rfc7519. + message TokenLifetime { + // Expiration Epoch + uint64 exp = 1; + + // Not valid before Epoch + uint64 nbf = 2; + + // Issued at Epoch + uint64 iat = 3; + } + // Lifetime is a lifetime of the session + TokenLifetime lifetime = 3; + + // SessionKey is a public key of session key + bytes session_key = 4; + + // Carries context of the session. + oneof context { + // ObjectService session context. + ObjectSessionContext object = 5; + } + } + // Session Token body + Body body = 1; + + // Signature is a signature of session token information + neo.fs.v2.refs.Signature signature = 2; +}