moved ipc handlers setup to corresponding files

This commit is contained in:
antelle 2021-04-18 11:50:11 +02:00
parent 7bea4ad282
commit e06e9ac1f8
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
5 changed files with 18 additions and 23 deletions

View File

@ -0,0 +1,4 @@
const { ipcMain } = require('electron');
ipcMain.handle('browserExtensionConnectorStart', () => {});
ipcMain.handle('browserExtensionConnectorStop', () => {});

View File

@ -1,17 +1,16 @@
const { ipcMain } = require('electron');
const { readXoredValue, makeXoredValue } = require('../util/byte-utils');
const { reqNative } = require('../util/req-native');
ipcMain.handle('hardwareCryptoDeleteKey', hardwareCryptoDeleteKey);
ipcMain.handle('hardwareEncrypt', hardwareEncrypt);
ipcMain.handle('hardwareDecrypt', hardwareDecrypt);
const keyTag = 'net.antelle.keeweb.encryption-key';
let testCipherParams;
let keyChecked = false;
module.exports = {
hardwareCryptoDeleteKey,
hardwareEncrypt,
hardwareDecrypt
};
async function hardwareCryptoDeleteKey() {
const secureEnclave = reqNative('secure-enclave');
await secureEnclave.deleteKeyPair({ keyTag });

View File

@ -1,7 +1,10 @@
const { ipcMain } = require('electron');
const path = require('path');
const { spawn } = require('child_process');
const { EventEmitter } = require('events');
ipcMain.on('nativeModuleCall', nativeModuleCall);
let callbackWebContents;
let nativeModuleHost;

View File

@ -1,8 +1,7 @@
const { ipcMain } = require('electron');
const { spawn } = require('child_process');
module.exports = {
spawnProcess
};
ipcMain.handle('spawnProcess', spawnProcess);
function spawnProcess(e, config) {
return new Promise((resolve) => {

View File

@ -1,16 +1,6 @@
const { ipcMain } = require('electron');
const {
hardwareCryptoDeleteKey,
hardwareEncrypt,
hardwareDecrypt
} = require('./ipc-handlers/hardware-crypto');
const { spawnProcess } = require('./ipc-handlers/spawn-process');
const { nativeModuleCall } = require('./ipc-handlers/native-module-host-proxy');
module.exports.setupIpcHandlers = () => {
ipcMain.handle('hardwareCryptoDeleteKey', hardwareCryptoDeleteKey);
ipcMain.handle('hardwareEncrypt', hardwareEncrypt);
ipcMain.handle('hardwareDecrypt', hardwareDecrypt);
ipcMain.handle('spawnProcess', spawnProcess);
ipcMain.on('nativeModuleCall', nativeModuleCall);
require('./ipc-handlers/browser-extension-connector');
require('./ipc-handlers/hardware-crypto');
require('./ipc-handlers/native-module-host-proxy');
require('./ipc-handlers/spawn-process');
};