[#56] Update to latest neofs-api-go changes

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-29 15:35:15 +03:00 committed by Alex Vanin
parent fc74e9b40c
commit 12d57af998
3 changed files with 5 additions and 19 deletions

2
go.mod
View file

@ -13,7 +13,7 @@ require (
github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2 github.com/multiformats/go-multiaddr-net v0.1.2 // v0.1.1 => v0.1.2
github.com/multiformats/go-multihash v0.0.13 // indirect github.com/multiformats/go-multihash v0.0.13 // indirect
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78 github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200925143744-2cc58e36f8d7 github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200929122641-420d9560625b
github.com/nspcc-dev/neofs-crypto v0.3.0 github.com/nspcc-dev/neofs-crypto v0.3.0
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.3.0 github.com/panjf2000/ants/v2 v2.3.0

6
go.sum
View file

@ -270,10 +270,8 @@ github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:
github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc=
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78 h1:stIa+nBXK8uDY/JZaxIZzAUfkzfaotVw2FbnHxO4aZI= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78 h1:stIa+nBXK8uDY/JZaxIZzAUfkzfaotVw2FbnHxO4aZI=
github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc= github.com/nspcc-dev/neo-go v0.91.1-pre.0.20200827184617-7560aa345a78/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc=
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200925125840-c814cc62faf4 h1:+ko1UlGsPhKF6O1+ZDOwW7lNhXLEk+e/N/gdma5NNJo= github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200929122641-420d9560625b h1:zcfzW992l3ohrnLnRd6449vooUqHggGppLYSwcPc2vA=
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200925125840-c814cc62faf4/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4= github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200929122641-420d9560625b/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4=
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200925143744-2cc58e36f8d7 h1:7/Dh5Mkk0uJD99EULqYvxULrUVtzN6Kn+KvmFuafE74=
github.com/nspcc-dev/neofs-api-go v1.3.1-0.20200925143744-2cc58e36f8d7/go.mod h1:FsFd1z4YzoEgPlltsUgnqna9qhcF87RHYjot0pby2L4=
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA= github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=

View file

@ -58,7 +58,7 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
if par := f.obj.GetParent(); par != nil && par.ToV2().GetHeader() != nil { if par := f.obj.GetParent(); par != nil && par.ToV2().GetHeader() != nil {
rawPar := objectSDK.NewRawFromV2(par.ToV2()) rawPar := objectSDK.NewRawFromV2(par.ToV2())
if err := setIDAndSignature(f.key, rawPar); err != nil { if err := objectSDK.SetIDWithSignature(f.key, rawPar); err != nil {
return nil, errors.Wrap(err, "could not finalize parent object") return nil, errors.Wrap(err, "could not finalize parent object")
} }
@ -67,7 +67,7 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
f.obj.SetParent(rawPar.Object()) f.obj.SetParent(rawPar.Object())
} }
if err := setIDAndSignature(f.key, f.obj.SDK()); err != nil { if err := objectSDK.SetIDWithSignature(f.key, f.obj.SDK()); err != nil {
return nil, errors.Wrap(err, "could not finalize object") return nil, errors.Wrap(err, "could not finalize object")
} }
@ -83,15 +83,3 @@ func (f *formatter) Close() (*AccessIdentifiers, error) {
WithSelfID(f.obj.GetID()). WithSelfID(f.obj.GetID()).
WithParentID(parID), nil WithParentID(parID), nil
} }
func setIDAndSignature(key *ecdsa.PrivateKey, obj *objectSDK.RawObject) error {
if err := objectSDK.CalculateAndSetID(obj); err != nil {
return errors.Wrap(err, "could not set identifier")
}
if err := objectSDK.CalculateAndSetSignature(key, obj); err != nil {
return errors.Wrap(err, "could not set signature")
}
return nil
}