updater Stable
Delivers over-the-air updates, either via GitHub Releases (binary swap) or a JSON manifest you host yourself (binary or JS-only). No unsigned update is ever applied — see Signing & trust below.
Requires capability: "updater"
Import
import { updater } from '@glyx-dev/react'The update source is config-configured, not caller-supplied.
owner/repo/binName come from the updater
block in glyx.config.json, read once at startup — JS never sees or sets
them. updater.check() and updater.update() only take a version string;
there's no way to redirect a running app to a different repo from JS. This
is intentional (it closes off a class of "point the updater at an
attacker-controlled repo" attack), but it means the two owner/repo
params you might expect on check/update don't exist — and without the
config block, both reject with "Update origin not configured".
updater.getVersion()
Returns the app version declared in glyx.config.json's version field,
or "0.0.0" if unset.
const current = updater.getVersion()updater.getPlatform()
Returns "windows", "macos", or "linux" — matches the _platform key
checkManifest injects into manifest responses.
updater.check(currentVersion)
Check the build-time-configured GitHub repo for a newer version.
const result = await updater.check('1.0.0')Parameters:
| Param | Type | Description |
|---|---|---|
currentVersion | string | Current semver version, e.g. '1.0.0' |
Returns: Promise<UpdateCheckResult>
interface UpdateCheckResult {
hasUpdate: boolean // true if latestVersion > currentVersion
latestVersion: string // e.g. '1.2.0'
body: string // Release notes from GitHub
}Returns immediately — no download. Compares version strings using semver ordering.
updater.update(currentVersion)
Download the latest release binary and its .sig sidecar, verify the
Ed25519 signature, then replace the running executable on disk.
const result = await updater.update('1.0.0')
if (result.updated) {
// Prompt user to relaunch
console.log(`Updated to ${result.latestVersion}`)
}Parameters:
| Param | Type | Description |
|---|---|---|
currentVersion | string | Current semver version |
Returns: Promise<UpdateResult>
interface UpdateResult {
updated: boolean // false if already on latest version
latestVersion: string // version that was installed (or already running)
}Rejects if the matching platform asset has no .sig sidecar on the release,
or if the signature doesn't verify — an unsigned or tampered binary is
never written to disk, and the running executable is left untouched on
failure.
Asset naming
The updater selects the release asset matching the current platform, using
the binName compiled in from glyx.config:
| Platform | Asset name | Signature sidecar |
|---|---|---|
| Windows | {binName}-windows.exe | {binName}-windows.exe.sig |
| macOS | {binName}-macos | {binName}-macos.sig |
| Linux | {binName}-linux | {binName}-linux.sig |
glyx package produces files with exactly these suffixes; CI signs each
asset with the private update-signing key and uploads the .sig alongside
it.
The binary is replaced on disk. The update takes effect on next launch — the running process is not affected. Prompt the user to restart.
Full example (GitHub Releases)
import { updater } from '@glyx-dev/react'
// Check silently on launch
setTimeout(async () => {
try {
const check = await updater.check(updater.getVersion())
if (check.hasUpdate) {
console.log(`Update available: ${check.latestVersion}`)
// Show UI notification to user...
}
} catch {
// Network unavailable — ignore
}
}, 5000)
// Install when user confirms
async function installUpdate() {
const result = await updater.update(updater.getVersion())
if (result.updated) {
// Show "Restart to apply" dialog
}
}updater.checkManifest(url, currentVersion?)
An alternative to GitHub Releases: host a plain JSON manifest anywhere and
compare its version field yourself. Useful when you want JS-only updates
(no binary re-download) or don't want to use GitHub Releases at all.
{
"version": "2.1.0",
"update_type": "js_only",
"notes": "Bug fixes",
"js_url": "https://cdn.example.com/2.1.0/app.js",
"js_sig": "a1b2c3..."
}const manifest = await updater.checkManifest('https://cdn.example.com/latest.json')
if (manifest) {
console.log(`${manifest._platform}: ${manifest.version} available`)
}Returns null if already up to date, or if the manifest has an optional
platforms array that doesn't include the current OS. The returned object
gets a _platform key injected (matching updater.getPlatform()) so you
can read platform-specific fields.
updater.downloadJs(url, sigHex)
Download a JS bundle, verify its Ed25519 signature, and stage it for the next restart — completing a JS-only update with zero binary re-download.
if (manifest.update_type === 'js_only') {
await updater.downloadJs(manifest.js_url, manifest.js_sig)
glyxWindow.restart() // applies on next launch automatically
}Parameters:
| Param | Type | Description |
|---|---|---|
url | string | Direct download URL of the new app.js |
sigHex | string | Ed25519 signature, hex-encoded, over the raw bundle bytes. Required — there is no "skip verification" option. |
sigHex is an Ed25519 signature, not a SHA-256 digest — despite the field
being named js_sha256 in some older examples. Passing a SHA-256 hex
digest here will fail signature verification (wrong length/format), not
silently skip the check.
Signing & trust
Every applied update — binary or JS — must carry a valid Ed25519 signature verified against a public key embedded in the runner at build time:
- CI signs the release artifact with a private key (
UPDATE_SIGNING_KEY), never committed to the repo. - The
.sig(binary) orjs_sig(JS bundle) is published alongside the artifact. - The runner verifies the signature against the embedded public key before writing anything to disk. Verification failure leaves the running app untouched.
There's currently no rollback path if a signed-but-broken build is applied and crashes on next launch — the previous binary isn't preserved. Treat signing as "this came from us," not as a substitute for testing a release before publishing it.
GitHub Release setup
- Build release artifacts with
glyx package --target windows/macos/linux - Create a GitHub Release with a semver tag (e.g.
v1.2.0) - Attach the platform artifacts and their
.sigsidecars — they must match the{binName}-{platform}/{binName}-{platform}.sigpattern
The updater compares the release tag (stripping a leading v) against currentVersion.