feat: add signed Windows launcher self-updates with SHA-256 verification

This commit is contained in:
2026-10-30 22:50:07 -07:00
parent 79dd5e7465
commit 3e2dbd312e
6 changed files with 150 additions and 4 deletions

View File

@@ -43,7 +43,12 @@ function canonicalManifest(manifest) {
const c = manifest.components[name];
return `${name}:${c.file}:${c.sha256}:${c.id}:${c.size}`;
});
return ['vyla-manifest-v2', normalizeTag(manifest.version), manifest.sha256, ...parts].join('\n');
const lines = ['vyla-manifest-v2', normalizeTag(manifest.version), manifest.sha256, ...parts];
if (manifest.installer) {
const i = manifest.installer;
lines.push(`installer:${i.file}:${i.sha256}:${i.size}:${normalizeTag(i.version)}`);
}
return lines.join('\n');
}
function verifyManifest(manifest) {
@@ -381,11 +386,25 @@ class UpdateClient {
components[name] = { url: link.url, sha256: c.sha256, id: c.id, size: c.size };
}
let installer = null;
if (manifest.installer) {
const installerLink = links.find((a) => a.name === manifest.installer.file);
if (installerLink) {
installer = {
url: installerLink.url,
sha256: manifest.installer.sha256,
size: manifest.installer.size,
version: manifest.installer.version
};
}
}
const out = {
version: release.tag_name,
sha256: manifest.sha256 || null,
manifest,
components
components,
installer
};
this.writeCache({ checkedAt: now, etag: result.etag || null, release: out });
return out;