aboutsummaryrefslogtreecommitdiff
path: root/pkg/types
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/types')
-rw-r--r--pkg/types/ascii.go7
-rw-r--r--pkg/types/ascii_test.go6
-rw-r--r--pkg/types/types_test.go18
3 files changed, 15 insertions, 16 deletions
diff --git a/pkg/types/ascii.go b/pkg/types/ascii.go
index d27d79b..7643ab1 100644
--- a/pkg/types/ascii.go
+++ b/pkg/types/ascii.go
@@ -30,7 +30,7 @@ const (
// New leaf keys
ShardHint = "shard_hint"
Checksum = "checksum"
- SignatureOverMessage = "signature_over_message"
+ Signature = "signature"
VerificationKey = "verification_key"
DomainHint = "domain_hint"
@@ -54,7 +54,6 @@ const (
RootHash = "root_hash"
// Signature and signer-identity keys
- Signature = "signature"
KeyHash = "key_hash"
)
@@ -201,7 +200,7 @@ func (l *Leaf) MarshalASCII(w io.Writer) error {
if err := writeASCII(w, Checksum, hex.EncodeToString(l.Checksum[:])); err != nil {
return fmt.Errorf("writeASCII: %v", err)
}
- if err := writeASCII(w, SignatureOverMessage, hex.EncodeToString(l.Signature[:])); err != nil {
+ if err := writeASCII(w, Signature, hex.EncodeToString(l.Signature[:])); err != nil {
return fmt.Errorf("writeASCII: %v", err)
}
if err := writeASCII(w, KeyHash, hex.EncodeToString(l.KeyHash[:])); err != nil {
@@ -393,7 +392,7 @@ func (req *LeafRequest) UnmarshalASCII(r io.Reader) error {
if req.Checksum, err = msg.GetHash(Checksum); err != nil {
return fmt.Errorf("GetHash(Checksum): %v", err)
}
- if req.Signature, err = msg.GetSignature(SignatureOverMessage); err != nil {
+ if req.Signature, err = msg.GetSignature(Signature); err != nil {
return fmt.Errorf("GetSignature: %v", err)
}
if req.VerificationKey, err = msg.GetVerificationKey(VerificationKey); err != nil {
diff --git a/pkg/types/ascii_test.go b/pkg/types/ascii_test.go
index 92732f9..74a1e37 100644
--- a/pkg/types/ascii_test.go
+++ b/pkg/types/ascii_test.go
@@ -106,12 +106,12 @@ func TestLeafMarshalASCII(t *testing.T) {
// Leaf 1
ShardHint, Delim, 123, EOL,
Checksum, Delim, testBuffer32[:], EOL,
- SignatureOverMessage, Delim, testBuffer64[:], EOL,
+ Signature, Delim, testBuffer64[:], EOL,
KeyHash, Delim, testBuffer32[:], EOL,
// Leaf 2
ShardHint, Delim, 456, EOL,
Checksum, Delim, testBuffer32[:], EOL,
- SignatureOverMessage, Delim, testBuffer64[:], EOL,
+ Signature, Delim, testBuffer64[:], EOL,
KeyHash, Delim, testBuffer32[:], EOL,
))
buf := bytes.NewBuffer(nil)
@@ -399,7 +399,7 @@ func TestLeafRequestUnmarshalASCII(t *testing.T) {
"%s%s%d%s"+"%s%s%x%s"+"%s%s%x%s"+"%s%s%x%s"+"%s%s%s%s",
ShardHint, Delim, 123, EOL,
Checksum, Delim, testBuffer32[:], EOL,
- SignatureOverMessage, Delim, testBuffer64[:], EOL,
+ Signature, Delim, testBuffer64[:], EOL,
VerificationKey, Delim, testBuffer32[:], EOL,
DomainHint, Delim, "example.com", EOL,
)),
diff --git a/pkg/types/types_test.go b/pkg/types/types_test.go
index da89c59..a71d14b 100644
--- a/pkg/types/types_test.go
+++ b/pkg/types/types_test.go
@@ -5,42 +5,42 @@ import (
)
func TestEndpointPath(t *testing.T) {
- base, prefix, proto := "example.com", "log", "st/v0"
+ base, prefix, proto := "example.com", "log", "sigsum/v0"
for _, table := range []struct {
endpoint Endpoint
want string
}{
{
endpoint: EndpointAddLeaf,
- want: "example.com/log/st/v0/add-leaf",
+ want: "example.com/log/sigsum/v0/add-leaf",
},
{
endpoint: EndpointAddCosignature,
- want: "example.com/log/st/v0/add-cosignature",
+ want: "example.com/log/sigsum/v0/add-cosignature",
},
{
endpoint: EndpointGetTreeHeadLatest,
- want: "example.com/log/st/v0/get-tree-head-latest",
+ want: "example.com/log/sigsum/v0/get-tree-head-latest",
},
{
endpoint: EndpointGetTreeHeadToSign,
- want: "example.com/log/st/v0/get-tree-head-to-sign",
+ want: "example.com/log/sigsum/v0/get-tree-head-to-sign",
},
{
endpoint: EndpointGetTreeHeadCosigned,
- want: "example.com/log/st/v0/get-tree-head-cosigned",
+ want: "example.com/log/sigsum/v0/get-tree-head-cosigned",
},
{
endpoint: EndpointGetConsistencyProof,
- want: "example.com/log/st/v0/get-consistency-proof",
+ want: "example.com/log/sigsum/v0/get-consistency-proof",
},
{
endpoint: EndpointGetProofByHash,
- want: "example.com/log/st/v0/get-proof-by-hash",
+ want: "example.com/log/sigsum/v0/get-proof-by-hash",
},
{
endpoint: EndpointGetLeaves,
- want: "example.com/log/st/v0/get-leaves",
+ want: "example.com/log/sigsum/v0/get-leaves",
},
} {
if got, want := table.endpoint.Path(base+"/"+prefix+"/"+proto), table.want; got != want {