From 701bbafcf11724216078739990363167d8f85cc6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 29 Apr 2020 12:44:35 +0300 Subject: [PATCH] session: change KeyStore documentation --- session/service.go | 15 --------------- session/types.go | 11 +++++++++++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/session/service.go b/session/service.go index ecbd6f5f..6e293d36 100644 --- a/session/service.go +++ b/session/service.go @@ -1,20 +1,5 @@ package session -import ( - "context" - "crypto/ecdsa" - - "github.com/nspcc-dev/neofs-api-go/refs" -) - -type ( - // KeyStore is an interface that describes storage, - // that allows to fetch public keys by OwnerID. - KeyStore interface { - Get(ctx context.Context, id refs.OwnerID) ([]*ecdsa.PublicKey, error) - } -) - // NewInitRequest returns new initialization CreateRequest from passed Token. func NewInitRequest(t *Token) *CreateRequest { return &CreateRequest{Message: &CreateRequest_Init{Init: t}} diff --git a/session/types.go b/session/types.go index bacc770f..435616ab 100644 --- a/session/types.go +++ b/session/types.go @@ -1,6 +1,9 @@ package session import ( + "context" + "crypto/ecdsa" + "github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/service" @@ -51,6 +54,14 @@ type PrivateTokenStore interface { Store(TokenID, PrivateToken) error } +// KeyStore is an interface of the storage of public keys addressable by OwnerID, +type KeyStore interface { + // Get must return the storage record corresponding to the passed key. + // + // Resulting error must be ErrKeyNotFound if there is no corresponding record. + Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error) +} + const ErrPrivateTokenNotFound = internal.Error("private token not found") const (