Skip to main content

Module widgets

Module widgets 

Source
Expand description

Permissioned widget manifests, signed catalogue data, and safe package installation.

Structs§

Catalogue
The signed list of reviewed widgets.
CatalogueEntry
A widget listed in the catalogue.
InstalledMetadata 🔒
Install record written to .installed.json beside the manifest.
InstalledWidget
A widget installed on this device.
WidgetManifest
A widget’s widget.json.
WidgetProcess
A process a widget declares.

Enums§

PopoutShape
Shape of a module widget’s own window.
WidgetPermission
An action a widget may be granted, named as in manifests.

Constants§

APP_VERSION
This build’s version.
EXAMPLE_WIDGET 🔒
The Hello, world! example widget, compiled into development builds only.
LOCAL_CATALOGUE
The working tree’s widgets/ and examples/ folders, which development builds list as their catalogue.
MAX_ARCHIVE_BYTES 🔒
Largest widget package download, in bytes.
MAX_EXPANDED_BYTES 🔒
Largest total size of a package’s extracted files, in bytes.
MAX_FILES 🔒
Most entries a package may contain.

Functions§

add_example_widget
Adds the example widget to the widgets folder once. A hidden marker file records that it was added, so an uninstalled example stays uninstalled and an edited copy is never replaced. Development builds only.
app_supports
Whether this build runs a widget that needs minimum. Debug builds run unreleased code, so they accept every minimum.
discover_installed
Reads every installed widget, sorted by ID. Hidden folders, such as staging folders, are skipped, and each unreadable widget yields an error.
extract_archive 🔒
Extracts a ZIP into staging, rejecting unsafe or duplicate paths, symlinks, too many entries, and oversized content.
folder_fingerprint
A cheap fingerprint of a folder’s files: their paths, sizes, and modification times, skipping hidden ones. Development builds only.
install_archive
Installs a widget package, replacing any installed version only after every check passes.
local_catalogue
Builds an unsigned catalogue from the widget folders in roots, packaging each one in memory so installs run the same checks as catalogue packages. Missing folders list no widgets. Development builds only.
local_image_url 🔒
A data: URL for an image inside a widget folder, or None when the path leaves the folder, isn’t a supported image type, or can’t be read. Development builds only.
meets_minimum 🔒
Whether app is at least minimum. Pre-release labels are ignored, so 0.5.0 accepts 0.5.0-beta. A missing minimum accepts every version, and an invalid one accepts none.
needs_newer_app
The error for a widget that needs a newer Toolblox.
package_folder
Packages a widget folder as a ZIP, skipping hidden files and rejecting symbolic links. Development builds only.
read_installed 🔒
Reads an installed widget and checks its install record, including that widget.json hasn’t changed since install. Debug builds accept widgets without a record.
read_manifest 🔒
Reads and validates widget.json, which may be at most 128 KB.
reinstall_from_folder
Packages a working-tree widget folder and installs it, with the same checks as a catalogue package, when the package differs from installed_sha256. Calls before_install first. Returns whether it installed. Development builds only.
replace_atomically 🔒
Moves staging to destination, keeping the old folder in backup and restoring it if the move fails.
uninstall_widget
Removes an installed widget’s folder. A missing widget succeeds.
validate_archive_path 🔒
Rejects archive paths with parent, root, or drive components.
validate_https_origin 🔒
Accepts bare HTTPS origins, such as https://example.com, without a path, query, or credentials.
validate_process_id 🔒
Accepts IDs of 1 to 64 ASCII letters, digits, _, and -.
validate_relative_file 🔒
Requires a non-empty relative path that doesn’t leave the package.
validate_sha256 🔒
Requires 64 hex characters.
validate_widget_id 🔒
Accepts IDs of 1 to 64 lowercase letters, digits, and underscores.
verify_signature 🔒
Verifies a base64 Ed25519 signature with a base64 raw 32-byte public key.
write_installed_metadata 🔒
Writes .installed.json for a staged widget.