Skip to main content

Module update

Module update 

Source
Expand description

The desktop app’s signed updates from next.brep.io (offered, never silent). The desktop app’s updates: master’s Linux and Windows builds, offered from next.brep.io and installed only with the user’s say-so.

In the background the app hashes its own executable and asks the server’s update channel (/api/public/app-update/<os>) for the current build’s manifest. The manifest is signed with an ed25519 key whose public half is PUBLIC_KEY_HEX; one that does not verify is ignored. When the signed sha256 differs from this executable’s, a notice offers Update and restart. The download must match the signed length and sha256 before it touches the executable, so a server or connection that hands over anything else can only make an update fail.

The executable is replaced by rename beside itself, which a running program allows on both systems: on Linux the new file is renamed over the old one; on Windows the running file is renamed to <exe>.old (deleted at the next start) and the new one takes its name. The app then closes through its normal close path, which writes unsaved work for recovery, and starts the new executable with the same arguments.

The check never runs for a build out of a cargo target/ directory or ~/.cargo/bin (a developer’s or a crates.io build, which is not the channel’s), with BREP_NO_UPDATE_CHECK set, or after Don’t check again (update.json in the app’s config directory). BREP_UPDATE_URL points the check at another server.

Structs§

Manifest
A build the channel offers, as its manifest describes it.
Updater
The background check and the notice it raises.

Constants§

DEFAULT_SERVER
The server the channel is on, unless BREP_UPDATE_URL says otherwise.
FORMAT
The first line of every signed message; the server’s FORMAT.
PUBLIC_KEY_HEX
The update signing key’s public half.

Functions§

clean_leftovers
What an earlier update left beside the executable: the Windows .old (no longer running) and a .new an interrupted install wrote.
disabled_reason
Why this run does not check, or None when it does.
install
Put bytes in place of exe, once they are what manifest signed.
is_dev_build
A build cargo put where it builds (…/target/release/brep-app, …/target/<triple>/debug/…, a test binary under deps/) or installed (~/.cargo/bin): a developer’s or a crates.io build, not the channel’s.
platform_os
The channel’s name for this system, or None where it serves no build.
relaunch_if_installed
After the event loop returns: start the installed build with this run’s arguments, if an update was installed.
sha256_file
signed_message
What the manifest’s signature covers. Byte-for-byte the server’s desktop_update::signed_message; both sides’ tests pin one vector.
turn_off
turned_off
Whether the user said Don’t check again.