aboutsummaryrefslogtreecommitdiff
path: root/pkg/types/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/types/types.go')
-rw-r--r--pkg/types/types.go37
1 files changed, 10 insertions, 27 deletions
diff --git a/pkg/types/types.go b/pkg/types/types.go
index 96e2b18..bc58c98 100644
--- a/pkg/types/types.go
+++ b/pkg/types/types.go
@@ -32,78 +32,67 @@ func (e Endpoint) Path(components ...string) string {
return strings.Join(append(components, string(e)), "/")
}
-// Leaf is the log's Merkle tree leaf.
type Leaf struct {
Message
SigIdent
}
-// Message is composed of a shard hint and a checksum. The submitter selects
-// these values to fit the log's shard interval and the opaque data in question.
type Message struct {
ShardHint uint64
Checksum *[HashSize]byte
}
-// SigIdent is composed of a signature-signer pair. The signature is computed
-// over the Trunnel-serialized leaf message. KeyHash identifies the signer.
type SigIdent struct {
Signature *[SignatureSize]byte
KeyHash *[HashSize]byte
}
-// SignedTreeHead is composed of a tree head and a list of signature-signer
-// pairs. Each signature is computed over the Trunnel-serialized tree head.
type SignedTreeHead struct {
TreeHead
+ Signature *[SignatureSize]byte
+}
+
+type CosignedTreeHead struct {
+ SignedTreeHead
SigIdent []*SigIdent
}
-// TreeHead is the log's tree head.
type TreeHead struct {
Timestamp uint64
TreeSize uint64
RootHash *[HashSize]byte
+ KeyHash *[HashSize]byte
}
-// ConsistencyProof is a consistency proof that proves the log's append-only
-// property.
type ConsistencyProof struct {
NewSize uint64
OldSize uint64
Path []*[HashSize]byte
}
-// InclusionProof is an inclusion proof that proves a leaf is included in the
-// log.
type InclusionProof struct {
TreeSize uint64
LeafIndex uint64
Path []*[HashSize]byte
}
-// LeafList is a list of leaves
type LeafList []*Leaf
-// ConsistencyProofRequest is a get-consistency-proof request
type ConsistencyProofRequest struct {
NewSize uint64
OldSize uint64
}
-// InclusionProofRequest is a get-proof-by-hash request
type InclusionProofRequest struct {
LeafHash *[HashSize]byte
TreeSize uint64
}
-// LeavesRequest is a get-leaves request
type LeavesRequest struct {
StartSize uint64
EndSize uint64
}
-// LeafRequest is an add-leaf request
type LeafRequest struct {
Message
Signature *[SignatureSize]byte
@@ -111,7 +100,6 @@ type LeafRequest struct {
DomainHint string
}
-// CosignatureRequest is an add-cosignature request
type CosignatureRequest struct {
SigIdent
}
@@ -123,17 +111,12 @@ func (th *TreeHead) Sign(signer crypto.Signer) (*SignedTreeHead, error) {
return nil, fmt.Errorf("Sign: %v", err)
}
- sigident := SigIdent{
- KeyHash: Hash(signer.Public().(ed25519.PublicKey)[:]),
+ sth := &SignedTreeHead{
+ TreeHead: *th,
Signature: &[SignatureSize]byte{},
}
- copy(sigident.Signature[:], sig)
- return &SignedTreeHead{
- TreeHead: *th,
- SigIdent: []*SigIdent{
- &sigident,
- },
- }, nil
+ copy(sth.Signature[:], sig)
+ return sth, nil
}
// Verify verifies the tree head signature using the log's signature scheme