From 4b1eb63b59b9ca92e9d90bdcf7c0d3692c1a0082 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Tue, 11 Aug 2020 17:49:31 +0300 Subject: [PATCH] [#37] Add matryoska-style meta and verification headers Signed-off-by: Stanislav Bogatyrev --- service/meta.proto | 49 ++++++++++++++++++++++++++++++++------------ service/verify.proto | 22 +++++++++++++------- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/service/meta.proto b/service/meta.proto index ff5ceac..77e5793 100644 --- a/service/meta.proto +++ b/service/meta.proto @@ -5,6 +5,16 @@ package service; option go_package = "github.com/nspcc-dev/neofs-api-go/service"; option csharp_namespace = "NeoFS.API.Service"; +import "acl/types.proto"; +import "service/verify.proto"; + +message XHeader { + // Key of the X-Header. + string key = 1; + // Value of the X-Header. + string value = 2; +} + // Represents API version used by node. message Version { // Major API version. @@ -13,19 +23,32 @@ message Version { uint32 minor = 2; } -// RequestMetaHeader contains information about request meta headers. +// Information about the request message RequestMetaHeader { - // Carries maximum number of nodes in the request route. - uint32 ttl = 1; + // Client API version. + Version version = 1; + // Client local epoch number. Set to 0 if unknown. + uint64 epoch = 2; + // Maximum number of nodes in the request route. + uint32 ttl = 3; + // Request X-Headers. + repeated XHeader x_headers = 4; - message XHeader { - // Carries key to the X-Header. - string key = 1; - - // Carries value of the X-Header. - string value = 2; - } - - // Carries request X-Headers. - repeated XHeader x_headers = 2; + // RequestMetaHeader of the origin request. + RequestMetaHeader origin = 98; +} + +// Information about the response +message ResponseMetaHeader { + // Server API version. + Version version = 1; + // Server local epoch number. + uint64 epoch = 2; + // Maximum number of nodes in the response route. + uint32 ttl = 3; + // Response X-Headers. + repeated XHeader x_headers = 4; + + // Carries response meta header of the origin response. + ResponseMetaHeader origin = 98; } diff --git a/service/verify.proto b/service/verify.proto index 4ae10a9..a1deab8 100644 --- a/service/verify.proto +++ b/service/verify.proto @@ -15,17 +15,17 @@ message Signature { bytes sign = 2; } -// RequestVerificationHeader is a set of signatures of every NeoFS Node that -// processed request. +// Verification info for request signed by all intermediate nodes message RequestVerificationHeader { - // Signatures is a set of signatures of every passed NeoFS Node - repeated Signature signatures = 1; + Signature body_signature = 1; + Signature meta_signature = 2; // Token is a token of the session within which the request is sent - SessionToken token = 2; - + SessionToken token = 3; // Bearer is a Bearer token of the request - BearerTokenMsg bearer = 3; + BearerTokenMsg bearer = 4; + + RequestVerificationHeader origin = 5; } // Represents the NeoFS session token. @@ -112,3 +112,11 @@ message BearerTokenMsg { // Signature is a signature of token information bytes signature = 3; } + +// Verification info for response signed by all intermediate nodes +message ResponseVerificationHeader { + Signature body_signature = 1; + Signature meta_signature = 2; + + ResponseVerificationHeader origin = 3; +}