Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterSessionServer(s *grpc.Server, srv SessionServer)
- func UnmarshalPublicKeys(t *Token) []*ecdsa.PublicKey
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)
- func (m *CreateRequest) GetInit() *Token
- func (m *CreateRequest) GetMessage() isCreateRequest_Message
- func (m *CreateRequest) GetSigned() *Token
- 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) Reset()
- 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 (*CreateRequest) XXX_OneofWrappers() []interface{}
- func (m *CreateRequest) XXX_Size() int
- func (m *CreateRequest) XXX_Unmarshal(b []byte) error
- type CreateRequest_Init
- type CreateRequest_Signed
- type CreateResponse
- func (*CreateResponse) Descriptor() ([]byte, []int)
- func (m *CreateResponse) GetMessage() isCreateResponse_Message
- func (m *CreateResponse) GetResult() *Token
- func (m *CreateResponse) GetUnsigned() *Token
- 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) 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 (*CreateResponse) XXX_OneofWrappers() []interface{}
- func (m *CreateResponse) XXX_Size() int
- func (m *CreateResponse) XXX_Unmarshal(b []byte) error
- type CreateResponse_Result
- type CreateResponse_Unsigned
- type KeyStore
- type ObjectID
- type OwnerID
- type PToken
- type SessionClient
- type SessionServer
- type Session_CreateClient
- type Session_CreateServer
- type Token
- func (*Token) Descriptor() ([]byte, []int)
- func (m *Token) GetFirstEpoch() uint64
- func (m *Token) GetHeader() VerificationHeader
- func (m *Token) GetLastEpoch() uint64
- func (m *Token) GetPublicKeys() [][]byte
- func (m *Token) GetSignature() []byte
- func (m *Token) IsSame(t *Token) error
- func (m *Token) Marshal() (dAtA []byte, err error)
- func (m *Token) MarshalTo(dAtA []byte) (int, error)
- func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Token) ProtoMessage()
- func (m *Token) Reset()
- func (m *Token) SetPublicKeys(keys ...*ecdsa.PublicKey)
- func (m *Token) Sign(key *ecdsa.PrivateKey) error
- func (m *Token) Size() (n int)
- func (m *Token) String() string
- func (m *Token) Unmarshal(dAtA []byte) error
- func (m *Token) Verify(keys ...*ecdsa.PublicKey) bool
- func (m *Token) XXX_DiscardUnknown()
- func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Token) XXX_Merge(src proto.Message)
- func (m *Token) XXX_Size() int
- func (m *Token) XXX_Unmarshal(b []byte) error
- type TokenID
- type TokenParams
- type TokenStore
- type UnimplementedSessionServer
- type VerificationHeader
- func (*VerificationHeader) Descriptor() ([]byte, []int)
- func (m *VerificationHeader) GetKeySignature() []byte
- func (m *VerificationHeader) GetPublicKey() []byte
- func (m *VerificationHeader) Marshal() (dAtA []byte, err error)
- func (m *VerificationHeader) MarshalTo(dAtA []byte) (int, error)
- func (m *VerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*VerificationHeader) ProtoMessage()
- func (m *VerificationHeader) Reset()
- func (m *VerificationHeader) Sign(key *ecdsa.PrivateKey) error
- func (m *VerificationHeader) Size() (n int)
- func (m *VerificationHeader) String() string
- func (m *VerificationHeader) Unmarshal(dAtA []byte) error
- func (m *VerificationHeader) Verify(keys ...*ecdsa.PublicKey) bool
- func (m *VerificationHeader) VerifyData(data, sign []byte) error
- func (m *VerificationHeader) XXX_DiscardUnknown()
- func (m *VerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *VerificationHeader) XXX_Merge(src proto.Message)
- func (m *VerificationHeader) XXX_Size() int
- func (m *VerificationHeader) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // ErrWrongFirstEpoch is raised when passed Token contains wrong first epoch. // First epoch is an epoch since token is valid ErrWrongFirstEpoch = internal.Error("wrong first epoch") // ErrWrongLastEpoch is raised when passed Token contains wrong last epoch. // Last epoch is an epoch until token is valid ErrWrongLastEpoch = internal.Error("wrong last epoch") // ErrWrongOwner is raised when passed Token contains wrong OwnerID. ErrWrongOwner = internal.Error("wrong owner") // ErrEmptyPublicKey is raised when passed Token contains wrong public key. ErrEmptyPublicKey = internal.Error("empty public key") // ErrWrongObjectsCount is raised when passed Token contains wrong objects count. ErrWrongObjectsCount = internal.Error("wrong objects count") // ErrWrongObjects is raised when passed Token contains wrong object ids. ErrWrongObjects = internal.Error("wrong objects") // ErrInvalidSignature is raised when wrong signature is passed to VerificationHeader.VerifyData(). ErrInvalidSignature = internal.Error("invalid signature") )
Variables ¶
Functions ¶
func RegisterSessionServer ¶
func RegisterSessionServer(s *grpc.Server, srv SessionServer)
func UnmarshalPublicKeys ¶
UnmarshalPublicKeys returns unmarshal public keys from the token
Types ¶
type CreateRequest ¶
type CreateRequest struct {
// Message should be one of
//
// Types that are valid to be assigned to Message:
// *CreateRequest_Init
// *CreateRequest_Signed
Message isCreateRequest_Message `protobuf_oneof:"Message"`
// 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:"-"`
}
func NewInitRequest ¶
func NewInitRequest(t *Token) *CreateRequest
NewInitRequest returns new initialization CreateRequest from passed Token.
func NewSignedRequest ¶
func NewSignedRequest(t *Token) *CreateRequest
NewSignedRequest returns new signed CreateRequest from passed Token.
func (*CreateRequest) Descriptor ¶
func (*CreateRequest) Descriptor() ([]byte, []int)
func (*CreateRequest) GetInit ¶
func (m *CreateRequest) GetInit() *Token
func (*CreateRequest) GetMessage ¶
func (m *CreateRequest) GetMessage() isCreateRequest_Message
func (*CreateRequest) GetSigned ¶
func (m *CreateRequest) GetSigned() *Token
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) Reset ¶
func (m *CreateRequest) Reset()
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_OneofWrappers ¶
func (*CreateRequest) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*CreateRequest) XXX_Size ¶
func (m *CreateRequest) XXX_Size() int
func (*CreateRequest) XXX_Unmarshal ¶
func (m *CreateRequest) XXX_Unmarshal(b []byte) error
type CreateRequest_Init ¶
type CreateRequest_Init struct {
Init *Token `protobuf:"bytes,1,opt,name=Init,proto3,oneof" json:"Init,omitempty"`
}
func (*CreateRequest_Init) MarshalTo ¶
func (m *CreateRequest_Init) MarshalTo(dAtA []byte) (int, error)
func (*CreateRequest_Init) MarshalToSizedBuffer ¶
func (m *CreateRequest_Init) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateRequest_Init) Size ¶
func (m *CreateRequest_Init) Size() (n int)
type CreateRequest_Signed ¶
type CreateRequest_Signed struct {
Signed *Token `protobuf:"bytes,2,opt,name=Signed,proto3,oneof" json:"Signed,omitempty"`
}
func (*CreateRequest_Signed) MarshalTo ¶
func (m *CreateRequest_Signed) MarshalTo(dAtA []byte) (int, error)
func (*CreateRequest_Signed) MarshalToSizedBuffer ¶
func (m *CreateRequest_Signed) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateRequest_Signed) Size ¶
func (m *CreateRequest_Signed) Size() (n int)
type CreateResponse ¶
type CreateResponse struct {
// Types that are valid to be assigned to Message:
// *CreateResponse_Unsigned
// *CreateResponse_Result
Message isCreateResponse_Message `protobuf_oneof:"Message"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*CreateResponse) Descriptor ¶
func (*CreateResponse) Descriptor() ([]byte, []int)
func (*CreateResponse) GetMessage ¶
func (m *CreateResponse) GetMessage() isCreateResponse_Message
func (*CreateResponse) GetResult ¶
func (m *CreateResponse) GetResult() *Token
func (*CreateResponse) GetUnsigned ¶
func (m *CreateResponse) GetUnsigned() *Token
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) 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_OneofWrappers ¶
func (*CreateResponse) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*CreateResponse) XXX_Size ¶
func (m *CreateResponse) XXX_Size() int
func (*CreateResponse) XXX_Unmarshal ¶
func (m *CreateResponse) XXX_Unmarshal(b []byte) error
type CreateResponse_Result ¶
type CreateResponse_Result struct {
Result *Token `protobuf:"bytes,2,opt,name=Result,proto3,oneof" json:"Result,omitempty"`
}
func (*CreateResponse_Result) MarshalTo ¶
func (m *CreateResponse_Result) MarshalTo(dAtA []byte) (int, error)
func (*CreateResponse_Result) MarshalToSizedBuffer ¶
func (m *CreateResponse_Result) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateResponse_Result) Size ¶
func (m *CreateResponse_Result) Size() (n int)
type CreateResponse_Unsigned ¶
type CreateResponse_Unsigned struct {
Unsigned *Token `protobuf:"bytes,1,opt,name=Unsigned,proto3,oneof" json:"Unsigned,omitempty"`
}
func (*CreateResponse_Unsigned) MarshalTo ¶
func (m *CreateResponse_Unsigned) MarshalTo(dAtA []byte) (int, error)
func (*CreateResponse_Unsigned) MarshalToSizedBuffer ¶
func (m *CreateResponse_Unsigned) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CreateResponse_Unsigned) Size ¶
func (m *CreateResponse_Unsigned) Size() (n int)
type KeyStore ¶
KeyStore is an interface that describes storage, that allows to fetch public keys by OwnerID.
type PToken ¶
type PToken struct {
Token
PrivateKey *ecdsa.PrivateKey
// contains filtered or unexported fields
}
PToken is a wrapper around Token that allows to sign data and to do thread-safe manipulations.
func (*PToken) AddSignatures ¶
AddSignatures adds token signatures.
type SessionClient ¶
type SessionClient interface {
// Create is a method that used to open a trusted session to manipulate
// an object. In order to put or delete object client have to obtain session
// token with trusted node. Trusted node will modify client's object
// (add missing headers, checksums, homomorphic hash) and sign id with
// session key. Session is established during 4-step handshake in one gRPC stream
//
// - First client stream message SHOULD BE type of `CreateRequest_Init`.
// - First server stream message SHOULD BE type of `CreateResponse_Unsigned`.
// - Second client stream message SHOULD BE type of `CreateRequest_Signed`.
// - Second server stream message SHOULD BE type of `CreateResponse_Result`.
Create(ctx context.Context, opts ...grpc.CallOption) (Session_CreateClient, 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 is a method that used to open a trusted session to manipulate
// an object. In order to put or delete object client have to obtain session
// token with trusted node. Trusted node will modify client's object
// (add missing headers, checksums, homomorphic hash) and sign id with
// session key. Session is established during 4-step handshake in one gRPC stream
//
// - First client stream message SHOULD BE type of `CreateRequest_Init`.
// - First server stream message SHOULD BE type of `CreateResponse_Unsigned`.
// - Second client stream message SHOULD BE type of `CreateRequest_Signed`.
// - Second server stream message SHOULD BE type of `CreateResponse_Result`.
Create(Session_CreateServer) error
}
SessionServer is the server API for Session service.
type Session_CreateClient ¶
type Session_CreateClient interface {
Send(*CreateRequest) error
Recv() (*CreateResponse, error)
grpc.ClientStream
}
type Session_CreateServer ¶
type Session_CreateServer interface {
Send(*CreateResponse) error
Recv() (*CreateRequest, error)
grpc.ServerStream
}
type Token ¶
type Token struct {
// Header carries verification data of session key
Header VerificationHeader `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header"`
// OwnerID is an owner of manipulation object
OwnerID OwnerID `protobuf:"bytes,2,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// FirstEpoch is an initial epoch of token lifetime
FirstEpoch uint64 `protobuf:"varint,3,opt,name=FirstEpoch,proto3" json:"FirstEpoch,omitempty"`
// LastEpoch is a last epoch of token lifetime
LastEpoch uint64 `protobuf:"varint,4,opt,name=LastEpoch,proto3" json:"LastEpoch,omitempty"`
// ObjectID is an object identifier of manipulation object
ObjectID []ObjectID `protobuf:"bytes,5,rep,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"`
// Signature is a token signature, signed by owner of manipulation object
Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"`
// ID is a token identifier. valid UUIDv4 represented in bytes
ID TokenID `protobuf:"bytes,7,opt,name=ID,proto3,customtype=TokenID" json:"ID"`
// PublicKeys associated with owner
PublicKeys [][]byte `protobuf:"bytes,8,rep,name=PublicKeys,proto3" json:"PublicKeys,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
User token granting rights for object manipulation
func (*Token) Descriptor ¶
func (*Token) GetFirstEpoch ¶
func (*Token) GetHeader ¶
func (m *Token) GetHeader() VerificationHeader
func (*Token) GetLastEpoch ¶
func (*Token) GetPublicKeys ¶
func (*Token) GetSignature ¶
func (*Token) ProtoMessage ¶
func (*Token) ProtoMessage()
func (*Token) SetPublicKeys ¶
SetPublicKeys sets owner's public keys to the token
func (*Token) Sign ¶
func (m *Token) Sign(key *ecdsa.PrivateKey) error
Sign tries to sign current Token data and stores signature inside it.
func (*Token) XXX_DiscardUnknown ¶
func (m *Token) XXX_DiscardUnknown()
func (*Token) XXX_Marshal ¶
func (*Token) XXX_Unmarshal ¶
type TokenParams ¶
type TokenParams struct {
FirstEpoch uint64
LastEpoch uint64
ObjectID []ObjectID
OwnerID OwnerID
PublicKeys [][]byte
}
TokenParams contains params to create new PToken.
type TokenStore ¶
type TokenStore interface {
// New returns new token with specified parameters.
New(p TokenParams) *PToken
// Fetch tries to fetch a token with specified id.
Fetch(id TokenID) *PToken
// Remove removes token with id from store.
Remove(id TokenID)
}
TokenStore is a PToken storage manipulation interface.
type UnimplementedSessionServer ¶
type UnimplementedSessionServer struct {
}
UnimplementedSessionServer can be embedded to have forward compatible implementations.
func (*UnimplementedSessionServer) Create ¶
func (*UnimplementedSessionServer) Create(srv Session_CreateServer) error
type VerificationHeader ¶
type VerificationHeader struct {
// PublicKey is a session public key
PublicKey []byte `protobuf:"bytes,1,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"`
// KeySignature is a session public key signature. Signed by trusted side
KeySignature []byte `protobuf:"bytes,2,opt,name=KeySignature,proto3" json:"KeySignature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*VerificationHeader) Descriptor ¶
func (*VerificationHeader) Descriptor() ([]byte, []int)
func (*VerificationHeader) GetKeySignature ¶
func (m *VerificationHeader) GetKeySignature() []byte
func (*VerificationHeader) GetPublicKey ¶
func (m *VerificationHeader) GetPublicKey() []byte
func (*VerificationHeader) Marshal ¶
func (m *VerificationHeader) Marshal() (dAtA []byte, err error)
func (*VerificationHeader) MarshalTo ¶
func (m *VerificationHeader) MarshalTo(dAtA []byte) (int, error)
func (*VerificationHeader) MarshalToSizedBuffer ¶
func (m *VerificationHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*VerificationHeader) ProtoMessage ¶
func (*VerificationHeader) ProtoMessage()
func (*VerificationHeader) Reset ¶
func (m *VerificationHeader) Reset()
func (*VerificationHeader) Sign ¶
func (m *VerificationHeader) Sign(key *ecdsa.PrivateKey) error
Sign signs contents of the header with the private key.
func (*VerificationHeader) Size ¶
func (m *VerificationHeader) Size() (n int)
func (*VerificationHeader) String ¶
func (m *VerificationHeader) String() string
func (*VerificationHeader) Unmarshal ¶
func (m *VerificationHeader) Unmarshal(dAtA []byte) error
func (*VerificationHeader) Verify ¶
func (m *VerificationHeader) Verify(keys ...*ecdsa.PublicKey) bool
Verify checks if verification header was issued by id.
func (*VerificationHeader) VerifyData ¶
func (m *VerificationHeader) VerifyData(data, sign []byte) error
VerifyData checks if signature of data by token is equal to sign.
func (*VerificationHeader) XXX_DiscardUnknown ¶
func (m *VerificationHeader) XXX_DiscardUnknown()
func (*VerificationHeader) XXX_Marshal ¶
func (m *VerificationHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*VerificationHeader) XXX_Merge ¶
func (m *VerificationHeader) XXX_Merge(src proto.Message)
func (*VerificationHeader) XXX_Size ¶
func (m *VerificationHeader) XXX_Size() int
func (*VerificationHeader) XXX_Unmarshal ¶
func (m *VerificationHeader) XXX_Unmarshal(b []byte) error