Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/scripts/enable-updater-artifacts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Turn on Tauri's signed updater files for a desktop release build.
//
// Kept out of tauri.desktop.conf.json on purpose: with it on, every
// `tauri build` needs TAURI_SIGNING_PRIVATE_KEY, which only CI has.
// Run after the desktop config has been copied to src-tauri/tauri.conf.json.
import { readFileSync, writeFileSync } from "node:fs";

const path = "src-tauri/tauri.conf.json";
const config = JSON.parse(readFileSync(path, "utf8"));

if (!config.plugins?.updater?.pubkey) {
throw new Error(`${path} has no updater public key; is it the desktop config?`);
}

config.bundle = { ...config.bundle, createUpdaterArtifacts: true };
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`);
console.log(`Enabled updater artifacts in ${path}`);
131 changes: 131 additions & 0 deletions .github/scripts/updater-manifest.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Build the `latest.json` the in-app updater reads (src-tauri/src/app_update.rs).
//
// Every release, pre-releases included, carries its own manifest, and the app
// asks for exactly `releases/download/<tag>/latest.json`.
//
// The updater looks up `<os>-<arch>-<installer>` first and falls back to
// `<os>-<arch>` (tauri-plugin-updater 2.12, `get_urls`); the installer part is
// only known when the bundler stamped it into the binary, so both are written.

import { createHash, createPublicKey, verify } from "node:crypto";

/**
* Check a Tauri updater signature the way the app will, so a release signed
* with the wrong key, or changed after signing, fails here and not on users'
* machines. Both values are base64 of minisign text files.
*
* @param {object} input
* @param {string} input.pubkey `plugins.updater.pubkey` from the app config
* @param {string} input.signature contents of the `.sig` file
* @param {Buffer} input.data the signed file
*/
export function verifySignature({ pubkey, signature, data }) {
const key = minisignLine(pubkey, "public key");
const sig = minisignLine(signature, "signature");
if (key.length !== 42 || sig.length !== 74) throw new Error("Malformed key or signature");

const keyId = key.subarray(2, 10);
if (!sig.subarray(2, 10).equals(keyId)) {
throw new Error(
`Signed with key ${hex(sig.subarray(2, 10))}, but the app trusts ${hex(keyId)}`,
);
}

// "ED" signs the BLAKE2b-512 hash of the file (what Tauri writes); "Ed" the file itself.
const algorithm = sig.subarray(0, 2).toString("latin1");
let message;
if (algorithm === "ED") message = createHash("blake2b512").update(data).digest();
else if (algorithm === "Ed") message = data;
else throw new Error(`Unknown signature algorithm ${algorithm}`);

const publicKey = createPublicKey({
key: { kty: "OKP", crv: "Ed25519", x: key.subarray(10).toString("base64url") },
format: "jwk",
});
if (!verify(null, message, publicKey, sig.subarray(10))) {
throw new Error("Signature does not match the file");
}
}

/** The binary second line of a minisign key or signature file. */
function minisignLine(base64Text, what) {
const lines = Buffer.from(base64Text.trim(), "base64").toString("utf8").split("\n");
if (!lines[0]?.startsWith("untrusted comment:") || !lines[1]) {
throw new Error(`Not a minisign ${what}`);
}
return Buffer.from(lines[1].trim(), "base64");
}

const hex = (bytes) => bytes.toString("hex").toUpperCase();

/** Signature file name pattern → the manifest keys it serves. */
const PLATFORMS = [
{ pattern: /_amd64\.AppImage\.sig$/, keys: ["linux-x86_64-appimage", "linux-x86_64"] },
{ pattern: /_aarch64\.AppImage\.sig$/, keys: ["linux-aarch64-appimage", "linux-aarch64"] },
{ pattern: /_aarch64\.app\.tar\.gz\.sig$/, keys: ["darwin-aarch64-app", "darwin-aarch64"] },
{ pattern: /_(x64|x86_64)\.app\.tar\.gz\.sig$/, keys: ["darwin-x86_64-app", "darwin-x86_64"] },
// NSIS is the default for Windows: it can update in place without admin rights.
{ pattern: /_x64-setup\.exe\.sig$/, keys: ["windows-x86_64-nsis", "windows-x86_64"] },
{ pattern: /_x64_[A-Za-z-]+\.msi\.sig$/, keys: ["windows-x86_64-msi"] },
];

/**
* Every platform a desktop release builds; a missing one fails the release.
* The app asks for `windows-x86_64-msi` / `-nsis` by name (app_update.rs), and
* an explicit target has no fallback, so both must be present.
*/
export const REQUIRED = [
"windows-x86_64",
"windows-x86_64-nsis",
"windows-x86_64-msi",
"darwin-aarch64",
"darwin-x86_64",
"linux-x86_64",
"linux-aarch64",
];

/**
* @param {object} input
* @param {string} input.repo `owner/name`
* @param {string} input.tag release tag, e.g. `v1.0.4`
* @param {string} input.notes
* @param {string} input.pubDate RFC 3339
* @param {{ name: string, signature?: string }[]} input.assets
* release assets; `.sig` assets carry their file contents in `signature`
*/
export function buildManifest({ repo, tag, notes, pubDate, assets }) {
const names = new Set(assets.map((a) => a.name));
const platforms = {};

for (const asset of assets) {
const platform = PLATFORMS.find((p) => p.pattern.test(asset.name));
if (!platform) continue;

const target = asset.name.slice(0, -".sig".length);
if (!names.has(target)) {
throw new Error(`${asset.name} has no matching ${target} in the release`);
}
const signature = asset.signature?.trim();
if (!signature) throw new Error(`${asset.name} is empty`);

for (const key of platform.keys) {
if (platforms[key]) throw new Error(`Two release assets claim ${key}`);
platforms[key] = {
signature,
url: `https://github.com/${repo}/releases/download/${tag}/${encodeURIComponent(target)}`,
};
}
}

const missing = REQUIRED.filter((key) => !platforms[key]);
if (missing.length > 0) {
throw new Error(`No signed update for: ${missing.join(", ")}`);
}

return {
version: tag.replace(/^v/, ""),
notes,
pub_date: pubDate,
platforms,
};
}
121 changes: 120 additions & 1 deletion .github/workflows/release-tauri-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ jobs:
run: |
cp -f src-tauri/tauri.desktop.conf.json src-tauri/tauri.conf.json

- name: Enable signed update files
run: node .github/scripts/enable-updater-artifacts.mjs

- name: Set up cross-compilation environment for armv7
if: matrix.arch == 'armv7'
run: |
Expand All @@ -203,9 +206,13 @@ jobs:
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.releaseId }}
args: --verbose --features holochain_bundled --target ${{ matrix.target }}
# latest.json is written once, by publish-updater-manifest, after all builds.
includeUpdaterJson: false

- name: Upload aarch64 AppImage for Ubuntu Touch job
if: matrix.arch == 'aarch64'
Expand Down Expand Up @@ -381,13 +388,22 @@ jobs:
run: |
Copy-Item -Path src-tauri\tauri.desktop.conf.json -Destination src-tauri\tauri.conf.json

- name: Enable signed update files
run: node .github/scripts/enable-updater-artifacts.mjs

- name: Build the App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
args: --verbose --features holochain_bundled
includeUpdaterJson: false

# Code signing changes the installer bytes, so the updater signatures
# (.sig) the build wrote no longer match. If this step is turned back on,
# "Re-sign update files" below must run after it, before the upload.
- name: Sign the App
if: false
run: |
Expand Down Expand Up @@ -424,6 +440,26 @@ jobs:
CertUtil -hashfile $BUNDLE_OUT_PATH_1 SHA256
CertUtil -hashfile $BUNDLE_OUT_PATH_2 SHA256

# Sign the final installers for the in-app updater. Runs always: without
# code signing it reproduces what the build wrote; with it, it replaces
# signatures that no longer match. The installers must not change after this.
- name: Re-sign update files
shell: powershell
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
run: |
$ErrorActionPreference = "Stop"
$nsis = @(Get-ChildItem src-tauri\target\release\bundle\nsis\*-setup.exe)
$msi = @(Get-ChildItem src-tauri\target\release\bundle\msi\*.msi)
if ($nsis.Count -eq 0 -or $msi.Count -eq 0) { throw "Expected both an NSIS and an MSI installer to sign" }
$installers = $nsis + $msi
foreach ($installer in $installers) {
npx tauri signer sign --private-key "$env:TAURI_SIGNING_PRIVATE_KEY" --password "$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD" "$($installer.FullName)"
if ($LASTEXITCODE -ne 0) { throw "Signing $($installer.Name) failed" }
if (-not (Test-Path "$($installer.FullName).sig")) { throw "No signature written for $($installer.Name)" }
}

- name: Upload the Signed App
uses: AButler/upload-release-assets@v3.0
with:
Expand Down Expand Up @@ -485,10 +521,15 @@ jobs:
ls -la
ls -la src-tauri

- name: Enable signed update files
run: node .github/scripts/enable-updater-artifacts.mjs

- name: Build the App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
Expand All @@ -499,6 +540,7 @@ jobs:
with:
releaseId: ${{ needs.create-release.outputs.releaseId }}
args: --verbose --features holochain_bundled --target ${{ matrix.target }}
includeUpdaterJson: false

release-tauri-app-ubuntu-touch:
name: Build Ubuntu Touch click
Expand Down Expand Up @@ -558,4 +600,81 @@ jobs:
with:
files: "ut/build/aarch64-linux-gnu/app/*.click"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ needs.create-release.outputs.releaseId }}
release-id: ${{ needs.create-release.outputs.releaseId }}
# The in-app updater (desktop only) reads releases/download/<tag>/latest.json.
# Written once, after every desktop build has uploaded its installer and
# updater signature, so parallel jobs cannot overwrite each other's entries.
publish-updater-manifest:
needs:
- create-release
- release-tauri-app-linux
- release-tauri-app-windows
- release-tauri-app-macos
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Write latest.json to the release
uses: actions/github-script@v7
env:
RELEASE_ID: ${{ needs.create-release.outputs.releaseId }}
with:
script: |
const fs = require("node:fs");
const { buildManifest, verifySignature } = await import(
`${process.env.GITHUB_WORKSPACE}/.github/scripts/updater-manifest.mjs`
);
const { owner, repo } = context.repo;
const release_id = Number(process.env.RELEASE_ID);
const tag = context.ref.replace("refs/tags/", "");
// The key the shipped app trusts, not whatever the secret holds.
const pubkey = JSON.parse(
fs.readFileSync("src-tauri/tauri.desktop.conf.json", "utf8"),
).plugins.updater.pubkey;

const listed = await github.paginate(github.rest.repos.listReleaseAssets, {
owner, repo, release_id, per_page: 100,
});
const download = async (asset) => {
const { data } = await github.request(
"GET /repos/{owner}/{repo}/releases/assets/{asset_id}",
{ owner, repo, asset_id: asset.id, headers: { accept: "application/octet-stream" } },
);
return Buffer.from(data);
};

const assets = [];
for (const asset of listed) {
if (asset.name === "latest.json") continue;
let signature;
if (asset.name.endsWith(".sig")) {
signature = (await download(asset)).toString("utf8");
const target = listed.find((a) => `${a.name}.sig` === asset.name);
if (target) {
verifySignature({ pubkey, signature, data: await download(target) });
core.info(`${target.name}: updater signature valid`);
}
}
assets.push({ name: asset.name, signature });
}

const manifest = buildManifest({
repo: `${owner}/${repo}`,
tag,
notes: `See https://github.com/${owner}/${repo}/releases/tag/${tag}`,
pubDate: new Date().toISOString(),
assets,
});
core.info(JSON.stringify(manifest, null, 2));

for (const old of listed.filter((a) => a.name === "latest.json")) {
await github.rest.repos.deleteReleaseAsset({ owner, repo, asset_id: old.id });
}
await github.rest.repos.uploadReleaseAsset({
owner, repo, release_id,
name: "latest.json",
data: JSON.stringify(manifest, null, 2),
headers: { "content-type": "application/json" },
});
19 changes: 19 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- develop
- main
# Maintenance lines, e.g. release/1.0 for 1.x releases.
- "release/**"
workflow_dispatch:

# Cancel an in-progress run when new commits are pushed to the same PR.
Expand Down Expand Up @@ -47,10 +49,27 @@ jobs:
with:
name: darksoil-studio

# Reuses compiled dependencies between runs: the zome workspace and the
# app crate, which embeds a full Holochain conductor.
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
src-tauri -> target

# `npm test` builds the zomes (wasm), packs the .happ, then runs the
# Tryorama/Vitest suite in the `tests` workspace against that .happ.
- name: Install and run tests
run: |
nix develop --no-update-lock-file --accept-flake-config --command bash -c "npm install && npm test"
env:
CARGO_REGISTRIES_CARGO_HOSTED_TOKEN: ${{ secrets.VOLLA_NEXUS_TOKEN }}

# Unit tests of the app crate (keystore carry-over, export file
# handling). Runs after `npm test` because the crate embeds the .happ
# that step builds.
- name: Run app unit tests
run: |
nix develop --no-update-lock-file --accept-flake-config --command bash -c "cd src-tauri && cargo test --features holochain_bundled --lib"
env:
CARGO_REGISTRIES_CARGO_HOSTED_TOKEN: ${{ secrets.VOLLA_NEXUS_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [1.0.4] - 2026-10-27

- Fix: Version 1.0.3 could archive active one-to-one and private conversations on its own. This no longer happens. If 1.0.3 archived some of your chats, open your archived conversations and un-archive them; nothing in them was lost.
- Feat: The app now tells you when a new version is available. On Windows, macOS and the Linux AppImage you can install it from inside the app; on Android it opens F-Droid, and on Ubuntu Touch the OpenStore.
- Feat: Your message history and the images in your conversations, archived ones included, are now saved too, so they can come with you into the next major update. This happens automatically in the background and only adds new messages and images after the first run.
- Fix: The saved copy of your account is now readable only by your own user on Linux and macOS.

## [1.0.3] - 2026-09-12

- Fix: The app could hang forever on the "Starting up..." screen, most often on faster machines. Holochain had actually started correctly; the app just never noticed and kept waiting.
Expand Down
Loading
Loading