[#169] sdk/client: Do not resign session token

In some cases SDK Client provided with signed and prepared
session token. In this case we don't need to change verb
or sign it.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-14 20:06:05 +03:00 committed by Alex Vanin
parent d3e3889425
commit 7b3736567c
2 changed files with 16 additions and 1 deletions

View file

@ -1,6 +1,7 @@
package token
import (
"github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/v2/session"
)
@ -68,3 +69,10 @@ func (t *SessionToken) SetSessionKey(v []byte) {
body.SetSessionKey(v)
})
}
func (t *SessionToken) Signature() *pkg.Signature {
return pkg.NewSignatureFromV2(
(*session.SessionToken)(t).
GetSignature(),
)
}