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

@@ -2,6 +2,8 @@ const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
const crypto = require('crypto');
const UpdateClient = require('./update-client');
const GITLAB_PROJECT_PATH = 'vyla-entertainment%2Fhome';
const PROJECT_ID = process.env.CI_PROJECT_ID || GITLAB_PROJECT_PATH;
@@ -217,6 +219,24 @@ async function main() {
}
}
if (installerPath && installerUploadName && process.platform === 'win32') {
const signingKey = process.env.VYLA_UPDATE_SIGNING_KEY;
if (!signingKey) {
throw new Error('VYLA_UPDATE_SIGNING_KEY is required to sign the installer entry.');
}
const installerBuf = fs.readFileSync(installerPath);
const signedManifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
signedManifest.installer = {
file: installerUploadName,
sha256: crypto.createHash('sha256').update(installerBuf).digest('hex'),
size: installerBuf.length,
version: version.replace(/^v/, '')
};
delete signedManifest.signature;
signedManifest.signature = crypto.sign(null, Buffer.from(UpdateClient.canonicalManifest(signedManifest)), signingKey.replace(/\\n/g, '\n')).toString('base64');
fs.writeFileSync(manifestPath, JSON.stringify(signedManifest, null, 2), 'utf8');
}
console.log('[2/4] Uploading artifacts to GitLab Package Registry...');
const timestamp = Date.now();