fix macos encrypt error

This commit is contained in:
pompurin404 2024-08-18 11:43:59 +08:00
parent c61e1a0859
commit 32a1ea5cfb
No known key found for this signature in database
3 changed files with 7 additions and 3 deletions

View File

@ -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
}

View File

@ -201,7 +201,7 @@ export async function isEncryptionAvailable(): Promise<boolean> {
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('isEncryptionAvailable'))
}
export async function encryptString(str: string): Promise<Buffer> {
export async function encryptString(str: string): Promise<number[]> {
return ipcErrorWrapper(await window.electron.ipcRenderer.invoke('encryptString', str))
}

View File

@ -213,7 +213,7 @@ interface IAppConfig {
userAgent?: string
delayTestUrl?: string
delayTestTimeout?: number
encryptedPassword?: Buffer
encryptedPassword?: number[]
controlDns?: boolean
controlSniff?: boolean
useDockIcon?: boolean