github.com/sunrise-zone/sunrise-node@v0.13.1-sr2/share/ipld/test_helpers.go (about) 1 package ipld 2 3 import ( 4 "crypto/rand" 5 "testing" 6 7 "github.com/ipfs/go-cid" 8 "github.com/stretchr/testify/require" 9 ) 10 11 func RandNamespacedCID(t *testing.T) cid.Cid { 12 raw := make([]byte, NmtHashSize) 13 _, err := rand.Read(raw) 14 require.NoError(t, err) 15 id, err := CidFromNamespacedSha256(raw) 16 require.NoError(t, err) 17 return id 18 }