diff --git a/src/main/utils/ipc.ts b/src/main/utils/ipc.ts index d129aaf..7e9ff50 100644 --- a/src/main/utils/ipc.ts +++ b/src/main/utils/ipc.ts @@ -125,7 +125,7 @@ export function registerIpcMainHandlers(): void { ipcMain.handle('restartCore', ipcErrorWrapper(restartCore)) ipcMain.handle('triggerSysProxy', (_e, enable) => ipcErrorWrapper(triggerSysProxy)(enable)) ipcMain.handle('isEncryptionAvailable', isEncryptionAvailable) - ipcMain.handle('encryptString', (_e, str) => safeStorage.encryptString(str)) + ipcMain.handle('encryptString', (_e, str) => encryptString(str)) ipcMain.handle('manualGrantCorePermition', ipcErrorWrapper(manualGrantCorePermition)) ipcMain.handle('getFilePath', (_e, ext) => getFilePath(ext)) ipcMain.handle('readTextFile', (_e, filePath) => ipcErrorWrapper(readTextFile)(filePath)) @@ -146,3 +146,7 @@ export function registerIpcMainHandlers(): void { }) ipcMain.handle('quitApp', () => app.quit()) } + +function encryptString(str: string): number[] { + return safeStorage.encryptString(str).toJSON().data +} diff --git a/src/renderer/src/utils/ipc.ts b/src/renderer/src/utils/ipc.ts index 395587a..0726015 100644 --- a/src/renderer/src/utils/ipc.ts +++ b/src/renderer/src/utils/ipc.ts @@ -201,7 +201,7 @@ export async function isEncryptionAvailable(): Promise { return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('isEncryptionAvailable')) } -export async function encryptString(str: string): Promise { +export async function encryptString(str: string): Promise { return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('encryptString', str)) } diff --git a/src/shared/types.d.ts b/src/shared/types.d.ts index c5e8a2a..07bb981 100644 --- a/src/shared/types.d.ts +++ b/src/shared/types.d.ts @@ -213,7 +213,7 @@ interface IAppConfig { userAgent?: string delayTestUrl?: string delayTestTimeout?: number - encryptedPassword?: Buffer + encryptedPassword?: number[] controlDns?: boolean controlSniff?: boolean useDockIcon?: boolean