aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2022-04-29 15:08:53 +0200
committerRasmus Dahlberg <rasmus@mullvad.net>2022-04-29 22:16:22 +0200
commitcb5c579ae46ee0570f2f32408e0427f989bd33ab (patch)
tree3848d1e492a8d947062494d935b432f25b352370 /pkg
parent26a04562c886dd1c46e738e29d2754631ff33992 (diff)
change 'preimage' to 'message'
Issue: #40
Diffstat (limited to 'pkg')
-rw-r--r--pkg/db/trillian.go2
-rw-r--r--pkg/db/trillian_test.go2
-rw-r--r--pkg/instance/handler_test.go6
-rw-r--r--pkg/instance/instance.go2
4 files changed, 6 insertions, 6 deletions
diff --git a/pkg/db/trillian.go b/pkg/db/trillian.go
index 34501b9..97f1305 100644
--- a/pkg/db/trillian.go
+++ b/pkg/db/trillian.go
@@ -26,7 +26,7 @@ func (c *TrillianClient) AddLeaf(ctx context.Context, req *requests.Leaf) error
leaf := types.Leaf{
Statement: types.Statement{
ShardHint: req.ShardHint,
- Checksum: *types.HashFn(req.Preimage[:]),
+ Checksum: *types.HashFn(req.Message[:]),
},
Signature: req.Signature,
KeyHash: *types.HashFn(req.VerificationKey[:]),
diff --git a/pkg/db/trillian_test.go b/pkg/db/trillian_test.go
index 0010e32..9a390a1 100644
--- a/pkg/db/trillian_test.go
+++ b/pkg/db/trillian_test.go
@@ -21,7 +21,7 @@ import (
func TestAddLeaf(t *testing.T) {
req := &requests.Leaf{
ShardHint: 0,
- Preimage: types.Hash{},
+ Message: types.Hash{},
Signature: types.Signature{},
VerificationKey: types.PublicKey{},
DomainHint: "example.com",
diff --git a/pkg/instance/handler_test.go b/pkg/instance/handler_test.go
index b3af666..0b81f6c 100644
--- a/pkg/instance/handler_test.go
+++ b/pkg/instance/handler_test.go
@@ -662,7 +662,7 @@ func mustHandle(t *testing.T, i Instance, e types.Endpoint) Handler {
return Handler{}
}
-func mustLeafBuffer(t *testing.T, shardHint uint64, preimage types.Hash, wantSig bool) io.Reader {
+func mustLeafBuffer(t *testing.T, shardHint uint64, message types.Hash, wantSig bool) io.Reader {
t.Helper()
vk, sk, err := ed25519.GenerateKey(rand.Reader)
@@ -671,7 +671,7 @@ func mustLeafBuffer(t *testing.T, shardHint uint64, preimage types.Hash, wantSig
}
msg := types.Statement{
ShardHint: shardHint,
- Checksum: *types.HashFn(preimage[:]),
+ Checksum: *types.HashFn(message[:]),
}
sig := ed25519.Sign(sk, msg.ToBinary())
if !wantSig {
@@ -680,7 +680,7 @@ func mustLeafBuffer(t *testing.T, shardHint uint64, preimage types.Hash, wantSig
return bytes.NewBufferString(fmt.Sprintf(
"%s=%d\n"+"%s=%x\n"+"%s=%x\n"+"%s=%x\n"+"%s=%s\n",
"shard_hint", shardHint,
- "preimage", preimage[:],
+ "message", message[:],
"signature", sig,
"verification_key", vk,
"domain_hint", "example.com",
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index 77f2e5b..18255a1 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -63,7 +63,7 @@ func (i *Instance) leafRequestFromHTTP(ctx context.Context, r *http.Request) (*r
}
stmt := types.Statement{
ShardHint: req.ShardHint,
- Checksum: *types.HashFn(req.Preimage[:]),
+ Checksum: *types.HashFn(req.Message[:]),
}
if !stmt.Verify(&req.VerificationKey, &req.Signature) {
return nil, fmt.Errorf("invalid signature")