integritykey

package
v0.7.53-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package integritykey is the runner home's integrity key: 32 random bytes in <runner home>/plan-integrity.key (0600), outside every install directory. Two records are made under it, and a reader who can write an install directory but not read the key can make neither pass after an edit: the plan-integrity record beside an installed plan.json (compile) and the installed-release record beside a release's install.json (installdir).

It is its own package so installdir, which lays releases down, and compile, which compiles plans, share one key without either importing the other.

Index

Constants

View Source
const File = "plan-integrity.key"

File is the key's name directly under the runner home. The name is the plan-integrity key's, which it was first.

View Source
const KeyLen = 32

KeyLen is the key's length in bytes.

Variables

This section is empty.

Functions

func ID

func ID(key []byte, purpose string) string

ID names the key for one purpose without revealing it: the first 16 hex of sha256(purpose NUL key). Each record names the key it was made under this way, so a record made under another key is told apart from one made under this key that does not verify.

func Load

func Load(home string) ([]byte, error)

Load returns the runner home's key, creating it on first use. Creation is race-free across processes: the key is written aside and hard-linked into place, so a concurrent first run either wins the link or reads the winner's complete key.

func Read

func Read(home string) ([]byte, error)

Read returns the runner home's key without creating it: an error matching fs.ErrNotExist when the home has none yet, so nothing can have been recorded under it. A reader that must not write (a preview) uses it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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