Documentation
¶
Overview ¶
Package pluginseal seals a fylr plugin zip into a "sealed plugin" — still a valid zip — and opens one back.
Sealing needs only the recipient's PUBLIC key, so it runs in any (public) plugin build pipeline without a secret. Opening needs the matching private key, which lives in fylr. The envelope format is defined here once so the fylr-seal-plugin CLI and the fylr server share a single source of truth and cannot drift — the same role license.DigestInput plays for the license signer and verifier.
A sealed plugin keeps the fylr plugin-folder convention — it is an ordinary zip containing the plugin's folder with a plaintext manifest and the sealed plugin beside it:
<name>/manifest.yml plaintext — the plugin's identity, readable without a key <name>/fylr-sealed-plugin.enc magic "FYLRPLG" | version(1) | recipient public key(32) | NaCl sealed box(<the plugin zip>)
The recipient public key travels in the envelope (like an age recipient stanza or a PGP key id), so an opener holding several private keys picks the matching one deterministically instead of trying them all.
fylr imports this package to open sealed plugins (supplying its private keys); the CLI imports it to seal them.
Index ¶
- func GenerateKey() (pub, priv *[32]byte, err error)
- func IsEncrypted(data []byte) bool
- func OpenPluginZip(artifact []byte, privKeys ...*[32]byte) (pluginZip []byte, sealed bool, err error)
- func PublicKey(priv *[32]byte) (*[32]byte, error)
- func Seal(plaintext []byte, recipientPub *[32]byte) ([]byte, error)
- func SealPluginZip(pluginZip []byte, recipientPub *[32]byte) ([]byte, error)
- type PluginInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey returns a fresh recipient keypair: seal plugins to pub, and give priv to fylr (embedded, or on a marketplace source in fylr.yml) to open them.
func IsEncrypted ¶
IsEncrypted reports whether data is a sealed payload (the content entry).
func OpenPluginZip ¶
func OpenPluginZip(artifact []byte, privKeys ...*[32]byte) (pluginZip []byte, sealed bool, err error)
OpenPluginZip returns the plaintext plugin zip from an artifact. If the artifact is a sealed plugin, the private key matching the envelope's recipient public key is picked from privKeys and the inner plugin zip is returned with sealed=true; a plain plugin zip (or any non-sealed artifact) is returned unchanged with sealed=false.
func Seal ¶
Seal produces the sealed payload: plaintext sealed anonymously to recipientPub, prefixed with the envelope header carrying that public key. Callers usually want SealPluginZip.
func SealPluginZip ¶
SealPluginZip wraps a plaintext plugin zip into a sealed plugin: an ordinary zip that keeps the plugin's folder, with the manifest left plaintext (readable identity) and the whole plugin sealed to recipientPub beside it — see the package doc. The input must be a fylr plugin zip: files under a single top-level folder <name>/, with a <name>/manifest.yml.
Types ¶
type PluginInfo ¶
type PluginInfo struct {
Name string // plugin name (the folder / manifest identity)
Sealed bool // false for a plain plugin zip
RecipientPub *[32]byte // recipient public key from the envelope; nil when not sealed
}
PluginInfo describes a sealed plugin artifact, read without any key.
func Inspect ¶
func Inspect(artifact []byte) (info PluginInfo, err error)
Inspect reads a plugin artifact's identity and — for a sealed plugin — the recipient public key from the envelope. No key material is needed.