1 // Copyright 2021 Google LLC. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package api provides the API endpoints for the witness. 16 package api 17 18 import ( 19 ct "github.com/google/certificate-transparency-go" 20 ) 21 22 const ( 23 // HTTPGetSTH is the path of the URL to get an STH. The 24 // placeholder is for the logID (an alphanumeric string). 25 HTTPGetSTH = "/ctwitness/v0/logs/%s/sth" 26 // HTTPUpdate is the path of the URL to update to a new STH. 27 // Again the placeholder is for the logID. 28 HTTPUpdate = "/ctwitness/v0/logs/%s/update" 29 // HTTPGetLogs is the path of the URL to get a list of all logs the 30 // witness is aware of. 31 HTTPGetLogs = "/ctwitness/v0/logs" 32 ) 33 34 // UpdateRequest encodes the inputs to the witness Update function: a (raw) 35 // STH byte slice and a consistency proof (slice of slices). The logID 36 // is part of the request URL. 37 type UpdateRequest struct { 38 STH []byte 39 Proof [][]byte 40 } 41 42 // CosignedSTH has all the fields from a CT SignedTreeHead but adds a 43 // WitnessSigs field that holds the extra witness signatures. 44 type CosignedSTH struct { 45 ct.SignedTreeHead 46 WitnessSigs []ct.DigitallySigned `json:"witness_signatures"` 47 } 48