1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: better security connections credentials storage

This commit is contained in:
2020-12-18 18:44:32 +01:00
parent 65ad0e954d
commit fc35f271d7
8 changed files with 56 additions and 7 deletions

View File

@ -2,7 +2,9 @@
import { app, BrowserWindow, nativeImage } from 'electron';
import * as path from 'path';
import crypto from 'crypto';
import { format as formatUrl } from 'url';
import keytar from 'keytar';
import ipcHandlers from './ipc-handlers';
const isDevelopment = process.env.NODE_ENV !== 'production';
@ -89,7 +91,14 @@ else {
});
// create main BrowserWindow when electron is ready
app.on('ready', () => {
app.on('ready', async () => {
let key = await keytar.getPassword('antares', 'user');
if (!key) {
key = crypto.randomBytes(16).toString('hex');
keytar.setPassword('antares', 'user', key);
}
mainWindow = createMainWindow();
});
}