data

package
v0.0.0-...-0512d79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyIDLength              = sha256.Size * 2
	KeyTypeEd25519           = "ed25519"
	KeyTypeECDSA_SHA2_P256   = "ecdsa-sha2-nistp256"
	KeySchemeEd25519         = "ed25519"
	KeySchemeECDSA_SHA2_P256 = "ecdsa-sha2-nistp256"
)

Variables

View Source
var (
	KeyAlgorithms = []string{"sha256", "sha512"}
)

Functions

func DefaultExpires

func DefaultExpires(role string) time.Time

Types

type FileMeta

type FileMeta struct {
	Length int64            `json:"length",omitempty`
	Hashes Hashes           `json:"hashes",ompitempty`
	Custom *json.RawMessage `json:"custom,omitempty"`
}

func (FileMeta) HashAlgorithms

func (f FileMeta) HashAlgorithms() []string

type Files

type Files map[string]FileMeta

type Hashes

type Hashes map[string]HexBytes

type HexBytes

type HexBytes []byte

func (HexBytes) MarshalJSON

func (b HexBytes) MarshalJSON() ([]byte, error)

func (HexBytes) String

func (b HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (b *HexBytes) UnmarshalJSON(data []byte) error

type Key

type Key struct {
	Type       string   `json:"keytype"`
	Scheme     string   `json:"scheme,omitempty"`
	Algorithms []string `json:"keyid_hash_algorithms,omitempty"`
	Value      KeyValue `json:"keyval"`
	// contains filtered or unexported fields
}

func (*Key) ContainsID

func (k *Key) ContainsID(id string) bool

func (*Key) IDs

func (k *Key) IDs() []string

type KeyValue

type KeyValue struct {
	Public HexBytes `json:"public"`
}

type Role

type Role struct {
	KeyIDs    []string `json:"keyids"`
	Threshold int      `json:"threshold"`
}

func (*Role) AddKeyIDs

func (r *Role) AddKeyIDs(ids []string) bool

type Root

type Root struct {
	Type        string           `json:"_type"`
	SpecVersion string           `json:"spec_version"`
	Version     int              `json:"version"`
	Expires     time.Time        `json:"expires"`
	Keys        map[string]*Key  `json:"keys"`
	Roles       map[string]*Role `json:"roles"`

	ConsistentSnapshot bool `json:"consistent_snapshot"`
}

func NewRoot

func NewRoot() *Root

func (*Root) AddKey

func (r *Root) AddKey(key *Key) bool

func (Root) UniqueKeys

func (r Root) UniqueKeys() map[string][]*Key

UniqueKeys returns the unique keys for each associated role. We might have multiple key IDs that correspond to the same key.

type Signature

type Signature struct {
	KeyID string `json:"keyid"`

	// FIXME(TUF-0.9) removed in TUF 1.0, keeping it around for backwards
	// compatibility with TUF 0.9.
	Method string `json:"method"`

	Signature HexBytes `json:"sig"`
}

type Signed

type Signed struct {
	Signed     json.RawMessage `json:"signed"`
	Signatures []Signature     `json:"signatures"`
}

type Snapshot

type Snapshot struct {
	Type        string        `json:"_type"`
	SpecVersion string        `json:"spec_version"`
	Version     int           `json:"version"`
	Expires     time.Time     `json:"expires"`
	Meta        SnapshotFiles `json:"meta"`
}

func NewSnapshot

func NewSnapshot() *Snapshot

type SnapshotFileMeta

type SnapshotFileMeta struct {
	FileMeta
	Version int `json:"version"`
}

type SnapshotFiles

type SnapshotFiles map[string]SnapshotFileMeta

type TargetFileMeta

type TargetFileMeta struct {
	FileMeta
}

func (TargetFileMeta) HashAlgorithms

func (f TargetFileMeta) HashAlgorithms() []string

type TargetFiles

type TargetFiles map[string]TargetFileMeta

type Targets

type Targets struct {
	Type        string      `json:"_type"`
	SpecVersion string      `json:"spec_version"`
	Version     int         `json:"version"`
	Expires     time.Time   `json:"expires"`
	Targets     TargetFiles `json:"targets"`
}

func NewTargets

func NewTargets() *Targets

type Timestamp

type Timestamp struct {
	Type        string         `json:"_type"`
	SpecVersion string         `json:"spec_version"`
	Version     int            `json:"version"`
	Expires     time.Time      `json:"expires"`
	Meta        TimestampFiles `json:"meta"`
}

func NewTimestamp

func NewTimestamp() *Timestamp

type TimestampFileMeta

type TimestampFileMeta struct {
	FileMeta
	Version int `json:"version"`
}

type TimestampFiles

type TimestampFiles map[string]TimestampFileMeta

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL