1 import { ipcMain } from 'electron';
2 import { platform } from 'os';
4 import type { BiometricsFactory, BiometricsPlatformHandler } from './types';
6 const factory: BiometricsFactory = (getWindow) => {
7 const platformImplementation: BiometricsPlatformHandler = (() => {
10 return (require('./biometrics.windows').default as BiometricsFactory)(getWindow);
12 return (require('./biometrics.macos').default as BiometricsFactory)(getWindow);
15 canCheckPresence: () => Promise.resolve(false),
16 checkPresence: () => Promise.reject('Not implemented'),
17 getDecryptionKey: () => Promise.reject('Not implemented'),
18 getSecret: () => Promise.reject('Not implemented'),
19 deleteSecret: () => Promise.reject('Not implemented'),
20 setSecret: () => Promise.reject('Not implemented'),
25 ipcMain.handle('biometrics:canCheckPresence', platformImplementation.canCheckPresence);
26 ipcMain.handle('biometrics:checkPresence', platformImplementation.checkPresence);
27 ipcMain.handle('biometrics:getDecryptionKey', platformImplementation.getDecryptionKey);
28 ipcMain.handle('biometrics:getSecret', platformImplementation.getSecret);
29 ipcMain.handle('biometrics:setSecret', platformImplementation.setSecret);
30 ipcMain.handle('biometrics:deleteSecret', platformImplementation.deleteSecret);
32 return platformImplementation;
35 export default factory;