diff --git a/pkg/owner/test/id.go b/pkg/owner/test/id.go new file mode 100644 index 00000000..f542cf14 --- /dev/null +++ b/pkg/owner/test/id.go @@ -0,0 +1,27 @@ +package ownertest + +import ( + "math/rand" + + "github.com/nspcc-dev/neofs-api-go/pkg/owner" + "github.com/nspcc-dev/neofs-api-go/v2/refs" +) + +// Generate returns owner.ID calculated +// from a random owner.NEO3Wallet. +func Generate() *owner.ID { + data := make([]byte, owner.NEO3WalletSize) + + rand.Read(data) + + return GenerateFromBytes(data) +} + +// GenerateFromBytes returns owner.ID generated +// from a passed byte slice. +func GenerateFromBytes(val []byte) *owner.ID { + idV2 := new(refs.OwnerID) + idV2.SetValue(val) + + return owner.NewIDFromV2(idV2) +}