diff --git a/desktop/app/src/init.tsx b/desktop/app/src/init.tsx index bbb0948cb..4513918a5 100644 --- a/desktop/app/src/init.tsx +++ b/desktop/app/src/init.tsx @@ -37,7 +37,7 @@ import { import constants from './fb-stubs/constants'; import {initializeElectron} from './electron/initializeElectron'; import path from 'path'; -import fs from 'fs'; +import fs from 'fs-extra'; enableMapSet(); @@ -64,9 +64,17 @@ async function start() { let keytar: any = undefined; try { if (!isTest()) { - keytar = electronRequire( - path.join(appPath, 'native-modules', `keytar-${process.platform}.node`), + const keytarPath = path.join( + staticPath, + 'native-modules', + `keytar-${process.platform}-${process.arch}.node`, ); + if (!(await fs.pathExists(keytarPath))) { + throw new Error( + `Keytar binary does not exist for platform ${process.platform}-${process.arch}`, + ); + } + keytar = electronRequire(keytarPath); } } catch (e) { console.error('Failed to load keytar:', e); diff --git a/desktop/flipper-server/src/startFlipperServer.tsx b/desktop/flipper-server/src/startFlipperServer.tsx index adda074e9..15194c9e3 100644 --- a/desktop/flipper-server/src/startFlipperServer.tsx +++ b/desktop/flipper-server/src/startFlipperServer.tsx @@ -23,7 +23,7 @@ import { setLoggerInstance, } from 'flipper-common'; import path from 'path'; -import fs from 'fs'; +import fs from 'fs-extra'; export async function startFlipperServer( rootDir: string, @@ -59,13 +59,17 @@ export async function startFlipperServer( let keytar: any = undefined; try { if (!isTest()) { - keytar = electronRequire( - path.join( - staticPath, - 'native-modules', - `keytar-${process.platform}.node`, - ), + const keytarPath = path.join( + staticPath, + 'native-modules', + `keytar-${process.platform}-${process.arch}.node`, ); + if (!(await fs.pathExists(keytarPath))) { + throw new Error( + `Keytar binary does not exist for platform ${process.platform}-${process.arch}`, + ); + } + keytar = electronRequire(keytarPath); } } catch (e) { console.error('Failed to load keytar:', e); diff --git a/desktop/static/native-modules/keytar-darwin-arm64.node b/desktop/static/native-modules/keytar-darwin-arm64.node new file mode 100755 index 000000000..9e93e78f5 Binary files /dev/null and b/desktop/static/native-modules/keytar-darwin-arm64.node differ diff --git a/desktop/static/native-modules/keytar-darwin-x64.node b/desktop/static/native-modules/keytar-darwin-x64.node new file mode 100755 index 000000000..af3393668 Binary files /dev/null and b/desktop/static/native-modules/keytar-darwin-x64.node differ diff --git a/desktop/static/native-modules/keytar-darwin.node b/desktop/static/native-modules/keytar-darwin.node deleted file mode 100755 index ff3c60996..000000000 Binary files a/desktop/static/native-modules/keytar-darwin.node and /dev/null differ diff --git a/desktop/static/native-modules/keytar-linux-x64.node b/desktop/static/native-modules/keytar-linux-x64.node new file mode 100755 index 000000000..ba7176e4b Binary files /dev/null and b/desktop/static/native-modules/keytar-linux-x64.node differ diff --git a/desktop/static/native-modules/keytar-linux.node b/desktop/static/native-modules/keytar-linux.node deleted file mode 100755 index 934b2f6dc..000000000 Binary files a/desktop/static/native-modules/keytar-linux.node and /dev/null differ diff --git a/desktop/static/native-modules/keytar-win32-x64.node b/desktop/static/native-modules/keytar-win32-x64.node new file mode 100644 index 000000000..41f700f17 Binary files /dev/null and b/desktop/static/native-modules/keytar-win32-x64.node differ diff --git a/desktop/static/native-modules/keytar-win32.node b/desktop/static/native-modules/keytar-win32.node deleted file mode 100644 index 7fa6f8948..000000000 Binary files a/desktop/static/native-modules/keytar-win32.node and /dev/null differ