Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

refactor: use electron-builder built in signing and notarization

Gabriel Stein0bee453082d6
diff --git a/.github/workflows/build-and-notarize.yml b/.github/workflows/build-and-notarize.yml
index 0f0b8516a..9a915b5c9 100644
--- a/.github/workflows/build-and-notarize.yml
+++ b/.github/workflows/build-and-notarize.yml
@@ -63,8 +63,8 @@ jobs:
# Allow codesign to use the certificate
security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
- # Export API key path for electron-builder
- echo "APPLE_API_KEY_PATH=$API_KEY_PATH" >> $GITHUB_ENV
+ # Export API key path for electron-builder (uses APPLE_API_KEY)
+ echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
- name: Build Application
run: ${{ matrix.build_cmd }}
@@ -72,8 +72,8 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# Enable signing only for macOS non-PR builds
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os == 'macos-latest' && github.event_name != 'pull_request' && 'true' || 'false' }}
- # Notarization credentials (electron-builder required names)
- APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
+ # Notarization credentials (electron-builder standard)
+ # APPLE_API_KEY is set from the file path in setup step
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 442a29d25..dda281d4c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -116,8 +116,8 @@ jobs:
# Allow codesign to use the certificate
security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
- # Export API key path for electron-builder
- echo "APPLE_API_KEY_PATH=$API_KEY_PATH" >> $GITHUB_ENV
+ # Export API key path for electron-builder (uses APPLE_API_KEY)
+ echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
- name: Update package.json version
run: |
@@ -131,8 +131,8 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# Enable signing for macOS
CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.os == 'macos-latest' && 'true' || 'false' }}
- # Notarization credentials (electron-builder required names)
- APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
+ # Notarization credentials (electron-builder standard)
+ # APPLE_API_KEY is set from the file path in setup step
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
diff --git a/electron-builder.json b/electron-builder.json
index 66139eb3e..ce7ccaf26 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -46,7 +46,6 @@
"NSAccessibilityUsageDescription": "OpenWhispr needs accessibility permissions to paste transcribed text into other applications."
}
},
- "afterSign": "scripts/afterSign.js",
"win": {
"target": [
"nsis",
diff --git a/scripts/afterSign.js b/scripts/afterSign.js
deleted file mode 100644
index 0e7b19cb2..000000000
--- a/scripts/afterSign.js
+++ /dev/null
@@ -1,70 +0,0 @@
-const { exec } = require('child_process');
-const { promisify } = require('util');
-const path = require('path');
-const fs = require('fs').promises;
-
-const execAsync = promisify(exec);
-
-exports.default = async function(context) {
- const { electronPlatformName, appOutDir } = context;
-
- if (electronPlatformName !== 'darwin') {
- return;
- }
-
- // Skip signing if CSC_IDENTITY_AUTO_DISCOVERY is false (pack builds)
- if (process.env.CSC_IDENTITY_AUTO_DISCOVERY === 'false') {
- console.log('Skipping signing for pack build');
- return;
- }
-
- const appName = context.packager.appInfo.productFilename;
- const appPath = path.join(appOutDir, `${appName}.app`);
- const entitlementsPath = path.join(__dirname, '..', 'resources', 'mac', 'entitlements.mac.plist');
-
- console.log('Starting custom signing process...');
-
- // List of binaries that need to be signed with hardened runtime
- const binariesToSign = [
- // ffmpeg-static binary
- 'Contents/Resources/app.asar.unpacked/node_modules/ffmpeg-static/ffmpeg',
- // Electron Framework libraries
- 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib',
- 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvk_swiftshader.dylib',
- 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib',
- 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib',
- // Squirrel ShipIt
- 'Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt'
- ];
-
- // Sign each binary with hardened runtime and timestamp
- for (const binaryPath of binariesToSign) {
- const fullPath = path.join(appPath, binaryPath);
-
- try {
- // Check if file exists
- await fs.access(fullPath);
-
- console.log(`Signing: ${binaryPath}`);
-
- // Sign with hardened runtime, timestamp, and entitlements
- const signCommand = `codesign --force --deep --timestamp --options runtime --entitlements "${entitlementsPath}" --sign "Developer ID Application: HeroTools Inc. (9R85XFMH59)" "${fullPath}"`;
-
- await execAsync(signCommand);
- console.log(`✓ Signed: ${binaryPath}`);
- } catch (error) {
- console.warn(`Warning: Could not sign ${binaryPath}:`, error.message);
- }
- }
-
- // Finally, sign the entire app bundle again to ensure consistency
- console.log('Re-signing entire app bundle...');
- const appSignCommand = `codesign --force --deep --timestamp --options runtime --entitlements "${entitlementsPath}" --sign "Developer ID Application: HeroTools Inc. (9R85XFMH59)" "${appPath}"`;
-
- await execAsync(appSignCommand);
- console.log('✓ App bundle signed successfully');
-
- // Run the notarization script
- const notarizeScript = require('./notarize');
- return notarizeScript.default(context);
-};
\ No newline at end of file
diff --git a/scripts/notarize.js b/scripts/notarize.js
deleted file mode 100644
index a080c00ab..000000000
--- a/scripts/notarize.js
+++ /dev/null
@@ -1,50 +0,0 @@
-const { notarize } = require('@electron/notarize');
-const path = require('path');
-
-exports.default = async function notarizing(context) {
- const { electronPlatformName, appOutDir } = context;
-
- // Only notarize macOS builds
- if (electronPlatformName !== 'darwin') {
- return;
- }
-
- // Skip if signing is disabled
- if (process.env.CSC_IDENTITY_AUTO_DISCOVERY === 'false') {
- console.log('Skipping notarization (signing disabled)');
- return;
- }
-
- const appName = context.packager.appInfo.productFilename;
- const appPath = path.join(appOutDir, `${appName}.app`);
-
- console.log('Starting notarization...');
-
- try {
- // Use API key if available (CI/CD), otherwise use keychain (local)
- const useApiKey = process.env.APPLE_API_KEY_ID && process.env.APPLE_API_ISSUER;
-
- await notarize({
- tool: 'notarytool',
- appPath,
- ...(useApiKey ? {
- // CI/CD with API key
- teamId: process.env.APPLE_TEAM_ID,
- appleApiKey: process.env.APPLE_API_KEY_PATH,
- appleApiKeyId: process.env.APPLE_API_KEY_ID,
- appleApiIssuer: process.env.APPLE_API_ISSUER,
- } : {
- // Local with keychain profile
- keychainProfile: 'openwispr-profile',
- }),
- staple: true
- });
-
- console.log('✓ Notarization successful');
- } catch (error) {
- console.error('Notarization failed:', error);
- // Fail in CI, warn in local builds
- if (process.env.CI) throw error;
- console.warn('Continuing without notarization');
- }
-};
\ No newline at end of file