selfupdate

package
v0.0.0-...-4b128c9 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(url string, allowedSigners []TrustedSigner, productId string, ctx context.Context) (pkg *Package, ver *Version, err error)

Check locates latest version available from url discovery resource and version of the product installed.

func DownloadAndInstall

func DownloadAndInstall(urls []string, hash *Hash, installerArguments string, ctx context.Context, progress progress.ProgressIndicator) error

DownloadAndInstall securely downloads installer file, prepares and launches installer

Types

type AlgorithmMask

type AlgorithmMask int

Bitmask of signing algorithms

const (
	LegacyAlgorithm    AlgorithmMask = 1 << iota // BLAKE2b EdDSA
	PrehashedAlgorithm                           // BLAKE2b-prehashed EdDSA

	AnyAlgorithm = LegacyAlgorithm | PrehashedAlgorithm
)

type Hash

type Hash [32]byte

SHA-256 hash

func (*Hash) MarshalJSON

func (h *Hash) MarshalJSON() ([]byte, error)

MarshalJSON hexadecimal-encodes SHA-256 hash value.

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

UnmarshalJSON hexadecimal-decodes SHA-256 hash value.

type Package

type Package struct {
	Arguments    string   `json:"arguments"`     // Update file command line arguments
	Uris         []string `json:"uri"`           // List of update file download URIs
	Version      *Version `json:"version"`       // Available product version
	ChangelogUri string   `json:"changelog_uri"` // Product changelog URI
	Hash         Hash     `json:"hash-sha256"`   // Update file SHA-256 hash
}

Available self-update description

type TrustedSigner

type TrustedSigner struct {
	PublicKey     minisign.PublicKey // Public key of the trusted signer
	AlgorithmMask AlgorithmMask      // Bitmask of algorithms trusted signer is using to sign content
}

Who and how is the signer we trust

type Version

type Version [4]uint

Product/file version

func ParseVersion

func ParseVersion(s string) (version *Version, err error)

ParseVersion parses n.n.n.n version string into components.

func (*Version) IsNewer

func (v *Version) IsNewer(other *Version) bool

IsNewer returns true if v > other

func (*Version) IsOlderOrEqual

func (v *Version) IsOlderOrEqual(other *Version) bool

IsOlderOrEqual returns true if v <= other

func (*Version) MarshalJSON

func (v *Version) MarshalJSON() ([]byte, error)

MarshalJSON encodes "n.n.n.n" version.

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes "n.n.n.n" version.

Jump to

Keyboard shortcuts

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