aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/client.go2
-rw-r--r--handler_test.go20
-rw-r--r--instance.go14
-rw-r--r--instance_test.go12
-rw-r--r--reqres_test.go2
5 files changed, 25 insertions, 25 deletions
diff --git a/client/client.go b/client/client.go
index 0cbf432..3bd4f50 100644
--- a/client/client.go
+++ b/client/client.go
@@ -89,7 +89,7 @@ func (c *Client) AddEntry(ctx context.Context, name, checksum []byte) (*stfe.StI
// GetSth fetches and verifies the most recent STH.
func (c *Client) GetSth(ctx context.Context) (*stfe.StItem, error) {
- url := stfe.EndpointGetSth.Path(c.protocol() + c.Log.BaseUrl)
+ url := stfe.EndpointGetLatestSth.Path(c.protocol() + c.Log.BaseUrl)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, fmt.Errorf("failed creating http request: %v", err)
diff --git a/handler_test.go b/handler_test.go
index 0d9a856..804ef67 100644
--- a/handler_test.go
+++ b/handler_test.go
@@ -60,13 +60,13 @@ func newTestHandler(t *testing.T, signer crypto.Signer, sth *StItem) *testHandle
func (th *testHandler) getHandlers(t *testing.T) map[Endpoint]Handler {
return map[Endpoint]Handler{
- EndpointGetSth: Handler{instance: th.instance, handler: getSth, endpoint: EndpointGetSth, method: http.MethodGet},
+ EndpointGetLatestSth: Handler{instance: th.instance, handler: getSth, endpoint: EndpointGetLatestSth, method: http.MethodGet},
EndpointGetConsistencyProof: Handler{instance: th.instance, handler: getConsistencyProof, endpoint: EndpointGetConsistencyProof, method: http.MethodGet},
EndpointGetProofByHash: Handler{instance: th.instance, handler: getProofByHash, endpoint: EndpointGetProofByHash, method: http.MethodGet},
EndpointGetAnchors: Handler{instance: th.instance, handler: getAnchors, endpoint: EndpointGetAnchors, method: http.MethodGet},
EndpointGetEntries: Handler{instance: th.instance, handler: getEntries, endpoint: EndpointGetEntries, method: http.MethodGet},
EndpointGetStableSth: Handler{instance: th.instance, handler: getStableSth, endpoint: EndpointGetStableSth, method: http.MethodGet},
- EndpointGetCosi: Handler{instance: th.instance, handler: getCosi, endpoint: EndpointGetCosi, method: http.MethodGet},
+ EndpointGetCosignedSth: Handler{instance: th.instance, handler: getCosi, endpoint: EndpointGetCosignedSth, method: http.MethodGet},
}
}
@@ -80,8 +80,8 @@ func (th *testHandler) getHandler(t *testing.T, endpoint Endpoint) Handler {
func (th *testHandler) postHandlers(t *testing.T) map[Endpoint]Handler {
return map[Endpoint]Handler{
- EndpointAddEntry: Handler{instance: th.instance, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
- EndpointAddCosi: Handler{instance: th.instance, handler: addCosi, endpoint: EndpointAddCosi, method: http.MethodPost},
+ EndpointAddEntry: Handler{instance: th.instance, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
+ EndpointAddCosignature: Handler{instance: th.instance, handler: addCosi, endpoint: EndpointAddCosignature, method: http.MethodPost},
}
}
@@ -414,7 +414,7 @@ func TestGetSth(t *testing.T) {
th := newTestHandler(t, table.signer, nil)
defer th.mockCtrl.Finish()
- url := EndpointGetSth.Path("http://example.com", th.instance.LogParameters.Prefix)
+ url := EndpointGetLatestSth.Path("http://example.com", th.instance.LogParameters.Prefix)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
t.Fatalf("failed creating http request: %v", err)
@@ -422,7 +422,7 @@ func TestGetSth(t *testing.T) {
w := httptest.NewRecorder()
th.client.EXPECT().GetLatestSignedLogRoot(newDeadlineMatcher(), gomock.Any()).Return(table.trsp, table.terr)
- th.getHandler(t, EndpointGetSth).ServeHTTP(w, req)
+ th.getHandler(t, EndpointGetLatestSth).ServeHTTP(w, req)
if w.Code != table.wantCode {
t.Errorf("GET(%s)=%d, want http status code %d", url, w.Code, table.wantCode)
}
@@ -733,13 +733,13 @@ func TestGetCosi(t *testing.T) {
defer th.mockCtrl.Finish()
// Setup and run client query
- url := EndpointGetCosi.Path("http://example.com", th.instance.LogParameters.Prefix)
+ url := EndpointGetCosignedSth.Path("http://example.com", th.instance.LogParameters.Prefix)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
t.Fatalf("failed creating http request: %v", err)
}
w := httptest.NewRecorder()
- th.getHandler(t, EndpointGetCosi).ServeHTTP(w, req)
+ th.getHandler(t, EndpointGetCosignedSth).ServeHTTP(w, req)
// Check response code
if w.Code != table.wantCode {
@@ -801,7 +801,7 @@ func TestAddCosi(t *testing.T) {
defer th.mockCtrl.Finish()
// Setup and run client query
- url := EndpointAddCosi.Path("http://example.com", th.instance.LogParameters.Prefix)
+ url := EndpointAddCosignature.Path("http://example.com", th.instance.LogParameters.Prefix)
req, err := http.NewRequest("POST", url, table.breq)
if err != nil {
t.Fatalf("failed creating http request: %v", err)
@@ -809,7 +809,7 @@ func TestAddCosi(t *testing.T) {
req.Header.Set("Content-Type", "application/json")
w := httptest.NewRecorder()
- th.postHandler(t, EndpointAddCosi).ServeHTTP(w, req)
+ th.postHandler(t, EndpointAddCosignature).ServeHTTP(w, req)
if w.Code != table.wantCode {
t.Errorf("GET(%s)=%d, want http status code %d", url, w.Code, table.wantCode)
}
diff --git a/instance.go b/instance.go
index a67307f..c729bc8 100644
--- a/instance.go
+++ b/instance.go
@@ -38,14 +38,14 @@ type Endpoint string
const (
EndpointAddEntry = Endpoint("add-entry")
- EndpointAddCosi = Endpoint("add-cosi") // TODO: name?
+ EndpointAddCosignature = Endpoint("add-cosignature")
EndpointGetEntries = Endpoint("get-entries")
EndpointGetAnchors = Endpoint("get-anchors")
EndpointGetProofByHash = Endpoint("get-proof-by-hash")
EndpointGetConsistencyProof = Endpoint("get-consistency-proof")
- EndpointGetSth = Endpoint("get-sth")
- EndpointGetStableSth = Endpoint("get-stable-sth") // TODO: name?
- EndpointGetCosi = Endpoint("get-cosi") // TODO: name?
+ EndpointGetLatestSth = Endpoint("get-latest-sth")
+ EndpointGetStableSth = Endpoint("get-stable-sth")
+ EndpointGetCosignedSth = Endpoint("get-cosigned-sth")
)
func (i Instance) String() string {
@@ -100,14 +100,14 @@ func NewLogParameters(signer crypto.Signer, logId *namespace.Namespace, treeId i
func (i *Instance) Handlers() []Handler {
return []Handler{
Handler{instance: i, handler: addEntry, endpoint: EndpointAddEntry, method: http.MethodPost},
- Handler{instance: i, handler: addCosi, endpoint: EndpointAddCosi, method: http.MethodPost},
+ Handler{instance: i, handler: addCosi, endpoint: EndpointAddCosignature, method: http.MethodPost},
Handler{instance: i, handler: getEntries, endpoint: EndpointGetEntries, method: http.MethodGet},
Handler{instance: i, handler: getAnchors, endpoint: EndpointGetAnchors, method: http.MethodGet},
Handler{instance: i, handler: getProofByHash, endpoint: EndpointGetProofByHash, method: http.MethodGet},
Handler{instance: i, handler: getConsistencyProof, endpoint: EndpointGetConsistencyProof, method: http.MethodGet},
- Handler{instance: i, handler: getSth, endpoint: EndpointGetSth, method: http.MethodGet},
+ Handler{instance: i, handler: getSth, endpoint: EndpointGetLatestSth, method: http.MethodGet},
Handler{instance: i, handler: getStableSth, endpoint: EndpointGetStableSth, method: http.MethodGet},
- Handler{instance: i, handler: getCosi, endpoint: EndpointGetCosi, method: http.MethodGet},
+ Handler{instance: i, handler: getCosi, endpoint: EndpointGetCosignedSth, method: http.MethodGet},
}
}
diff --git a/instance_test.go b/instance_test.go
index 50302fb..43404f2 100644
--- a/instance_test.go
+++ b/instance_test.go
@@ -124,13 +124,13 @@ func TestHandlers(t *testing.T) {
endpoints := map[Endpoint]bool{
EndpointAddEntry: false,
EndpointGetEntries: false,
- EndpointGetSth: false,
+ EndpointGetLatestSth: false,
EndpointGetProofByHash: false,
EndpointGetConsistencyProof: false,
EndpointGetAnchors: false,
EndpointGetStableSth: false,
- EndpointGetCosi: false,
- EndpointAddCosi: false,
+ EndpointGetCosignedSth: false,
+ EndpointAddCosignature: false,
}
i := NewInstance(makeTestLogParameters(t, nil), nil, nil)
for _, handler := range i.Handlers() {
@@ -170,7 +170,7 @@ func TestEndpointPath(t *testing.T) {
want: "http://example.com/test/get-consistency-proof",
},
{
- endpoint: EndpointGetSth,
+ endpoint: EndpointGetLatestSth,
want: "http://example.com/test/get-sth",
},
{
@@ -182,11 +182,11 @@ func TestEndpointPath(t *testing.T) {
want: "http://example.com/test/get-stable-sth",
},
{
- endpoint: EndpointGetCosi,
+ endpoint: EndpointGetCosignedSth,
want: "http://example.com/test/get-cosi",
},
{
- endpoint: EndpointAddCosi,
+ endpoint: EndpointAddCosignature,
want: "http://example.com/test/add-cosi",
},
} {
diff --git a/reqres_test.go b/reqres_test.go
index ce0c7b6..7c3b455 100644
--- a/reqres_test.go
+++ b/reqres_test.go
@@ -35,7 +35,7 @@ func TestNewAddCosignatureRequest(t *testing.T) {
breq: mustMakeAddCosiBuffer(t, testdata.Ed25519Sk, testdata.Ed25519Vk, validSth),
},
} {
- url := EndpointAddCosi.Path("http://example.com", lp.Prefix)
+ url := EndpointAddCosignature.Path("http://example.com", lp.Prefix)
req, err := http.NewRequest("POST", url, table.breq)
if err != nil {
t.Fatalf("failed creating http request: %v", err)