// Package packaging embeds what devvm's releases are packaged with, for // devvm upgrade: the public halves of the release keys, in keys/, two of // which sign each release's SHA256SUMS, and minisign.pub, the old release // key's, which also signs it while releases bridge from that one key to // the three (scripts/release.sh). It's embedded with the rest of this // folder, so a build without a key still builds, and has no such key. package packaging import ( "embed" "strings" ) // files is this folder, the keys among it once they exist. // //go:embed * var files embed.FS // MinisignKey is the old release key's public half, as minisign -P takes // it (minisign.pub's second line), or "" when this build has none. func MinisignKey() string { return publicKey("minisign.pub") } // Key is the public half of the key in keys/name, such as release-ci.pub // (minisign.KeyFile), as minisign -P takes it, or "" when this build has // none. func Key(name string) string { return publicKey("keys/" + name) } // publicKey is the second line of the minisign public key file at path, // or "" when there's none. func publicKey(path string) string { b, err := files.ReadFile(path) if err != nil { return "" } lines := strings.Split(strings.TrimSpace(string(b)), "\n") if len(lines) != 2 { return "" } return strings.TrimSpace(lines[1]) }