1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
package policy
import (
"fmt"
"git.sigsum.org/sigsum-go/pkg/types"
)
type DefaultPolicy struct{}
// Verify checks if the cosigned tree head satisifies the policy "one log and
// a majority of witnesses". Any unverifiable cosignatures are removed.
func (dp *DefaultPolicy) Verify(*types.CosignedTreeHead) error {
return fmt.Errorf("TODO")
}
func (dp *DefaultPolicy) Logs() []Log {
return []Log{
Log{
Name: "Test log operated by ln5",
LogURL: "https://poc.sigsum.org/glasswing-butterfly/sigsum/v0",
PublicKey: types.PublicKey{
74, 179, 210, 181,
30, 71, 220, 157,
228, 204, 228, 189,
235, 169, 224, 134,
34, 233, 58, 47,
127, 137, 180, 203,
119, 25, 127, 198,
176, 4, 77, 231,
},
ShardStart: 1639579652,
TrustUntil: 1648771200, // Apr 1 2022
},
}
}
func (dp *DefaultPolicy) Witnesses() []Witness {
return []Witness{
Witness{
Name: "Test witness operated by rgdd",
PublicKey: types.PublicKey{
129, 45, 190, 240,
21, 107, 7, 158,
45, 4, 135, 71,
178, 24, 156, 191,
166, 79, 150, 226,
32, 74, 23, 203,
35, 203, 82, 128,
128, 135, 21, 3,
},
TrustUntil: 1648771200, // Apr 1 2022
},
}
}
// ShardHint returns the smallest shard hint that all logs accept
func (dp *DefaultPolicy) ShardHint() uint64 {
var shardHint uint64
for _, l := range dp.Logs() {
if l.ShardStart > shardHint {
shardHint = l.ShardStart
}
}
return shardHint
}
|