Documentation ¶
Index ¶
- Variables
- func CanonicalKeyID(k data.PublicKey) (string, error)
- 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 HashedPaths(path string, hashes data.Hashes) []string
- func NormalizeTarget(path string) string
- func StrSliceContains(ss []string, s string) bool
- func StrSliceContainsI(ss []string, s string) bool
- func Upload(url string, body io.Reader) (*http.Response, error)
- func ValidateTarget(r io.Reader, m *data.FileMeta) error
- type ErrNoCommonHash
- type ErrUnknownHashAlgorithm
- type ErrWrongHash
- type NoopCloser
- type PassphraseFunc
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.
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 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 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
Types ¶
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