aboutsummaryrefslogtreecommitdiff
path: root/types/types.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-06 11:06:17 +0200
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-06-06 11:06:17 +0200
commit0285454c34b0b3003bc8ede3e304b843ad949be8 (patch)
tree630b89c85defa3aaf8f4cc2037f31dab0f3d2cbd /types/types.go
parentebd9efbf32065baa261b2af1625991100ed23bf7 (diff)
added state manager with tests
Diffstat (limited to 'types/types.go')
-rw-r--r--types/types.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/types/types.go b/types/types.go
index 405c825..9ca7db8 100644
--- a/types/types.go
+++ b/types/types.go
@@ -2,11 +2,10 @@ package types
import (
"crypto"
- "fmt"
- "strings"
-
"crypto/ed25519"
"crypto/sha256"
+ "fmt"
+ "strings"
)
const (
@@ -138,7 +137,10 @@ func (th *TreeHead) Sign(signer crypto.Signer) (*SignedTreeHead, error) {
}
// Verify verifies the tree head signature using the log's signature scheme
-func (th *TreeHead) Verify(pub crypto.PublicKey) error { // TODO
+func (th *TreeHead) Verify(vk *[VerificationKeySize]byte, sig *[SignatureSize]byte) error {
+ if !ed25519.Verify(ed25519.PublicKey(vk[:]), th.Marshal(), sig[:]) {
+ return fmt.Errorf("invalid tree head signature")
+ }
return nil
}