Documentation ¶
Index ¶
- func ApplyToAllContainers(c *ContainerContext)
- type ContainerContext
- func (x *ContainerContext) ApplyTo(id *cid.ID)
- func (x *ContainerContext) Container() *cid.ID
- func (x *ContainerContext) ForDelete()
- func (x *ContainerContext) ForPut()
- func (x *ContainerContext) ForSetEACL()
- func (x *ContainerContext) IsForDelete() bool
- func (x *ContainerContext) IsForPut() bool
- func (x *ContainerContext) IsForSetEACL() bool
- func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error)
- func (x *ContainerContext) MarshalJSON() ([]byte, error)
- func (x *ContainerContext) ToV2() *session.ContainerSessionContext
- func (x *ContainerContext) Unmarshal(data []byte) error
- func (x *ContainerContext) UnmarshalJSON(data []byte) error
- type Token
- func (t *Token) Context() interface{}
- func (t *Token) Exp() uint64
- func (t *Token) ID() []byte
- func (t *Token) Iat() uint64
- func (t *Token) Marshal(bs ...[]byte) ([]byte, error)
- func (t *Token) MarshalJSON() ([]byte, error)
- func (t *Token) Nbf() uint64
- func (t *Token) OwnerID() *owner.ID
- func (t *Token) SessionKey() []byte
- func (t *Token) SetContext(v interface{})
- func (t *Token) SetExp(exp uint64)
- func (t *Token) SetID(v []byte)
- func (t *Token) SetIat(iat uint64)
- func (t *Token) SetNbf(nbf uint64)
- func (t *Token) SetOwnerID(v *owner.ID)
- func (t *Token) SetSessionKey(v []byte)
- func (t *Token) SignECDSA(key ecdsa.PrivateKey) error
- func (t *Token) Signature() *pkg.Signature
- func (t *Token) ToV2() *session.SessionToken
- func (t *Token) Unmarshal(data []byte) error
- func (t *Token) UnmarshalJSON(data []byte) error
- func (t *Token) VerifySignature() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyToAllContainers ¶
func ApplyToAllContainers(c *ContainerContext)
ActOnAllContainers is a helper function that conveniently applies ContainerContext to all containers.
Types ¶
type ContainerContext ¶
type ContainerContext session.ContainerSessionContext
ContainerContext represents NeoFS API v2-compatible context of the container session.
It is a wrapper over session.ContainerSessionContext which allows to abstract from details of the message structure.
func ContainerContextFromV2 ¶
func ContainerContextFromV2(v *session.ContainerSessionContext) *ContainerContext
ContainerContextFromV2 wraps session.ContainerSessionContext into ContainerContext.
func GetContainerContext ¶
func GetContainerContext(t *Token) *ContainerContext
GetContainerContext is a helper function that casts Token context to ContainerContext.
Returns nil if context is not a ContainerContext.
func NewContainerContext ¶
func NewContainerContext() *ContainerContext
NewContainerContext creates and returns blank ContainerSessionContext.
Defaults:
- not bound to any operation;
- applied to all containers.
func (*ContainerContext) ApplyTo ¶
func (x *ContainerContext) ApplyTo(id *cid.ID)
ApplyTo specifies which container the ContainerContext applies to.
If id is nil, ContainerContext is applied to all containers.
func (*ContainerContext) Container ¶
func (x *ContainerContext) Container() *cid.ID
Container returns identifier of the container to which the ContainerContext applies.
Returns nil if ContainerContext is applied to all containers.
func (*ContainerContext) ForDelete ¶
func (x *ContainerContext) ForDelete()
ForDelete binds the ContainerContext to DELETE operation.
func (*ContainerContext) ForPut ¶
func (x *ContainerContext) ForPut()
ForPut binds the ContainerContext to PUT operation.
func (*ContainerContext) ForSetEACL ¶
func (x *ContainerContext) ForSetEACL()
ForSetEACL binds the ContainerContext to SETEACL operation.
func (*ContainerContext) IsForDelete ¶
func (x *ContainerContext) IsForDelete() bool
IsForDelete checks if ContainerContext is bound to DELETE operation.
func (*ContainerContext) IsForPut ¶
func (x *ContainerContext) IsForPut() bool
IsForPut checks if ContainerContext is bound to PUT operation.
func (*ContainerContext) IsForSetEACL ¶
func (x *ContainerContext) IsForSetEACL() bool
IsForSetEACL checks if ContainerContext is bound to SETEACL operation.
func (*ContainerContext) Marshal ¶
func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error)
Marshal marshals ContainerContext into a protobuf binary form.
func (*ContainerContext) MarshalJSON ¶
func (x *ContainerContext) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContainerContext to protobuf JSON format.
func (*ContainerContext) ToV2 ¶
func (x *ContainerContext) ToV2() *session.ContainerSessionContext
ToV2 converts ContainerContext to session.ContainerSessionContext message structure.
func (*ContainerContext) Unmarshal ¶
func (x *ContainerContext) Unmarshal(data []byte) error
Unmarshal unmarshals protobuf binary representation of ContainerContext.
func (*ContainerContext) UnmarshalJSON ¶
func (x *ContainerContext) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContainerContext from protobuf JSON format.
type Token ¶
type Token session.SessionToken
Token represents NeoFS API v2-compatible session token.
func NewToken ¶
func NewToken() *Token
NewToken creates and returns blank Token.
Defaults:
- body: nil;
- id: nil;
- ownerId: nil;
- sessionKey: nil;
- exp: 0;
- iat: 0;
- nbf: 0;
func NewTokenFromV2 ¶
func NewTokenFromV2(tV2 *session.SessionToken) *Token
NewTokenFromV2 wraps session.SessionToken message structure into Token.
Nil session.SessionToken converts to nil.
func (*Token) Context ¶
func (t *Token) Context() interface{}
Context returns context of the Token.
Supports same contexts as SetContext.
Returns nil if context is not supported.
func (*Token) Marshal ¶
Marshal marshals Token into a protobuf binary form.
Buffer is allocated when the argument is empty. Otherwise, the first buffer is used.
func (*Token) MarshalJSON ¶
MarshalJSON encodes Token to protobuf JSON format.
func (*Token) SessionKey ¶
SessionKey returns public key of the session in a binary format.
func (*Token) SetContext ¶
func (t *Token) SetContext(v interface{})
SetContext sets context of the Token.
Supported contexts:
- *ContainerContext.
Resets context if it is not supported.
func (*Token) SetOwnerID ¶
SetOwnerID sets Token's owner identifier.
func (*Token) SetSessionKey ¶
SetSessionKey sets public key of the session in a binary format.
func (*Token) SignECDSA ¶
func (t *Token) SignECDSA(key ecdsa.PrivateKey) error
SignECDSA calculates and writes ECDSA signature of the Token data.
Returns signature calculation errors.
func (*Token) ToV2 ¶
func (t *Token) ToV2() *session.SessionToken
ToV2 converts Token to session.SessionToken message structure.
Nil Token converts to nil.
func (*Token) UnmarshalJSON ¶
UnmarshalJSON decodes Token from protobuf JSON format.
func (*Token) VerifySignature ¶
VerifySignature checks if token signature is presented and valid.