@@ -3,7 +3,7 @@ package main
33import (
44 "context"
55 "crypto/rand"
6- "encoding/base64 "
6+ "crypto/sha256 "
77 "encoding/json"
88 "fmt"
99 "html/template"
@@ -150,10 +150,11 @@ func TestCLIDirect(t *testing.T) {
150150
151151 // Compute VRF hash and proof
152152 vrfProof := srv .vrf .Prove ([]byte (testEmail ))
153- vrfHash := base64 .StdEncoding .EncodeToString (vrfProof .Hash ())
154153
155154 // Add to transparency log
156- entry := tessera .NewEntry (fmt .Appendf (nil , "%s\n %s\n " , vrfHash , testKey ))
155+ h := sha256 .New ()
156+ h .Write ([]byte (testKey ))
157+ entry := tessera .NewEntry (h .Sum (vrfProof .Hash ())) // vrf-r255(email) || SHA-256(pubkey)
157158 index , _ , err := srv .awaiter .Await (ctx , srv .appender .Add (ctx , entry ))
158159 if err != nil {
159160 t .Fatal (err )
@@ -219,10 +220,11 @@ func TestCLIDirect(t *testing.T) {
219220
220221 // Compute VRF hash and proof
221222 vrfProof := srv .vrf .Prove ([]byte (email ))
222- vrfHash := base64 .StdEncoding .EncodeToString (vrfProof .Hash ())
223223
224224 // Add to transparency log
225- entry := tessera .NewEntry (fmt .Appendf (nil , "%s\n %s\n " , vrfHash , testKey ))
225+ h := sha256 .New ()
226+ h .Write ([]byte (testKey ))
227+ entry := tessera .NewEntry (h .Sum (vrfProof .Hash ())) // vrf-r255(email) || SHA-256(pubkey)
226228 index , _ , err := srv .awaiter .Await (ctx , srv .appender .Add (ctx , entry ))
227229 if err != nil {
228230 t .Fatal (err )
@@ -562,10 +564,11 @@ func insertKeyCmd() script.Cmd {
562564
563565 // Compute VRF hash and proof
564566 vrfProof := globalEnv .server .vrf .Prove ([]byte (email ))
565- vrfHash := base64 .StdEncoding .EncodeToString (vrfProof .Hash ())
566567
567568 // Add to transparency log
568- entry := tessera .NewEntry (fmt .Appendf (nil , "%s\n %s\n " , vrfHash , pubkey ))
569+ h := sha256 .New ()
570+ h .Write ([]byte (pubkey ))
571+ entry := tessera .NewEntry (h .Sum (vrfProof .Hash ())) // vrf-r255(email) || SHA-256(pubkey)
569572 index , _ , err := globalEnv .server .awaiter .Await (ctx , globalEnv .server .appender .Add (ctx , entry ))
570573 if err != nil {
571574 return nil , fmt .Errorf ("failed to add to transparency log: %w" , err )
0 commit comments