Documentation
¶
Overview ¶
Package plugin is the local plugin store: verified plugin binaries and manifests under <Dir>/plugins/<qualified name>/<version>/ (0500), and <Dir>/plugins.lock recording what was verified at install time. Every Open re-hashes the binary and the manifest against the lock.
Index ¶
Constants ¶
const OfficialMarketplace = "official"
OfficialMarketplace is the marketplace name whose plugins have bare names.
Variables ¶
var ( ErrTampered = errors.New("plugin_tampered") ErrNotInstalled = errors.New("plugin_not_installed") )
Functions ¶
Types ¶
type Installed ¶
type Installed struct {
LockEntry
Manifest pluginspec.Manifest
Binary string
Tampered bool
}
Installed is a lock entry with its manifest as read from disk. Tampered is set, and Manifest left empty, when the manifest on disk no longer matches the lock.
type LockEntry ¶
type LockEntry struct {
Name string `toml:"name"`
Version string `toml:"version"`
Marketplace string `toml:"marketplace"`
BinarySHA256 string `toml:"binary_sha256"`
ManifestSHA256 string `toml:"manifest_sha256"`
Official bool `toml:"official"`
}
LockEntry is one installed plugin in plugins.lock. Name is qualified: bare for the official marketplace, "<marketplace>/<name>" otherwise.
type Store ¶
type Store struct{ Dir string }
func (Store) Install ¶
Install stores a plugin whose binary and manifest have already been verified against the marketplace, after checking them against e. A previously installed version of the same plugin is replaced.
func (Store) Open ¶
Open opens an installed plugin's binary and checks, from the opened file itself, that it still hashes to the lock entry; the returned file is positioned at its start and is the one to execute.