github.com/line/ostracon@v1.0.10-0.20230328032236-7f20145f065d/crypto/vrf/vrf_coniks_test.go (about) 1 //go:build coniks 2 // +build coniks 3 4 package vrf 5 6 import ( 7 "bytes" 8 "testing" 9 10 "crypto/ed25519" 11 12 coniks "github.com/coniks-sys/coniks-go/crypto/vrf" 13 "github.com/stretchr/testify/require" 14 ) 15 16 func TestProveAndVerifyConiksByCryptoEd25519(t *testing.T) { 17 secret := [SEEDBYTES]byte{} 18 privateKey := ed25519.NewKeyFromSeed(secret[:]) 19 publicKey := privateKey.Public().(ed25519.PublicKey) 20 21 verified, err := proveAndVerify(t, privateKey, publicKey) 22 // 23 // "un-verified" when using crypto ed25519 24 // If you want to use coniks, you should use coniks ed25519 25 // 26 require.NoError(t, err) 27 require.False(t, verified) 28 } 29 30 func TestProveAndVerifyConiksByConiksEd25519(t *testing.T) { 31 secret := [SEEDBYTES]byte{} 32 privateKey, _ := coniks.GenerateKey(bytes.NewReader(secret[:])) 33 publicKey, _ := privateKey.Public() 34 35 verified, err := proveAndVerify(t, privateKey, publicKey) 36 // 37 // verified when using coniks ed25519 38 // 39 require.NoError(t, err) 40 require.True(t, verified) 41 }