forked from TrueCloudLab/frostfs-api-go
[#261] pkg/client: Provide signing key in call options
Allow to reuse underlying connection for requests with different key. If no key is specified the one provided on client creation is used. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
74769323be
commit
64505180b4
6 changed files with 49 additions and 27 deletions
|
@ -30,7 +30,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...
|
|||
opts[i].apply(&callOptions)
|
||||
}
|
||||
|
||||
w, err := owner.NEO3WalletFromPublicKey(&c.key.PublicKey)
|
||||
w, err := owner.NEO3WalletFromPublicKey(&callOptions.key.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func (c Client) createSessionV2(ctx context.Context, expiration uint64, opts ...
|
|||
req.SetBody(reqBody)
|
||||
req.SetMetaHeader(v2MetaHeaderFromOpts(callOptions))
|
||||
|
||||
err = v2signature.SignServiceMessage(c.key, req)
|
||||
err = v2signature.SignServiceMessage(callOptions.key, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue