github.com/koko1123/flow-go-1@v0.29.6/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.KeyGenSeedMinLenBLSBLS12381) 14 n, err := rand.Read(seed) 15 require.Equal(t, n, crypto.KeyGenSeedMinLenBLSBLS12381) 16 require.NoError(t, err) 17 privKey, err := crypto.GeneratePrivateKey(crypto.BLSBLS12381, seed) 18 require.NoError(t, err) 19 return privKey 20 }