Documentation ¶
Index ¶
- Variables
- func CanonicalKeyID(k data.PublicKey) (string, error)
- func ConsistentName(role string, hashSha256 []byte) string
- func DoHash(alg string, d []byte) []byte
- func Download(url url.URL) (*http.Response, error)
- func FileExists(path string) bool
- func FileMetaEqual(actual data.FileMeta, expected data.FileMeta) error
- func FindRoleIndex(rs []*data.Role, name string) int
- func HashedPaths(path string, hashes data.Hashes) []string
- func NormalizeTarget(path string) string
- func RemoveUnusedKeys(t *data.SignedTargets)
- func StrSliceContains(ss []string, s string) bool
- func StrSliceContainsI(ss []string, s string) bool
- func StrSliceRemove(ss []string, s string) []string
- func UnusedDelegationKeys(t data.SignedTargets) []string
- func Upload(url string, body io.Reader) (*http.Response, error)
- type ErrBadTypeCast
- type ErrEmptyStack
- type ErrNoCommonHash
- type ErrUnknownHashAlgorithm
- type ErrWrongHash
- type NoopCloser
- type PassphraseFunc
- type RoleList
- type Stack
Constants ¶
This section is empty.
Variables ¶
var ErrWrongLength = errors.New("wrong length")
ErrWrongLength indicates the length was different to that expected
Functions ¶
func CanonicalKeyID ¶
CanonicalKeyID returns the ID of the public bytes version of a TUF key. On regular RSA/ECDSA TUF keys, this is just the key ID. On X509 RSA/ECDSA TUF keys, this is the key ID of the public key part of the key in the leaf cert
func ConsistentName ¶
ConsistentName generates the appropriate HTTP URL path for the role, based on whether the repo is marked as consistent. The RemoteStore is responsible for adding file extensions.
func FileExists ¶
FileExists returns true if a file (or dir) exists at the given path, false otherwise
func FileMetaEqual ¶
FileMetaEqual checks whether 2 FileMeta objects are consistent with eachother
func FindRoleIndex ¶
FindRoleIndex returns the index of the role named <name> or -1 if no matching role is found.
func HashedPaths ¶
HashedPaths prefixes the filename with the known hashes for the file, returning a list of possible consistent paths.
func NormalizeTarget ¶
NormalizeTarget adds a slash, if required, to the front of a target path
func RemoveUnusedKeys ¶
func RemoveUnusedKeys(t *data.SignedTargets)
RemoveUnusedKeys determines which keys in the slice of IDs are no longer used in the given targets file and removes them from the delegated keys map
func StrSliceContains ¶
StrSliceContains checks if the given string appears in the slice
func StrSliceContainsI ¶
StrSliceContainsI checks if the given string appears in the slice in a case insensitive manner
func StrSliceRemove ¶
StrSliceRemove removes the the given string from the slice, returning a new slice
func UnusedDelegationKeys ¶
func UnusedDelegationKeys(t data.SignedTargets) []string
UnusedDelegationKeys prunes a list of keys, returning those that are no longer in use for a given targets file
Types ¶
type ErrBadTypeCast ¶
type ErrBadTypeCast struct{}
ErrBadTypeCast is used by PopX functions when the item cannot be typed to X
func (ErrBadTypeCast) Error ¶
func (err ErrBadTypeCast) Error() string
type ErrEmptyStack ¶
type ErrEmptyStack struct {
// contains filtered or unexported fields
}
ErrEmptyStack is used when an action that requires some content is invoked and the stack is empty
func (ErrEmptyStack) Error ¶
func (err ErrEmptyStack) Error() string
type ErrNoCommonHash ¶
ErrNoCommonHash indicates the metadata did not provide any hashes this client recognizes
func (ErrNoCommonHash) Error ¶
func (e ErrNoCommonHash) Error() string
Error implements error interface
type ErrUnknownHashAlgorithm ¶
type ErrUnknownHashAlgorithm struct {
Name string
}
ErrUnknownHashAlgorithm - client was ashed to use a hash algorithm it is not familiar with
func (ErrUnknownHashAlgorithm) Error ¶
func (e ErrUnknownHashAlgorithm) Error() string
Error implements error interface
type ErrWrongHash ¶
ErrWrongHash indicates the hash was different to that expected
type NoopCloser ¶
NoopCloser is a simple Reader wrapper that does nothing when Close is called
type PassphraseFunc ¶
PassphraseFunc type for func that request a passphrase
type RoleList ¶
type RoleList []string
RoleList is a list of roles
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a simple type agnostic stack implementation
func (*Stack) Pop ¶
Pop removes and returns the top item on the stack, or returns ErrEmptyStack if the stack has no content