...
1 package verify
2
3 import (
4 "errors"
5 "fmt"
6 "time"
7 )
8
9 var (
10 ErrMissingKey = errors.New("tuf: missing key")
11 ErrNoSignatures = errors.New("tuf: data has no signatures")
12 ErrInvalid = errors.New("tuf: signature verification failed")
13 ErrWrongMethod = errors.New("tuf: invalid signature type")
14 ErrWrongMetaType = errors.New("tuf: meta file has wrong type")
15 ErrExists = errors.New("tuf: key already in db")
16 ErrInvalidKey = errors.New("tuf: invalid key")
17 ErrInvalidRole = errors.New("tuf: invalid role")
18 ErrInvalidDelegatedRole = errors.New("tuf: invalid delegated role")
19 ErrInvalidKeyID = errors.New("tuf: invalid key id")
20 ErrInvalidThreshold = errors.New("tuf: invalid role threshold")
21 ErrMissingTargetFile = errors.New("tuf: missing previously listed targets metadata file")
22 )
23
24 type ErrRepeatID struct {
25 KeyID string
26 }
27
28 func (e ErrRepeatID) Error() string {
29 return fmt.Sprintf("tuf: duplicate key id (%s)", e.KeyID)
30 }
31
32 type ErrUnknownRole struct {
33 Role string
34 }
35
36 func (e ErrUnknownRole) Error() string {
37 return fmt.Sprintf("tuf: unknown role %q", e.Role)
38 }
39
40 type ErrExpired struct {
41 Expired time.Time
42 }
43
44 func (e ErrExpired) Error() string {
45 return fmt.Sprintf("expired at %s", e.Expired)
46 }
47
48 type ErrLowVersion struct {
49 Actual int64
50 Current int64
51 }
52
53 func (e ErrLowVersion) Error() string {
54 return fmt.Sprintf("version %d is lower than current version %d", e.Actual, e.Current)
55 }
56
57 type ErrWrongVersion struct {
58 Given int64
59 Expected int64
60 }
61
62 func (e ErrWrongVersion) Error() string {
63 return fmt.Sprintf("version %d does not match the expected version %d", e.Given, e.Expected)
64 }
65
66 type ErrRoleThreshold struct {
67 Expected int
68 Actual int
69 }
70
71 func (e ErrRoleThreshold) Error() string {
72 return "tuf: valid signatures did not meet threshold"
73 }
74
View as plain text