Documentation
¶
Overview ¶
Package update fetches signed codexctl releases from GitHub and replaces the running executable.
Index ¶
- Constants
- func Apply(exe string, binary []byte) error
- func AssetName(version string) string
- func CompareVersions(a, b string) int
- func DecodePrivateKey(s string) (ed25519.PrivateKey, error)
- func DecodePublicKey(s string) (ed25519.PublicKey, error)
- func Executable() (string, error)
- func ExtractBinary(archive []byte, name string) ([]byte, error)
- func GenerateKey() (public, private string, err error)
- func PublicKey() (ed25519.PublicKey, error)
- func Sign(key ed25519.PrivateKey, data []byte) []byte
- func Verify(key ed25519.PublicKey, data, signature []byte) error
- type Client
- type Method
- type Release
Constants ¶
const (
Repo = "AbdelrhmanSaid/codexctl"
)
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply replaces the executable at exe with binary. The new file is written next to the old one and renamed over it, so the swap is atomic on POSIX. Windows refuses to overwrite a running executable but allows renaming it, so the old file is moved aside first and deleted on a later update.
func CompareVersions ¶
CompareVersions orders two semantic versions, ignoring a leading "v". A prerelease sorts before the release it precedes.
func DecodePrivateKey ¶
func DecodePrivateKey(s string) (ed25519.PrivateKey, error)
func Executable ¶
Executable returns the real path of the running binary, following any symlink such as the one a manual install into ~/bin might use.
func ExtractBinary ¶
ExtractBinary returns the codexctl executable stored in a release archive.
func GenerateKey ¶
GenerateKey creates a new signing key pair. Both halves are base64 strings: the public key is embedded in the binary and the private key is stored as a CI secret.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
PublicKey ed25519.PublicKey
// ReleasesURL is the GitHub releases page; tests point it elsewhere.
ReleasesURL string
}
type Method ¶
type Method int
Method describes how the running binary was installed.
func DetectInstall ¶
DetectInstall classifies the running binary. releaseBuild reports whether GoReleaser stamped a version into it.