Documentation
¶
Index ¶
- Variables
- func DefaultExpires(role string) time.Time
- func RoleName(role string) string
- func SetDefaultExpiryTimes(times map[string]time.Time)
- func SetTUFTypes(ts map[string]string)
- func SetValidRoles(rs map[string]string)
- func ValidRole(name string) bool
- func ValidTUFType(t string) bool
- type Delegations
- type FileMeta
- type Files
- type Hashes
- type HexBytes
- type Key
- type KeyPair
- type PrivateKey
- type PublicKey
- type Role
- type Root
- type RootRole
- type Signature
- type Signed
- type SignedRoot
- type SignedSnapshot
- type SignedTargets
- func (t *SignedTargets) AddDelegation(role *Role, keys []*PublicKey) error
- func (t *SignedTargets) AddTarget(path string, meta FileMeta)
- func (t SignedTargets) GetDelegations(path string) []*Role
- func (t SignedTargets) GetMeta(path string) *FileMeta
- func (t SignedTargets) ToSigned() (*Signed, error)
- type SignedTimestamp
- type Snapshot
- type TUFKey
- type Targets
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
View Source
var TUFTypes = map[string]string{
"targets": "Targets",
"root": "Root",
"snapshot": "Snapshot",
"timestamp": "Timestamp",
}
View Source
var ValidRoles = map[string]string{
"root": "root",
"targets": "targets",
"snapshot": "snapshot",
"timestamp": "timestamp",
}
Functions ¶
func DefaultExpires ¶
func SetDefaultExpiryTimes ¶
SetDefaultExpiryTimes allows one to change the default expiries.
func SetTUFTypes ¶
SetTUFTypes allows one to override some or all of the default type names in TUF.
func SetValidRoles ¶
Types ¶
type Delegations ¶
func NewDelegations ¶
func NewDelegations() *Delegations
type FileMeta ¶
type FileMeta struct { Length int64 `json:"length"` Hashes Hashes `json:"hashes"` Custom *json.RawMessage `json:"custom,omitempty"` }
type PrivateKey ¶
type PrivateKey struct {
TUFKey
}
func NewPrivateKey ¶
func NewPrivateKey(cipher, public, private string) *PrivateKey
func (PrivateKey) Private ¶
func (k PrivateKey) Private() string
type PublicKey ¶
type PublicKey struct {
TUFKey
}
func NewPublicKey ¶
func PublicKeyFromPrivate ¶
func PublicKeyFromPrivate(pk PrivateKey) *PublicKey
type Role ¶
type Role struct { RootRole Name string `json:"name"` Paths []string `json:"paths,omitempty"` PathHashPrefixes []string `json:"path_hash_prefixes,omitempty"` }
func (Role) CheckPaths ¶
func (Role) CheckPrefixes ¶
func (Role) IsDelegation ¶
type Signed ¶
type Signed struct { Signed json.RawMessage `json:"signed"` Signatures []Signature `json:"signatures"` }
type SignedRoot ¶
func RootFromSigned ¶
func RootFromSigned(s *Signed) (*SignedRoot, error)
func (SignedRoot) ToSigned ¶
func (r SignedRoot) ToSigned() (*Signed, error)
type SignedSnapshot ¶
func NewSnapshot ¶
func NewSnapshot(root *Signed, targets *Signed) (*SignedSnapshot, error)
func SnapshotFromSigned ¶
func SnapshotFromSigned(s *Signed) (*SignedSnapshot, error)
func (*SignedSnapshot) AddMeta ¶
func (sp *SignedSnapshot) AddMeta(role string, meta FileMeta)
func (SignedSnapshot) ToSigned ¶
func (sp SignedSnapshot) ToSigned() (*Signed, error)
type SignedTargets ¶
func NewTargets ¶
func NewTargets() *SignedTargets
func TargetsFromSigned ¶
func TargetsFromSigned(s *Signed) (*SignedTargets, error)
func (*SignedTargets) AddDelegation ¶
func (t *SignedTargets) AddDelegation(role *Role, keys []*PublicKey) error
func (*SignedTargets) AddTarget ¶
func (t *SignedTargets) AddTarget(path string, meta FileMeta)
func (SignedTargets) GetDelegations ¶
func (t SignedTargets) GetDelegations(path string) []*Role
GetDelegations filters the roles and associated keys that may be the signers for the given target path. If no appropriate roles can be found, it will simply return nil for the return values. The returned slice of Role will have order maintained relative to the role slice on Delegations per TUF spec proposal on using order to determine priority.
func (SignedTargets) GetMeta ¶
func (t SignedTargets) GetMeta(path string) *FileMeta
GetMeta attempts to find the targets entry for the path. It will return nil in the case of the target not being found.
func (SignedTargets) ToSigned ¶
func (t SignedTargets) ToSigned() (*Signed, error)
type SignedTimestamp ¶
func NewTimestamp ¶
func NewTimestamp(snapshot *Signed) (*SignedTimestamp, error)
func TimestampFromSigned ¶
func TimestampFromSigned(s *Signed) (*SignedTimestamp, error)
func (SignedTimestamp) ToSigned ¶
func (ts SignedTimestamp) ToSigned() (*Signed, error)
type TUFKey ¶
Click to show internal directories.
Click to hide internal directories.