package utils
import "github.com/theupdateframework/notary/tuf/utils"
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
Variables ¶
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 DoHash ¶
DoHash returns the digest of d using the hashing algorithm named in alg
func Download ¶
Download does a simple download from a URL
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
func Upload ¶
Upload does a simple JSON upload to a URL
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
func (ErrWrongHash) Error ¶
func (e ErrWrongHash) Error() string
Error implements error interface
type NoopCloser ¶
NoopCloser is a simple Reader wrapper that does nothing when Close is called
func (*NoopCloser) Close ¶
func (nc *NoopCloser) Close() error
Close does nothing for a NoopCloser
type PassphraseFunc ¶
PassphraseFunc type for func that request a passphrase
type RoleList ¶
type RoleList []string
RoleList is a list of roles
func (RoleList) Len ¶
Len returns the length of the list
func (RoleList) Less ¶
Less returns true if the item at i should be sorted before the item at j. It's an unstable partial ordering based on the number of segments, separated by "/", in the role name
func (RoleList) Swap ¶
Swap the items at 2 locations in the list
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack is a simple type agnostic stack implementation
func NewStack ¶
func NewStack() *Stack
NewStack create a new stack
func (*Stack) Empty ¶
Empty returns true if the stack is empty
func (*Stack) Pop ¶
Pop removes and returns the top item on the stack, or returns ErrEmptyStack if the stack has no content
func (*Stack) PopString ¶
PopString attempts to cast the top item on the stack to the string type. If this succeeds, it removes and returns the top item. If the item is not of the string type, ErrBadTypeCast is returned. If the stack is empty, ErrEmptyStack is returned
func (*Stack) Push ¶
func (s *Stack) Push(item interface{})
Push adds an item to the top of the stack.
Source Files ¶
role_sort.go stack.go util.go utils.go
- Version
- v0.3.0-RC3
- Published
- Apr 29, 2016
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 1 hour ago –
Tools for package owners.