Skip to content

📧✨ Beautiful email. For everyone.

feat: sign Windows releases with Certum (#16)

Paul Koeck4c2d888a6de6
diff --git a/.github/scripts/configure-simplysign.ps1 b/.github/scripts/configure-simplysign.ps1
new file mode 100644
index 0000000..3bf8f10
--- /dev/null
+++ b/.github/scripts/configure-simplysign.ps1
@@ -0,0 +1,254 @@
+# Ported from blinkdisk/blinkdisk .github/scripts/configure-simplysign.ps1.
+# Keep these settings in sync with its working automated login setup.
+param(
+ [switch]$DebugMode = $false,
+ [switch]$VerifyOnly = $false
+)
+
+# SimplySign Desktop Registry Configuration Script
+# Pre-configures optimal registry settings for automated login dialog display
+
+Write-Host "=== SimplySign Desktop Registry Configuration ==="
+
+if ($DebugMode) {
+ Write-Host "Debug mode enabled - verbose logging active"
+}
+
+# Registry path for SimplySign Desktop settings
+$RegistryPath = "HKCU:\Software\Certum\SimplySign"
+
+# Optimal configuration values for automation
+$OptimalSettings = @{
+ "ShowLoginDialogOnStart" = 1
+ "ShowLoginDialogOnAppRequest" = 1
+ "RememberLastUserName" = 0
+ "Autostart" = 0
+ "UnregisterCertificatesOnDisconnect" = 0
+ "RememberPINinCSP" = 1
+ "ForgetPINinCSPonDisconnect" = 1
+ "LangID" = 9
+}
+
+# Function to check if registry path exists
+function Test-RegistryPath {
+ param([string]$Path)
+
+ try {
+ $null = Get-Item -Path $Path -ErrorAction Stop
+ return $true
+ } catch {
+ return $false
+ }
+}
+
+# Function to get current registry value
+function Get-RegistryValue {
+ param(
+ [string]$Path,
+ [string]$Name
+ )
+
+ try {
+ $value = Get-ItemProperty -Path $Path -Name $Name -ErrorAction Stop
+ return $value.$Name
+ } catch {
+ return $null
+ }
+}
+
+# Function to set registry value safely
+function Set-RegistryValue {
+ param(
+ [string]$Path,
+ [string]$Name,
+ [int]$Value
+ )
+
+ try {
+ Set-ItemProperty -Path $Path -Name $Name -Value $Value -Type DWord -ErrorAction Stop
+ if ($DebugMode) {
+ Write-Host " Set $Name = $Value"
+ }
+ return $true
+ } catch {
+ Write-Host " ERROR: Failed to set $Name = $Value - $($_.Exception.Message)"
+ return $false
+ }
+}
+
+# Function to display current settings
+function Show-CurrentSettings {
+ Write-Host "Current SimplySign Desktop registry settings:"
+ Write-Host "============================================="
+
+ if (-not (Test-RegistryPath $RegistryPath)) {
+ Write-Host "Registry path does not exist: $RegistryPath"
+ return
+ }
+
+ foreach ($setting in $OptimalSettings.Keys) {
+ $currentValue = Get-RegistryValue -Path $RegistryPath -Name $setting
+ if ($null -eq $currentValue) {
+ Write-Host " $setting : NOT SET"
+ } else {
+ Write-Host " $setting : $currentValue"
+ }
+ }
+ Write-Host ""
+}
+
+# Function to create registry structure
+function Initialize-RegistryStructure {
+ Write-Host "Initializing registry structure..."
+
+ # Create parent keys if they don't exist
+ $ParentPaths = @(
+ "HKCU:\Software\Certum",
+ $RegistryPath
+ )
+
+ $allCreated = $true
+ foreach ($path in $ParentPaths) {
+ if (-not (Test-RegistryPath $path)) {
+ try {
+ New-Item -Path $path -Force -ErrorAction Stop | Out-Null
+ if ($DebugMode) {
+ Write-Host " Created registry path: $path"
+ }
+ } catch {
+ Write-Host " ERROR: Failed to create registry path: $path - $($_.Exception.Message)"
+ $allCreated = $false
+ }
+ } else {
+ if ($DebugMode) {
+ Write-Host " Registry path exists: $path"
+ }
+ }
+ }
+
+ return $allCreated
+}
+
+# Function to apply optimal configuration
+function Set-OptimalConfiguration {
+ Write-Host "Applying optimal configuration for automation..."
+
+ $successCount = 0
+ $totalSettings = $OptimalSettings.Count
+
+ foreach ($setting in $OptimalSettings.Keys) {
+ $value = $OptimalSettings[$setting]
+ if (Set-RegistryValue -Path $RegistryPath -Name $setting -Value $value) {
+ $successCount++
+ }
+ }
+
+ Write-Host "Applied $successCount of $totalSettings settings successfully"
+ return ($successCount -eq $totalSettings)
+}
+
+# Function to verify configuration
+function Test-Configuration {
+ Write-Host "Verifying configuration..."
+
+ $verificationResults = @{}
+ $allCorrect = $true
+
+ foreach ($setting in $OptimalSettings.Keys) {
+ $expectedValue = $OptimalSettings[$setting]
+ $actualValue = Get-RegistryValue -Path $RegistryPath -Name $setting
+
+ $isCorrect = ($actualValue -eq $expectedValue)
+ $verificationResults[$setting] = @{
+ Expected = $expectedValue
+ Actual = $actualValue
+ Correct = $isCorrect
+ }
+
+ if (-not $isCorrect) {
+ $allCorrect = $false
+ }
+
+ if ($DebugMode -or -not $isCorrect) {
+ $status = if ($isCorrect) { "OK" } else { "MISMATCH" }
+ Write-Host " $setting : Expected=$expectedValue, Actual=$actualValue [$status]"
+ }
+ }
+
+ return $verificationResults, $allCorrect
+}
+
+# Main execution
+try {
+ Write-Host "Starting registry configuration process..."
+ Write-Host ""
+
+ # Show current state
+ Write-Host "BEFORE CONFIGURATION:"
+ Show-CurrentSettings
+
+ if ($VerifyOnly) {
+ Write-Host "Verification-only mode - no changes will be made"
+ $verificationResults, $allCorrect = Test-Configuration
+
+ if ($allCorrect) {
+ Write-Host "SUCCESS: All settings are correctly configured"
+ exit 0
+ } else {
+ Write-Host "CONFIGURATION NEEDED: Some settings require adjustment"
+ exit 1
+ }
+ }
+
+ # Initialize registry structure
+ if (-not (Initialize-RegistryStructure)) {
+ Write-Host "FATAL ERROR: Failed to initialize registry structure"
+ exit 1
+ }
+
+ # Apply optimal configuration
+ if (-not (Set-OptimalConfiguration)) {
+ Write-Host "ERROR: Failed to apply complete configuration"
+ exit 1
+ }
+
+ Write-Host ""
+ Write-Host "AFTER CONFIGURATION:"
+ Show-CurrentSettings
+
+ # Verify the configuration was applied correctly
+ $verificationResults, $allCorrect = Test-Configuration
+
+ if ($allCorrect) {
+ Write-Host "SUCCESS: Registry configuration completed successfully"
+ Write-Host ""
+ Write-Host "Key automation settings enabled:"
+ Write-Host " ShowLoginDialogOnStart = 1 (Login dialog will appear automatically)"
+ Write-Host " ShowLoginDialogOnAppRequest = 1 (Dialog appears when apps request access)"
+ Write-Host " RememberLastUserName = 0 (Username persistence for efficiency)"
+ Write-Host ""
+ Write-Host "Next steps:"
+ Write-Host "1. Launch SimplySign Desktop"
+ Write-Host "2. Login dialog should appear automatically"
+ Write-Host "3. Complete authentication process"
+
+ # Create a status file for the workflow to check
+ "REGISTRY_CONFIGURATION_SUCCESS" | Out-File -FilePath "registry_config_status.log" -Encoding UTF8
+
+ exit 0
+ } else {
+ Write-Host "ERROR: Configuration verification failed"
+ Write-Host "Some settings were not applied correctly"
+
+ "REGISTRY_CONFIGURATION_PARTIAL" | Out-File -FilePath "registry_config_status.log" -Encoding UTF8
+
+ exit 1
+ }
+
+} catch {
+ Write-Host "FATAL ERROR: Registry configuration failed - $($_.Exception.Message)"
+
+ "REGISTRY_CONFIGURATION_FAILED" | Out-File -FilePath "registry_config_status.log" -Encoding UTF8
+
+ exit 1
+}
diff --git a/.github/scripts/connect-simplysign.ps1 b/.github/scripts/connect-simplysign.ps1
new file mode 100644
index 0000000..96310dd
--- /dev/null
+++ b/.github/scripts/connect-simplysign.ps1
@@ -0,0 +1,266 @@
+# Connect-SimplySign-Enhanced.ps1
+# Ported from blinkdisk/blinkdisk .github/scripts/connect-simplysign.ps1.
+# Registry-Enhanced TOTP Authentication for SimplySign Desktop
+# Uses registry pre-configuration + TOTP credential injection approach
+# Based on Devas.life article: https://www.devas.life/how-to-automate-signing-your-windows-app-with-certum/
+
+param(
+ [string]$OtpUri = $env:CERTUM_OTP_URI,
+ [string]$UserId = $env:CERTUM_USERNAME,
+ [string]$ExePath = $env:CERTUM_EXE_PATH,
+ [string]$CertificateSha1 = $env:CERTUM_CERTIFICATE_SHA1
+)
+
+$ErrorActionPreference = 'Stop'
+
+# Validate required parameters
+if (-not $OtpUri) {
+ Write-Host "ERROR: CERTUM_OTP_URI environment variable not provided"
+ exit 1
+}
+
+if (-not $UserId) {
+ Write-Host "ERROR: CERTUM_USERNAME environment variable not provided"
+ exit 1
+}
+
+$CertificateSha1 = ($CertificateSha1 -replace '\s', '').ToUpperInvariant()
+if ($CertificateSha1 -notmatch '^[A-F0-9]{40}$') {
+ throw 'CERTUM_CERTIFICATE_SHA1 must be the 40-character SHA-1 certificate thumbprint'
+}
+
+if (-not $ExePath) {
+ $ExePath = "C:\Program Files\Certum\SimplySign Desktop\SimplySignDesktop.exe"
+}
+
+Write-Host "=== REGISTRY-ENHANCED TOTP AUTHENTICATION ==="
+Write-Host "Using registry pre-configuration + credential injection"
+Write-Host "Executable: $ExePath"
+Write-Host ""
+
+# Verify SimplySign Desktop exists
+if (-not (Test-Path $ExePath)) {
+ Write-Host "ERROR: SimplySign Desktop not found at: $ExePath"
+ exit 1
+}
+
+# Parse the otpauth:// URI
+$uri = [Uri]$OtpUri
+if ($uri.Scheme -ne 'otpauth' -or $uri.Host -ne 'totp') {
+ throw 'CERTUM_OTP_URI must be an otpauth://totp URI'
+}
+
+# Parse query parameters (compatible with both PowerShell 5.1 and 7+)
+try {
+ $q = [System.Web.HttpUtility]::ParseQueryString($uri.Query)
+} catch {
+ $q = @{}
+ foreach ($part in $uri.Query.TrimStart('?') -split '&') {
+ $kv = $part -split '=', 2
+ if ($kv.Count -eq 2) {
+ $q[$kv[0]] = [Uri]::UnescapeDataString($kv[1])
+ }
+ }
+}
+
+$Base32 = $q['secret']
+$Digits = if ($q['digits']) { [int]$q['digits'] } else { 6 }
+$Period = if ($q['period']) { [int]$q['period'] } else { 30 }
+$Algorithm = if ($q['algorithm']) { $q['algorithm'].ToUpper() } else { 'SHA256' }
+if (-not $Base32 -or $Digits -lt 6 -or $Digits -gt 8 -or $Period -le 0) {
+ throw 'CERTUM_OTP_URI must contain a secret and valid TOTP digits and period'
+}
+
+# Validate supported algorithms
+$SupportedAlgorithms = @('SHA1', 'SHA256', 'SHA512')
+if ($Algorithm -notin $SupportedAlgorithms) {
+ Write-Host "ERROR: Unsupported algorithm: $Algorithm. Supported: $($SupportedAlgorithms -join ', ')"
+ exit 1
+}
+
+# TOTP Generator (inline C# implementation)
+Add-Type -Language CSharp @"
+using System;
+using System.Security.Cryptography;
+
+public static class Totp
+{
+ private const string B32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+
+ private static byte[] Base32Decode(string s)
+ {
+ s = s.TrimEnd('=').ToUpperInvariant();
+ int byteCount = s.Length * 5 / 8;
+ byte[] bytes = new byte[byteCount];
+
+ int bitBuffer = 0, bitsLeft = 0, idx = 0;
+ foreach (char c in s)
+ {
+ int val = B32.IndexOf(c);
+ if (val < 0) throw new ArgumentException("Invalid Base32 char: " + c);
+
+ bitBuffer = (bitBuffer << 5) | val;
+ bitsLeft += 5;
+
+ if (bitsLeft >= 8)
+ {
+ bytes[idx++] = (byte)(bitBuffer >> (bitsLeft - 8));
+ bitsLeft -= 8;
+ }
+ }
+ return bytes;
+ }
+
+ private static HMAC GetHmacAlgorithm(string algorithm, byte[] key)
+ {
+ switch (algorithm.ToUpper())
+ {
+ case "SHA1":
+ return new HMACSHA1(key);
+ case "SHA256":
+ return new HMACSHA256(key);
+ case "SHA512":
+ return new HMACSHA512(key);
+ default:
+ throw new ArgumentException("Unsupported algorithm: " + algorithm);
+ }
+ }
+
+ public static string Now(string secret, int digits, int period, string algorithm = "SHA256")
+ {
+ byte[] key = Base32Decode(secret);
+ long counter = DateTimeOffset.UtcNow.ToUnixTimeSeconds() / period;
+
+ byte[] cnt = BitConverter.GetBytes(counter);
+ if (BitConverter.IsLittleEndian) Array.Reverse(cnt);
+
+ byte[] hash;
+ using (var hmac = GetHmacAlgorithm(algorithm, key))
+ {
+ hash = hmac.ComputeHash(cnt);
+ }
+
+ int offset = hash[hash.Length - 1] & 0x0F;
+ int binary =
+ ((hash[offset] & 0x7F) << 24) |
+ ((hash[offset + 1] & 0xFF) << 16) |
+ ((hash[offset + 2] & 0xFF) << 8) |
+ (hash[offset + 3] & 0xFF);
+
+ int otp = binary % (int)Math.Pow(10, digits);
+ return otp.ToString(new string('0', digits));
+ }
+}
+"@
+
+function Get-TotpCode {
+ param([string]$Secret, [int]$Digits = 6, [int]$Period = 30, [string]$Algorithm = 'SHA256')
+ [Totp]::Now($Secret, $Digits, $Period, $Algorithm)
+}
+
+if ($existing = Get-Process -Name "SimplySignDesktop" -ea Ignore) {
+ Write-Host "Killing existing SimplySign Desktop process..."
+ $existing.Kill()
+}
+
+
+# Launch SimplySign Desktop (registry should auto-open login dialog)
+Write-Host "Launching SimplySign Desktop..."
+Write-Host "Registry pre-configuration should auto-open login dialog"
+$proc = Start-Process -FilePath $ExePath -PassThru
+Write-Host "Process started with ID: $($proc.Id)"
+Write-Host ""
+
+# Wait for the application to initialize
+Write-Host "Waiting for SimplySign Desktop to initialize..."
+Start-Sleep -Seconds 3
+
+# Create WScript.Shell for window interaction
+$wshell = New-Object -ComObject WScript.Shell
+
+# Try to focus the SimplySign Desktop window
+Write-Host "Attempting to focus SimplySign Desktop window..."
+$focused = $false
+
+# Method 1: Focus by process ID (most reliable)
+$focused = $wshell.AppActivate($proc.Id)
+
+# Method 2: Focus by window title (fallback)
+if (-not $focused) {
+ $focused = $wshell.AppActivate('SimplySign Desktop')
+}
+
+# Method 3: Multiple attempts with slight delays
+for ($i = 0; (-not $focused) -and ($i -lt 10); $i++) {
+ Start-Sleep -Milliseconds 500
+ $focused = $wshell.AppActivate($proc.Id) -or $wshell.AppActivate('SimplySign Desktop')
+ Write-Host "Focus attempt $($i + 1): $focused"
+}
+
+if (-not $focused) {
+ Write-Host "ERROR: Could not bring SimplySign Desktop to foreground"
+ Write-Host "Login dialog may not be visible for credential injection"
+ exit 1
+}
+
+Write-Host "Successfully focused SimplySign Desktop window"
+Write-Host ""
+
+# Small delay to ensure window is ready for input
+Start-Sleep -Milliseconds 400
+
+# Inject credentials: Username + TAB + TOTP + ENTER
+Write-Host "Injecting credentials into login dialog..."
+Write-Host "Sending: Username -> TAB -> TOTP -> ENTER"
+
+# Send the credential sequence
+# SendKeys treats these characters as commands; send the username literally.
+$escapedUserId = [regex]::Replace($UserId, '[+^%~(){}\[\]]', { param($match) '{' + $match.Value + '}' })
+$wshell.SendKeys($escapedUserId)
+Start-Sleep -Milliseconds 200
+$wshell.SendKeys("{TAB}")
+Start-Sleep -Milliseconds 200
+
+# Generate current TOTP code
+# Avoid submitting a code that is about to expire during credential injection.
+$remaining = $Period - ([DateTimeOffset]::UtcNow.ToUnixTimeSeconds() % $Period)
+if ($remaining -le 5) {
+ Start-Sleep -Seconds ($remaining + 1)
+}
+$otp = Get-TotpCode -Secret $Base32 -Digits $Digits -Period $Period -Algorithm $Algorithm
+if ($env:GITHUB_ACTIONS -eq 'true') {
+ Write-Host "::add-mask::$otp"
+}
+Write-Host "Generated TOTP using $Algorithm algorithm"
+Write-Host ""
+
+$wshell.SendKeys($otp)
+Start-Sleep -Milliseconds 200
+$wshell.SendKeys("{ENTER}")
+
+Write-Host "Credentials injected successfully"
+Write-Host ""
+
+# A running UI does not establish that login succeeded. Wait for the exact
+# signing certificate to become available before electron-builder starts.
+Write-Host 'Waiting for the Certum signing certificate...'
+$deadline = [DateTime]::UtcNow.AddSeconds(60)
+do {
+ if (-not (Get-Process -Id $proc.Id -ErrorAction SilentlyContinue)) {
+ throw 'SimplySign Desktop exited before the signing certificate became available'
+ }
+ $certificate = Get-ChildItem -Path Cert:\CurrentUser\My, Cert:\LocalMachine\My -CodeSigningCert |
+ Where-Object { $_.Thumbprint -eq $CertificateSha1 } |
+ Select-Object -First 1
+ if ($certificate) {
+ $now = Get-Date
+ if ($certificate.NotBefore -gt $now -or $certificate.NotAfter -le $now) {
+ throw 'The Certum signing certificate is not currently valid'
+ }
+ Write-Host 'Certum signing certificate is available'
+ exit 0
+ }
+ Start-Sleep -Seconds 2
+} while ([DateTime]::UtcNow -lt $deadline)
+
+throw 'Certum login did not make the requested signing certificate available within 60 seconds'
diff --git a/.github/scripts/install-simplysign.sh b/.github/scripts/install-simplysign.sh
new file mode 100755
index 0000000..71ee674
--- /dev/null
+++ b/.github/scripts/install-simplysign.sh
@@ -0,0 +1,123 @@
+#!/bin/bash
+# Ported from blinkdisk/blinkdisk .github/scripts/install-simplysign.sh.
+# Keep the pinned installer and installation sequence used by BlinkDisk.
+
+set -euo pipefail
+
+echo "=== INSTALLING SIMPLYSIGN DESKTOP ==="
+echo "Using proven installation method from successful testing..."
+
+# Download SimplySign Desktop MSI
+CERTUM_INSTALLER="SimplySignDesktop.msi"
+echo "Downloading SimplySign Desktop MSI..."
+
+if curl -L "https://files.certum.eu/software/SimplySignDesktop/Windows/9.4.3.90/SimplySignDesktop-9.4.3.90-64-bit-en.msi" -o "$CERTUM_INSTALLER" --fail --max-time 600; then
+ echo "✅ Downloaded SimplySign Desktop MSI ($(ls -lh "$CERTUM_INSTALLER" | awk '{print $5}'))"
+else
+ echo "❌ Failed to download SimplySign Desktop"
+ exit 1
+fi
+
+EXPECTED_CHECKSUM="ce2b38ef0124a574bc08e5558726099caac79a7c58b8d3d712f629371fe1bcb7"
+ACTUAL_CHECKSUM=$(sha256sum "$CERTUM_INSTALLER" | awk '{print $1}')
+
+if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then
+ echo "❌ Checksum verification failed"
+ echo "Expected: $EXPECTED_CHECKSUM"
+ echo "Actual: $ACTUAL_CHECKSUM"
+ exit 1
+fi
+echo "✅ Checksum verified"
+
+# Install with proven method (matching successful test)
+echo "Installing SimplySign Desktop..."
+echo "Full command: msiexec /i \"$CERTUM_INSTALLER\" /quiet /norestart /l*v install.log ALLUSERS=1 REBOOT=ReallySuppress"
+
+# Check for administrative privileges (like the successful test)
+ADMIN_RIGHTS=false
+if powershell -Command "([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)" 2>/dev/null; then
+ echo "✅ Running with administrative privileges"
+ ADMIN_RIGHTS=true
+else
+ echo "⚠️ No explicit administrative privileges detected"
+fi
+
+# Use the exact method that worked: PowerShell with admin privileges
+if [ "$ADMIN_RIGHTS" = true ]; then
+ echo "Running MSI installation with administrator privileges..."
+ powershell -Command "Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', '\"$CERTUM_INSTALLER\"', '/quiet', '/norestart', '/l*v', 'install.log', 'ALLUSERS=1', 'REBOOT=ReallySuppress' -Wait -NoNewWindow -PassThru" &
+ INSTALL_PID=$!
+else
+ echo "Running MSI installation without explicit admin elevation..."
+ timeout 300 msiexec /i "$CERTUM_INSTALLER" /quiet /norestart /l*v install.log ALLUSERS=1 REBOOT=ReallySuppress &
+ INSTALL_PID=$!
+fi
+
+# Monitor with the same logic as successful test
+echo "Monitoring installation progress..."
+INSTALL_START_TIME=$(date +%s)
+sleep 10
+
+# Check if msiexec process is actually running (like successful test)
+if kill -0 $INSTALL_PID 2>/dev/null; then
+ echo "MSI installation process is running (PID: $INSTALL_PID)"
+
+ # Monitor for up to 3 minutes with status updates
+ for i in {1..18}; do
+ sleep 10
+ CURRENT_TIME=$(date +%s)
+ ELAPSED=$((CURRENT_TIME - INSTALL_START_TIME))
+
+ if kill -0 $INSTALL_PID 2>/dev/null; then
+ echo "Installation still running after ${ELAPSED} seconds..."
+
+ # Check log file growth
+ if [ -f "install.log" ]; then
+ LOG_SIZE=$(stat -c%s "install.log" 2>/dev/null || stat -f%z "install.log" 2>/dev/null || echo 0)
+ echo " Log file size: $LOG_SIZE bytes"
+ fi
+ else
+ echo "MSI installation completed after ${ELAPSED} seconds"
+ break
+ fi
+ done
+
+ # Final wait if still running
+ if kill -0 $INSTALL_PID 2>/dev/null; then
+ echo "Installation taking longer, waiting for completion..."
+ wait $INSTALL_PID 2>/dev/null || echo "Installation process ended"
+ fi
+else
+ echo "MSI installation process ended quickly"
+fi
+
+# Quick success check using proven patterns
+INSTALLATION_SUCCESSFUL=false
+if [ -f "install.log" ]; then
+ if grep -qi "Installation.*operation.*completed.*successfully\|Installation.*success.*or.*error.*status.*0\|MainEngineThread.*is.*returning.*0\|Windows.*Installer.*installed.*the.*product" install.log 2>/dev/null; then
+ echo "✅ Installation successful (confirmed by log patterns)"
+ INSTALLATION_SUCCESSFUL=true
+ fi
+fi
+
+# Verify installation directory
+INSTALL_PATH="/c/Program Files/Certum/SimplySign Desktop"
+if [ -d "$INSTALL_PATH" ]; then
+ echo "✅ SimplySign Desktop installed successfully"
+ echo "✅ Virtual card emulation now active for code signing"
+ INSTALLATION_SUCCESSFUL=true
+
+ # Set output for GitHub Actions
+ if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ echo "SIMPLYSIGN_PATH=$INSTALL_PATH" >> "$GITHUB_OUTPUT"
+ fi
+fi
+
+if [ "$INSTALLATION_SUCCESSFUL" = false ]; then
+ echo "❌ Installation verification failed"
+ echo "Last 10 lines of install log:"
+ tail -10 install.log 2>/dev/null || echo "No install log available"
+ exit 1
+fi
+
+echo "🎉 SimplySign Desktop installation completed successfully!"
diff --git a/.github/scripts/verify-windows-signatures.ps1 b/.github/scripts/verify-windows-signatures.ps1
new file mode 100644
index 0000000..983aa43
--- /dev/null
+++ b/.github/scripts/verify-windows-signatures.ps1
@@ -0,0 +1,33 @@
+param(
+ [string]$CertificateSha1 = $env:CERTUM_CERTIFICATE_SHA1,
+ [string]$ReleaseDirectory = 'apps/desktop/release'
+)
+
+$ErrorActionPreference = 'Stop'
+$CertificateSha1 = ($CertificateSha1 -replace '\s', '').ToUpperInvariant()
+if ($CertificateSha1 -notmatch '^[A-F0-9]{40}$') {
+ throw 'CERTUM_CERTIFICATE_SHA1 must be the 40-character SHA-1 certificate thumbprint'
+}
+
+$app = Join-Path $ReleaseDirectory 'win-unpacked/Inlark.exe'
+if (-not (Test-Path -LiteralPath $app -PathType Leaf)) {
+ throw "Packaged Windows app not found: $app"
+}
+$installers = @(Get-ChildItem -LiteralPath $ReleaseDirectory -Filter '*-setup.exe' -File)
+if ($installers.Count -ne 1) {
+ throw "Expected one Windows installer, found $($installers.Count)"
+}
+
+foreach ($file in @($app, $installers[0].FullName)) {
+ $signature = Get-AuthenticodeSignature -LiteralPath $file
+ if ($signature.Status -ne 'Valid') {
+ throw "Invalid Windows signature on ${file}: $($signature.Status)"
+ }
+ if ($signature.SignerCertificate.Thumbprint -ne $CertificateSha1) {
+ throw "Unexpected signing certificate on $file"
+ }
+ if (-not $signature.TimeStamperCertificate) {
+ throw "Missing signing timestamp on $file"
+ }
+ Write-Host "Verified Certum signature and timestamp: $file"
+}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index cff0974..bb4fd70 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -62,7 +62,7 @@ jobs:
run: |
for name in MAC_CSC_LINK MAC_CSC_KEY_PASSWORD APPLE_API_KEY APPLE_API_KEY_ID APPLE_API_ISSUER; do
if [ -z "${!name}" ]; then
- echo "::error::Missing macOS release credential: $name. See docs/releasing.md."
+ echo "::error::Missing macOS release credential: $name."
exit 1
fi
done
@@ -84,11 +84,50 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y rpm
- name: Build desktop app
run: pnpm build
+ - name: Prepare Windows signing with Certum
+ if: runner.os == 'Windows'
+ timeout-minutes: 15
+ shell: bash
+ env:
+ CERTUM_OTP_URI: ${{ secrets.CERTUM_OTP_URI }}
+ CERTUM_USERNAME: ${{ secrets.CERTUM_USERNAME }}
+ CERTUM_CERTIFICATE_SHA1: ${{ secrets.CERTUM_CERTIFICATE_SHA1 }}
+ run: |
+ for name in CERTUM_OTP_URI CERTUM_USERNAME CERTUM_CERTIFICATE_SHA1; do
+ if [ -z "${!name}" ]; then
+ echo "::error::Missing Windows release credential: $name."
+ exit 1
+ fi
+ done
+ bash .github/scripts/install-simplysign.sh
+ powershell -NoProfile -ExecutionPolicy Bypass -File .github/scripts/configure-simplysign.ps1
+ powershell -NoProfile -ExecutionPolicy Bypass -File .github/scripts/connect-simplysign.ps1
- name: Package desktop app
- if: runner.os != 'macOS'
+ if: runner.os == 'Linux'
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: pnpm --filter @inlark/desktop exec electron-builder ${{ matrix.args }} --publish never
+ - name: Sign and package Windows app
+ if: runner.os == 'Windows'
+ shell: pwsh
+ env:
+ CERTUM_CERTIFICATE_SHA1: ${{ secrets.CERTUM_CERTIFICATE_SHA1 }}
+ CERTUM_TIMESTAMP_SERVER: ${{ vars.CERTUM_TIMESTAMP_SERVER || 'http://time.certum.pl' }}
+ run: |
+ $intermediate = Join-Path $env:RUNNER_TEMP 'certum.cer'
+ Invoke-WebRequest -Uri https://repository.certum.pl/ccsca2021.cer -OutFile $intermediate
+ $thumbprint = ($env:CERTUM_CERTIFICATE_SHA1 -replace '\s', '').ToUpperInvariant()
+ pnpm --filter @inlark/desktop exec electron-builder ${{ matrix.args }} --publish never `
+ "--config.win.signtoolOptions.certificateSha1=$thumbprint" `
+ "--config.win.signtoolOptions.additionalCertificateFile=$intermediate" `
+ "--config.win.signtoolOptions.rfc3161TimeStampServer=$env:CERTUM_TIMESTAMP_SERVER"
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - name: Verify signed Windows app and installer
+ if: runner.os == 'Windows'
+ shell: pwsh
+ env:
+ CERTUM_CERTIFICATE_SHA1: ${{ secrets.CERTUM_CERTIFICATE_SHA1 }}
+ run: ./.github/scripts/verify-windows-signatures.ps1
- name: Sign, notarize and package macOS app
if: runner.os == 'macOS'
env:
diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml
index 7153320..1b4b0d0 100644
--- a/apps/desktop/electron-builder.yml
+++ b/apps/desktop/electron-builder.yml
@@ -40,6 +40,10 @@ mac:
win:
icon: resources/icon.png
artifactName: 'Inlark-${version}-${arch}-setup.${ext}'
+ forceCodeSigning: true
+ signtoolOptions:
+ signingHashAlgorithms: [sha256]
+ rfc3161TimeStampServer: http://time.certum.pl
deb:
packageName: inlark
depends:
diff --git a/apps/marketing/src/components/download/Steps.tsx b/apps/marketing/src/components/download/Steps.tsx
index 2b2c482..6305bb6 100644
--- a/apps/marketing/src/components/download/Steps.tsx
+++ b/apps/marketing/src/components/download/Steps.tsx
@@ -10,9 +10,6 @@ interface Step {
visual: ReactNode
}
-const Name = ({ children }: { children: ReactNode }) => (
- <span className="font-medium text-ink">{children}</span>
-)
const Path = ({ children }: { children: ReactNode }) => (
<code className="rounded bg-ink/[0.06] px-1 py-0.5 font-mono text-[0.85em] break-all text-ink">
{children}
@@ -41,14 +38,9 @@ function steps({ build, file }: Download): Step[] {
visual: <DragVisual />,
},
{
- title: 'Allow it to open',
- body: (
- <>
- Inlark isn’t notarized by Apple yet, so macOS stops it the first time. Go to{' '}
- <Name>System Settings → Privacy & Security</Name> and choose <Name>Open Anyway</Name>.
- </>
- ),
- visual: <GatekeeperVisual />,
+ title: 'Open Inlark',
+ body: 'Find it in Launchpad or with Spotlight. The first time, macOS asks you to confirm opening an app from the internet.',
+ visual: <LauncherVisual />,
},
connect,
]
@@ -65,14 +57,9 @@ function steps({ build, file }: Download): Step[] {
visual: <DownloadsVisual file={file!} />,
},
{
- title: 'Get past SmartScreen',
- body: (
- <>
- The installer isn’t code-signed yet, so Windows may hold it back. Choose{' '}
- <Name>More info</Name>, then <Name>Run anyway</Name>.
- </>
- ),
- visual: <SmartScreenVisual />,
+ title: 'Open Inlark',
+ body: 'It starts as soon as setup finishes. After that, find it in the Start menu or search for Inlark.',
+ visual: <LauncherVisual />,
},
connect,
]
@@ -227,17 +214,6 @@ export function Steps({ download }: { download: Download }) {
</li>
))}
</ol>
- {(download.build.id === 'mac-arm64' || download.build.id === 'mac-x64') && (
- <div className="mt-4 flex flex-col gap-3 rounded-xl border border-line px-5 py-4 text-sm text-ink-2 lg:flex-row lg:items-center lg:gap-6">
- <p className="shrink-0">
- macOS says Inlark <span className="text-ink">is damaged</span>? Clear the download flag:
- </p>
- <CodeBlock
- code="xattr -dr com.apple.quarantine /Applications/Inlark.app"
- className="min-w-0 flex-1"
- />
- </div>
- )}
</div>
)
}
@@ -286,28 +262,6 @@ function DragVisual() {
)
}
-function GatekeeperVisual() {
- return (
- <div className="app flex h-full items-center justify-center" aria-hidden="true">
- <div className="w-full max-w-[17rem] rounded-[10px] border border-(--border-strong) bg-(--surface) p-3.5 shadow-[0_20px_40px_-20px_var(--shadow-deep)]">
- <p className="text-[10.5px] font-semibold tracking-wide text-(--muted) uppercase">
- Privacy & Security
- </p>
- <div className="mt-3 rounded-[8px] bg-(--raised) p-3">
- <p className="text-[11.5px] leading-snug text-(--text)">
- “Inlark” was blocked to protect your Mac.
- </p>
- <div className="mt-3 flex justify-end">
- <span className="pulse-ring rounded-[6px] bg-white/90 px-2.5 py-1 text-[11px] font-medium text-[#1d1d1f] light:bg-[#e3e3e8]">
- Open Anyway
- </span>
- </div>
- </div>
- </div>
- </div>
- )
-}
-
function DownloadsVisual({ file }: { file: string }) {
return (
<div className="app flex h-full items-center justify-center" aria-hidden="true">
@@ -333,26 +287,6 @@ function DownloadsVisual({ file }: { file: string }) {
)
}
-function SmartScreenVisual() {
- return (
- <div className="flex h-full items-center justify-center font-app" aria-hidden="true">
- <div className="w-full max-w-[17rem] rounded-[4px] bg-[#1b4b82] px-3.5 pt-3 pb-3 text-white shadow-[0_20px_40px_-20px_#000] light:shadow-[0_20px_40px_-20px_rgb(22_24_36/0.3)]">
- <p className="text-[13px] leading-tight font-light">Windows protected your PC</p>
- <p className="mt-2 text-[9.5px] leading-snug text-white/75">
- Microsoft Defender SmartScreen prevented an unrecognized app from starting.
- </p>
- <p className="mt-1.5 text-[9.5px] text-white/60">Publisher: Unknown publisher</p>
- <div className="mt-3 flex justify-end gap-1.5">
- <span className="pulse-ring rounded-[2px] border border-white/70 px-2.5 py-1 text-[10px]">
- Run anyway
- </span>
- <span className="rounded-[2px] bg-white/15 px-2.5 py-1 text-[10px]">Don’t run</span>
- </div>
- </div>
- </div>
- )
-}
-
function LauncherVisual() {
return (
<div className="app flex h-full items-center justify-center" aria-hidden="true">
diff --git a/apps/marketing/src/styles/global.css b/apps/marketing/src/styles/global.css
index 74090d6..6e82c9e 100644
--- a/apps/marketing/src/styles/global.css
+++ b/apps/marketing/src/styles/global.css
@@ -670,20 +670,6 @@
}
}
- /* Draws the eye to the one button that matters in a system dialog. */
- .pulse-ring {
- animation: ring 2.6s ease-in-out infinite;
- }
- @keyframes ring {
- 0%,
- 100% {
- box-shadow: 0 0 0 0 rgb(170 166 236 / 0);
- }
- 50% {
- box-shadow: 0 0 0 4px rgb(170 166 236 / 0.35);
- }
- }
-
.found-row {
animation: rise-in 0.8s var(--ease-out-expo) 0.8s both;
}