diff --git a/cmd/neofs-rest-gw/integration_test.go b/cmd/neofs-rest-gw/integration_test.go index 3f113a7..2de6e15 100644 --- a/cmd/neofs-rest-gw/integration_test.go +++ b/cmd/neofs-rest-gw/integration_test.go @@ -741,7 +741,7 @@ func signToken(t *testing.T, key *keys.PrivateKey, data []byte) *handlers.Bearer return &handlers.BearerToken{ Token: base64.StdEncoding.EncodeToString(data), - Signature: base64.StdEncoding.EncodeToString(sign), + Signature: hex.EncodeToString(sign), Key: hex.EncodeToString(key.PublicKey().Bytes()), } } @@ -752,7 +752,7 @@ func signTokenWalletConnect(t *testing.T, key *keys.PrivateKey, data []byte) *ha return &handlers.BearerToken{ Token: base64.StdEncoding.EncodeToString(data), - Signature: base64.StdEncoding.EncodeToString(append(sm.Data, sm.Salt...)), + Signature: hex.EncodeToString(append(sm.Data, sm.Salt...)), Key: hex.EncodeToString(key.PublicKey().Bytes()), } } diff --git a/handlers/auth_test.go b/handlers/auth_test.go index 09c5b89..eae1b2a 100644 --- a/handlers/auth_test.go +++ b/handlers/auth_test.go @@ -58,7 +58,7 @@ func TestSign(t *testing.T) { bt := &BearerToken{ Token: bearerBase64, - Signature: base64.StdEncoding.EncodeToString(signatureData), + Signature: hex.EncodeToString(signatureData), Key: pubKeyHex, } diff --git a/handlers/containers.go b/handlers/containers.go index d404ee8..ad8fa50 100644 --- a/handlers/containers.go +++ b/handlers/containers.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "encoding/base64" + "encoding/hex" "fmt" "net/http" "strconv" @@ -359,7 +360,7 @@ func prepareSessionToken(bt *BearerToken, isWalletConnect bool) (*session.Token, return nil, fmt.Errorf("can't base64-decode bearer token: %w", err) } - signature, err := base64.StdEncoding.DecodeString(bt.Signature) + signature, err := hex.DecodeString(bt.Signature) if err != nil { return nil, fmt.Errorf("couldn't decode bearer signature: %w", err) } diff --git a/handlers/objects.go b/handlers/objects.go index 91e44c9..24249db 100644 --- a/handlers/objects.go +++ b/handlers/objects.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ecdsa" "encoding/base64" + "encoding/hex" "fmt" "io" "strings" @@ -337,7 +338,7 @@ func prepareBearerToken(bt *BearerToken, isWalletConnect bool) (*token.BearerTok return nil, fmt.Errorf("can't base64-decode bearer token: %w", err) } - signature, err := base64.StdEncoding.DecodeString(bt.Signature) + signature, err := hex.DecodeString(bt.Signature) if err != nil { return nil, fmt.Errorf("couldn't decode bearer signature: %w", err) }