session: implement gRPC session creator

This commit is contained in:
Leonard Lyubich 2020-05-08 12:34:16 +03:00
parent 6d71ea239b
commit b079a7604f
6 changed files with 219 additions and 5 deletions

View file

@ -5,6 +5,8 @@ import (
"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"
)
// PrivateToken is an interface of session private part.
@ -55,5 +57,28 @@ type KeyStore interface {
Get(context.Context, OwnerID) ([]*ecdsa.PublicKey, error)
}
// CreateParamsSource is an interface of the container of session parameters with read access.
type CreateParamsSource interface {
refs.OwnerIDSource
service.LifetimeSource
}
// CreateParamsContainer is an interface of the container of session parameters.
type CreateParamsContainer interface {
refs.OwnerIDContainer
service.LifetimeContainer
}
// CreateResult is an interface of the container of an opened session info with read access.
type CreateResult interface {
service.TokenIDSource
service.SessionKeySource
}
// Creator is an interface of the tool for a session opening.
type Creator interface {
Create(context.Context, CreateParamsSource) (CreateResult, error)
}
// ErrPrivateTokenNotFound is raised when addressed private token was not found in storage.
const ErrPrivateTokenNotFound = internal.Error("private token not found")