github.com/onflow/flow-go@v0.33.17/consensus/hotstuff/helper/bls_key.go (about) 1 package helper 2 3 import ( 4 "crypto/rand" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 9 "github.com/onflow/flow-go/crypto" 10 ) 11 12 func MakeBLSKey(t *testing.T) crypto.PrivateKey { 13 seed := make([]byte, crypto.KeyGenSeedMinLen) 14 n, err := rand.Read(seed) 15 require.Equal(t, n, crypto.KeyGenSeedMinLen) 16 require.NoError(t, err) 17 privKey, err := crypto.GeneratePrivateKey(crypto.BLSBLS12381, seed) 18 require.NoError(t, err) 19 return privKey 20 }