Documentation
¶
Overview ¶
Package modules is the slot for private modules (ADR-076): a signed admin key that names which modules may run, a folder of static files installed from this machine, and the checks that decide whether one is shown.
The slot holds no module. A module is somebody's own code, installed by them from a local folder; the public build carries only the way to verify a key and host what it names, so patching the check out unlocks nothing.
Index ¶
Constants ¶
const ( ManifestFile = "module.json" Entry = "index.html" )
ManifestFile names a module and sits at the top of its folder, beside the Entry page the screen hosts.
const KeyPrefix = "CRA1."
KeyPrefix starts every admin key: CRA1.<payload>.<sig>, where payload is base64url of the claims' JSON and sig is base64url of an Ed25519 signature over the ASCII bytes of the payload part.
const PublicKey = "M6U1zOTAnYbdEaukyaZUQ1VGOfZPdQT+Ol0OCACP504="
PublicKey is the raw Ed25519 key admin keys are verified with. Its private half never touches this repository.
Variables ¶
This section is empty.
Functions ¶
func LooksLikeKey ¶
LooksLikeKey reports whether s is meant as an admin key, so a field that takes both kinds of key can send it the right way.
func Remove ¶
Remove deletes an installed module's files. Its documents stay in the database, so installing it again finds them.
Types ¶
type Grant ¶
type Grant struct {
Subject string `json:"subject"`
Modules []string `json:"modules"`
IssuedAt string `json:"issued_at,omitempty"`
}
Grant is what a verified admin key allows: who it was issued to and which modules may be installed and opened.
func ParseKeyWith ¶
ParseKeyWith verifies an admin key against pub: the embedded key in the build, a key pair of their own in tests.
type Manifest ¶
type Manifest struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version,omitempty"`
}
Manifest is module.json.
func Install ¶
Install copies the built module in src into root/<id>, replacing an older copy whole. The key must name the module: it decides who may install one. Only regular files and folders are copied; a link is refused, so nothing outside the module's folder is ever served as part of it.
func Installed ¶
Installed returns the modules installed under root, by id. A folder whose manifest is missing, unreadable or names another id is not a module.
func ReadManifest ¶
ReadManifest reads and checks the module in dir.