session: change KeyStore documentation

This commit is contained in:
Leonard Lyubich 2020-04-29 12:44:35 +03:00
parent 22265a9f03
commit 701bbafcf1
2 changed files with 11 additions and 15 deletions

View file

@ -1,20 +1,5 @@
package session 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. // NewInitRequest returns new initialization CreateRequest from passed Token.
func NewInitRequest(t *Token) *CreateRequest { func NewInitRequest(t *Token) *CreateRequest {
return &CreateRequest{Message: &CreateRequest_Init{Init: t}} return &CreateRequest{Message: &CreateRequest_Init{Init: t}}

View file

@ -1,6 +1,9 @@
package session package session
import ( import (
"context"
"crypto/ecdsa"
"github.com/nspcc-dev/neofs-api-go/internal" "github.com/nspcc-dev/neofs-api-go/internal"
"github.com/nspcc-dev/neofs-api-go/refs" "github.com/nspcc-dev/neofs-api-go/refs"
"github.com/nspcc-dev/neofs-api-go/service" "github.com/nspcc-dev/neofs-api-go/service"
@ -51,6 +54,14 @@ type PrivateTokenStore interface {
Store(TokenID, PrivateToken) error 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 ErrPrivateTokenNotFound = internal.Error("private token not found")
const ( const (