From 25b2988690448fec5d6a0a054618e1560dffc1df Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 27 Mar 2024 19:38:32 +0400 Subject: [PATCH] *: Upgrade to the latest `github.com/nspcc-dev/neofs-sdk-go` revision It brings breaking (for good) changes which need to be adapted asap. New SDK also includes fix of numeric access rules' processing. Fixes #2785. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/util/sign_bearer.go | 11 +++++++++-- go.mod | 4 ++-- go.sum | 8 ++++---- pkg/services/tree/signature_test.go | 3 +-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cmd/neofs-cli/modules/util/sign_bearer.go b/cmd/neofs-cli/modules/util/sign_bearer.go index 9b022ca72c..b609c4fdda 100644 --- a/cmd/neofs-cli/modules/util/sign_bearer.go +++ b/cmd/neofs-cli/modules/util/sign_bearer.go @@ -6,7 +6,7 @@ import ( "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common" "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags" "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/key" - neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa" + "github.com/nspcc-dev/neofs-sdk-go/user" "github.com/spf13/cobra" ) @@ -38,7 +38,14 @@ func signBearerToken(cmd *cobra.Command, _ []string) { btok := common.ReadBearerToken(cmd, signFromFlag) pk := key.GetOrGenerate(cmd) - err := btok.Sign(neofsecdsa.SignerRFC6979(*pk)) + signer := user.NewAutoIDSignerRFC6979(*pk) + var zeroUsr user.ID + if issuer := btok.Issuer(); !issuer.Equals(zeroUsr) { + // issuer is already set, don't corrupt it + signer = user.NewSigner(signer, issuer) + } + + err := btok.Sign(signer) common.ExitOnErr(cmd, "", err) to := cmd.Flag(signToFlag).Value.String() diff --git a/go.mod b/go.mod index 28793754c6..716a7e0b76 100644 --- a/go.mod +++ b/go.mod @@ -16,9 +16,9 @@ require ( github.com/nspcc-dev/hrw/v2 v2.0.1 github.com/nspcc-dev/locode-db v0.6.0 github.com/nspcc-dev/neo-go v0.105.1 - github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240228163253-cb87bbd5e4eb + github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240305074711-35bc78d84dc4 github.com/nspcc-dev/neofs-contract v0.19.1 - github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240320182730-5b6b37a2d338 + github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240327164418-bed3d5986cab github.com/nspcc-dev/tzhash v1.8.0 github.com/olekukonko/tablewriter v0.0.5 github.com/panjf2000/ants/v2 v2.9.0 diff --git a/go.sum b/go.sum index 500ed12d30..defe866d1c 100644 --- a/go.sum +++ b/go.sum @@ -134,14 +134,14 @@ github.com/nspcc-dev/neo-go v0.105.1 h1:r0b2yIwLBi+ARBKU94gHL9oTFEB/XMJ0YlS2HN9Q github.com/nspcc-dev/neo-go v0.105.1/go.mod h1:GNh0cRALV/cuj+/xg2ZHDsrFbqcInqG7jjhqsLEnlNc= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240228093917-6a560b9a9559 h1:NHa8O7YldwrOXkZLe/lhs6k9Ay8AtbWk/ti1TBUZqug= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20240228093917-6a560b9a9559/go.mod h1:J/Mk6+nKeKSW4wygkZQFLQ6SkLOSGX5Ga0RuuuktEag= -github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240228163253-cb87bbd5e4eb h1:vvMxf818Ea2Ql+j9QX7zOlEXDrVlbAzR0DhGvrULilQ= -github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240228163253-cb87bbd5e4eb/go.mod h1:7Tm1NKEoUVVIUlkVwFrPh7GG5+Lmta2m7EGr4oVpBd8= +github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240305074711-35bc78d84dc4 h1:arN0Ypn+jawZpu1BND7TGRn44InAVIqKygndsx0y2no= +github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240305074711-35bc78d84dc4/go.mod h1:7Tm1NKEoUVVIUlkVwFrPh7GG5+Lmta2m7EGr4oVpBd8= github.com/nspcc-dev/neofs-contract v0.19.1 h1:U1Uh+MlzfkalO0kRJ2pADZyHrmAOroC6KLFjdWnTNR0= github.com/nspcc-dev/neofs-contract v0.19.1/go.mod h1:ZOGouuwuHpgvYkx/LCGufGncIzEUhYEO18LL4cWEbyw= github.com/nspcc-dev/neofs-crypto v0.4.1 h1:B6S0zXMWrVFlf/GlII6xKRGWU0VE7dHM+QkoKAO7AQA= github.com/nspcc-dev/neofs-crypto v0.4.1/go.mod h1:0SHn+sSn+lrrIvonLR8MgbOlBhXZKhc4rw/l2htYeA0= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240320182730-5b6b37a2d338 h1:MIOkxFQCxZCRL34hRdmwx+SyljvhXSAqBC1IujH5kdA= -github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240320182730-5b6b37a2d338/go.mod h1:y4oCltutxqnAAsXPKSNarCIp2fWY9keyZW6ZqNzyrEs= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240327164418-bed3d5986cab h1:KKWygIAtS5x59zBa8TvPX4rX+fikkVdhVxl/p4c370s= +github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20240327164418-bed3d5986cab/go.mod h1:2XHytVt+AFQkwr6vpcYvdm13mA2rZxB+STrxtwSrtx8= github.com/nspcc-dev/rfc6979 v0.2.1 h1:8wWxkamHWFmO790GsewSoKUSJjVnL1fmdRpokU/RgRM= github.com/nspcc-dev/rfc6979 v0.2.1/go.mod h1:Tk7h5kyUWkhjyO3zUgFFhy1v2vQv3BvQEntakdtqrWc= github.com/nspcc-dev/tzhash v1.8.0 h1:pJvzME2mZzP/h5rcy/Wb6amT9FJBFeKbJ3HEnWEeUpY= diff --git a/pkg/services/tree/signature_test.go b/pkg/services/tree/signature_test.go index 20cd0bea47..6298d0629a 100644 --- a/pkg/services/tree/signature_test.go +++ b/pkg/services/tree/signature_test.go @@ -14,7 +14,6 @@ import ( "github.com/nspcc-dev/neofs-sdk-go/container/acl" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test" - neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa" eaclSDK "github.com/nspcc-dev/neofs-sdk-go/eacl" netmapSDK "github.com/nspcc-dev/neofs-sdk-go/netmap" "github.com/nspcc-dev/neofs-sdk-go/user" @@ -77,7 +76,7 @@ func TestMessageSign(t *testing.T) { cid1 := cidtest.ID() cid2 := cidtest.ID() - signer := neofsecdsa.SignerRFC6979(privs[0].PrivateKey) + signer := user.NewAutoIDSignerRFC6979(privs[0].PrivateKey) ownerID := user.ResolveFromECDSAPublicKey(privs[0].PrivateKey.PublicKey)