Container can be created within a session, and should be signed.
Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`)
methods to carry session token (signature) in `Container` structure.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In order to prevent potential cross imports, container ID should be defined
in a separate package as a base type. A similar approach was used in the
NeoFS API design.
Create `pkg/container/id` package and replace container ID implementation to
it. Related API in `container` package is deprecated from now.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define `ContainerSessionContext` structure, implement getters / setters,
JSON and binary encoders, gRPC converters. Support new type of context in
SessionTokenBody message. Add test message generator and cover methods with
unit tests.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Implement `SessionToken_Body.SetContainerSessionContext` method. Implement
field setters on `ContainerSessionContext`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Since raw client initialization is
postponed until the first `Raw()` function
call, there is no need to init empty(
without options) raw client in constructor.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Add `WithTLSConfig` option to client.
If it is not nil then client will
try to open secured connection.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Allocate capacity instead of length of the slice to write the object payload
range since each chunk is written through `append`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
In `SendIntermediateResultRequestBody`
add nil check for `trust` field.
If true, allocate new `PeerToPeerTrust`.
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Change accepted/returned value type of `SetTrust` / `Trust` methods of
`SendIntermediateTrustPrm` structure to `reputation.PeerToPeerTrust`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define Go structures of `SendIntermediateResult` RPC-related messages from
reputation package of NeoFS API. Implement getters and setters of message
fields.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Define Go structures of all messages from reputation package of NeoFs API.
Implement getters and setters of message fields.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `Client` to be the wrapper over raw protobuf client. Provide public
method to get the underlying raw client. Change implementations of all
methods with the new approach of the RPC execution.
Additional changes:
* key replaced from `New` argument to `WithDefaultPrivateKey` option;
* `GetSelfBalance` is removed as non-viable;
* `GetEACLWithSignature` is removed, `GetEACL` returns `EACLWithSignature`;
* `AttachSessionToken` / `AttachBearerToken` are removed as non-viable;
* redundant options are removed.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>