Documentation ¶
Index ¶
- Constants
- Variables
- func PublicSessionToken(pToken PrivateToken) ([]byte, error)
- func RegisterSessionServer(s *grpc.Server, srv SessionServer)
- type CreateParamsContainer
- type CreateParamsSource
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)
- func (m CreateRequest) GetOwnerID() OwnerID
- func (m *CreateRequest) Marshal() (dAtA []byte, err error)
- func (m *CreateRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CreateRequest) ProtoMessage()
- func (m CreateRequest) ReadSignedData(p []byte) (int, error)
- func (m *CreateRequest) Reset()
- func (m *CreateRequest) SetOwnerID(id OwnerID)
- func (m CreateRequest) SignedData() ([]byte, error)
- func (m CreateRequest) SignedDataSize() int
- func (m *CreateRequest) Size() (n int)
- func (m *CreateRequest) String() string
- func (m *CreateRequest) Unmarshal(dAtA []byte) error
- func (m *CreateRequest) XXX_DiscardUnknown()
- func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreateRequest) XXX_Merge(src proto.Message)
- func (m *CreateRequest) XXX_Size() int
- func (m *CreateRequest) XXX_Unmarshal(b []byte) error
- type CreateResponse
- func (*CreateResponse) Descriptor() ([]byte, []int)
- func (m CreateResponse) GetID() TokenID
- func (m *CreateResponse) GetSessionKey() []byte
- func (m *CreateResponse) Marshal() (dAtA []byte, err error)
- func (m *CreateResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CreateResponse) ProtoMessage()
- func (m *CreateResponse) Reset()
- func (m *CreateResponse) SetID(id TokenID)
- func (m *CreateResponse) SetSessionKey(key []byte)
- func (m *CreateResponse) Size() (n int)
- func (m *CreateResponse) String() string
- func (m *CreateResponse) Unmarshal(dAtA []byte) error
- func (m *CreateResponse) XXX_DiscardUnknown()
- func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreateResponse) XXX_Merge(src proto.Message)
- func (m *CreateResponse) XXX_Size() int
- func (m *CreateResponse) XXX_Unmarshal(b []byte) error
- type CreateResult
- type Creator
- type EpochLifetimeStore
- type KeyStore
- type OwnerID
- type PrivateToken
- type PrivateTokenKey
- type PrivateTokenSource
- type PrivateTokenStore
- type SessionClient
- type SessionServer
- type Token
- type TokenID
- type UnimplementedSessionServer
Constants ¶
const ErrNilCreateParamsSource = internal.Error("create params source is nil")
ErrNilCreateParamsSource is returned by functions that expect a non-nil CreateParamsSource, but received nil.
const ErrNilGPRCClientConn = internal.Error("gRPC client connection is nil")
ErrNilGPRCClientConn is returned by functions that expect a non-nil grpc.ClientConn, but received nil.
const ErrNilPrivateToken = internal.Error("private token is nil")
ErrNilPrivateToken is returned by functions that expect a non-nil PrivateToken, but received nil.
const ErrPrivateTokenNotFound = internal.Error("private token not found")
ErrPrivateTokenNotFound is returned when addressed private token was not found in storage.
Variables ¶
Functions ¶
func PublicSessionToken ¶ added in v0.7.6
func PublicSessionToken(pToken PrivateToken) ([]byte, error)
PublicSessionToken returns a binary representation of session public key.
If passed PrivateToken is nil, ErrNilPrivateToken returns. If passed PrivateToken carries nil private key, crypto.ErrEmptyPrivateKey returns.
func RegisterSessionServer ¶
func RegisterSessionServer(s *grpc.Server, srv SessionServer)
Types ¶
type CreateParamsContainer ¶ added in v0.7.4
type CreateParamsContainer interface { refs.OwnerIDContainer service.LifetimeContainer }
CreateParamsContainer is an interface of the container of session parameters.
func NewParams ¶ added in v0.7.4
func NewParams() CreateParamsContainer
NewParams creates a new CreateRequest message and returns CreateParamsContainer interface.
type CreateParamsSource ¶ added in v0.7.4
type CreateParamsSource interface { refs.OwnerIDSource service.LifetimeSource }
CreateParamsSource is an interface of the container of session parameters with read access.
type CreateRequest ¶
type CreateRequest struct { // OwnerID carries an identifier of a session initiator OwnerID OwnerID `protobuf:"bytes,1,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"` // Lifetime carries a lifetime of the session service.TokenLifetime `protobuf:"bytes,2,opt,name=Lifetime,proto3,embedded=Lifetime" json:"Lifetime"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) service.RequestVerificationHeader `protobuf:"bytes,99,opt,name=Verify,proto3,embedded=Verify" json:"Verify"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
CreateRequest carries an information necessary for opening a session
func (*CreateRequest) Descriptor ¶
func (*CreateRequest) Descriptor() ([]byte, []int)
func (CreateRequest) GetOwnerID ¶ added in v0.7.4
func (m CreateRequest) GetOwnerID() OwnerID
GetOwnerID is an OwnerID field getter.
func (*CreateRequest) Marshal ¶
func (m *CreateRequest) Marshal() (dAtA []byte, err error)
func (*CreateRequest) MarshalToSizedBuffer ¶
func (m *CreateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateRequest) ProtoMessage ¶
func (*CreateRequest) ProtoMessage()
func (CreateRequest) ReadSignedData ¶ added in v0.7.4
func (m CreateRequest) ReadSignedData(p []byte) (int, error)
ReadSignedData copies payload bytes to passed buffer.
If the buffer size is insufficient, io.ErrUnexpectedEOF returns.
func (*CreateRequest) Reset ¶
func (m *CreateRequest) Reset()
func (*CreateRequest) SetOwnerID ¶ added in v0.7.4
func (m *CreateRequest) SetOwnerID(id OwnerID)
SetOwnerID is an OwnerID field setter.
func (CreateRequest) SignedData ¶ added in v0.7.4
func (m CreateRequest) SignedData() ([]byte, error)
SignedData returns payload bytes of the request.
func (CreateRequest) SignedDataSize ¶ added in v0.7.4
func (m CreateRequest) SignedDataSize() int
SignedDataSize returns payload size of the request.
func (*CreateRequest) Size ¶
func (m *CreateRequest) Size() (n int)
func (*CreateRequest) String ¶
func (m *CreateRequest) String() string
func (*CreateRequest) Unmarshal ¶
func (m *CreateRequest) Unmarshal(dAtA []byte) error
func (*CreateRequest) XXX_DiscardUnknown ¶
func (m *CreateRequest) XXX_DiscardUnknown()
func (*CreateRequest) XXX_Marshal ¶
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateRequest) XXX_Merge ¶
func (m *CreateRequest) XXX_Merge(src proto.Message)
func (*CreateRequest) XXX_Size ¶
func (m *CreateRequest) XXX_Size() int
func (*CreateRequest) XXX_Unmarshal ¶
func (m *CreateRequest) XXX_Unmarshal(b []byte) error
type CreateResponse ¶
type CreateResponse struct { // ID carries an identifier of session token ID TokenID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=TokenID" json:"ID"` // SessionKey carries a session public key SessionKey []byte `protobuf:"bytes,2,opt,name=SessionKey,proto3" json:"SessionKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
CreateResponse carries an information about the opened session
func (*CreateResponse) Descriptor ¶
func (*CreateResponse) Descriptor() ([]byte, []int)
func (CreateResponse) GetID ¶ added in v0.7.4
func (m CreateResponse) GetID() TokenID
GetID is an ID field getter.
func (*CreateResponse) GetSessionKey ¶ added in v0.7.4
func (m *CreateResponse) GetSessionKey() []byte
func (*CreateResponse) Marshal ¶
func (m *CreateResponse) Marshal() (dAtA []byte, err error)
func (*CreateResponse) MarshalToSizedBuffer ¶
func (m *CreateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) Reset ¶
func (m *CreateResponse) Reset()
func (*CreateResponse) SetID ¶ added in v0.7.4
func (m *CreateResponse) SetID(id TokenID)
SetID is an ID field setter.
func (*CreateResponse) SetSessionKey ¶ added in v0.7.4
func (m *CreateResponse) SetSessionKey(key []byte)
SetSessionKey is a SessionKey field setter.
func (*CreateResponse) Size ¶
func (m *CreateResponse) Size() (n int)
func (*CreateResponse) String ¶
func (m *CreateResponse) String() string
func (*CreateResponse) Unmarshal ¶
func (m *CreateResponse) Unmarshal(dAtA []byte) error
func (*CreateResponse) XXX_DiscardUnknown ¶
func (m *CreateResponse) XXX_DiscardUnknown()
func (*CreateResponse) XXX_Marshal ¶
func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateResponse) XXX_Merge ¶
func (m *CreateResponse) XXX_Merge(src proto.Message)
func (*CreateResponse) XXX_Size ¶
func (m *CreateResponse) XXX_Size() int
func (*CreateResponse) XXX_Unmarshal ¶
func (m *CreateResponse) XXX_Unmarshal(b []byte) error
type CreateResult ¶ added in v0.7.4
type CreateResult interface { service.TokenIDSource service.SessionKeySource }
CreateResult is an interface of the container of an opened session info with read access.
type Creator ¶ added in v0.7.4
type Creator interface {
Create(context.Context, CreateParamsSource) (CreateResult, error)
}
Creator is an interface of the tool for a session opening.
func NewGRPCCreator ¶ added in v0.7.4
func NewGRPCCreator(conn *grpc.ClientConn, key *ecdsa.PrivateKey) (Creator, error)
NewGRPCCreator unites virtual gRPC client with private ket and returns Creator interface.
If passed ClientConn is nil, ErrNilGPRCClientConn returns. If passed private key is nil, crypto.ErrEmptyPrivateKey returns.
type EpochLifetimeStore ¶ added in v0.7.4
type EpochLifetimeStore interface { // RemoveExpired must remove all elements that are expired in the given epoch. RemoveExpired(uint64) error }
EpochLifetimeStore is an interface of the storage of elements that lifetime is limited by NeoFS epoch.
type KeyStore ¶
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) }
KeyStore is an interface of the storage of public keys addressable by OwnerID,
type PrivateToken ¶ added in v0.7.4
type PrivateToken interface { // PrivateKey must return session private key. PrivateKey() *ecdsa.PrivateKey // Expired must return true if and only if private token is expired in the given epoch number. Expired(uint64) bool }
PrivateToken is an interface of session private part.
func NewPrivateToken ¶ added in v0.7.4
func NewPrivateToken(validUntil uint64) (PrivateToken, error)
NewPrivateToken creates PrivateToken instance that expires after passed epoch.
Returns non-nil error on key generation error.
type PrivateTokenKey ¶ added in v0.7.4
type PrivateTokenKey struct {
// contains filtered or unexported fields
}
PrivateTokenKey is a structure of private token storage key.
func (*PrivateTokenKey) SetOwnerID ¶ added in v0.7.4
func (s *PrivateTokenKey) SetOwnerID(id OwnerID)
SetOwnerID is an owner ID field setter.
func (*PrivateTokenKey) SetTokenID ¶ added in v0.7.4
func (s *PrivateTokenKey) SetTokenID(id TokenID)
SetTokenID is a token ID field setter.
type PrivateTokenSource ¶ added in v0.7.4
type PrivateTokenSource interface { // Fetch must return the storage record corresponding to the passed key. // // Resulting error must be ErrPrivateTokenNotFound if there is no corresponding record. Fetch(PrivateTokenKey) (PrivateToken, error) }
PrivateTokenSource is an interface of private token storage with read access.
type PrivateTokenStore ¶ added in v0.7.4
type PrivateTokenStore interface { PrivateTokenSource EpochLifetimeStore // Store must save passed private token in the storage under the given key. // // Resulting error must be nil if private token was stored successfully. Store(PrivateTokenKey, PrivateToken) error }
PrivateTokenStore is an interface of the storage of private tokens addressable by TokenID.
func NewMapTokenStore ¶ added in v0.7.4
func NewMapTokenStore() PrivateTokenStore
NewMapTokenStore creates new PrivateTokenStore instance.
The elements of the instance are stored in the map.
type SessionClient ¶
type SessionClient interface { // Create opens new session between the client and the server Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) }
SessionClient is the client API for Session service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewSessionClient ¶
func NewSessionClient(cc *grpc.ClientConn) SessionClient
type SessionServer ¶
type SessionServer interface { // Create opens new session between the client and the server Create(context.Context, *CreateRequest) (*CreateResponse, error) }
SessionServer is the server API for Session service.
type UnimplementedSessionServer ¶
type UnimplementedSessionServer struct { }
UnimplementedSessionServer can be embedded to have forward compatible implementations.
func (*UnimplementedSessionServer) Create ¶
func (*UnimplementedSessionServer) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)