2019-08-28 04:35:07 +02:00
|
|
|
import { ipcRenderer } from 'electron';
|
2019-08-20 14:29:59 +02:00
|
|
|
|
2019-08-28 04:35:07 +02:00
|
|
|
export const setSavedPassword = value => {
|
2019-09-26 18:28:08 +02:00
|
|
|
return new Promise(resolve => {
|
|
|
|
ipcRenderer.once('set-password-response', (event, success) => {
|
|
|
|
resolve(success);
|
|
|
|
});
|
|
|
|
ipcRenderer.send('set-password', value);
|
|
|
|
});
|
2019-08-20 14:29:59 +02:00
|
|
|
};
|
|
|
|
|
2019-08-28 04:35:07 +02:00
|
|
|
export const getSavedPassword = () => {
|
2019-09-26 18:28:08 +02:00
|
|
|
return new Promise(resolve => {
|
2019-10-15 06:20:12 +02:00
|
|
|
// @if TARGET='app'
|
2019-09-26 18:28:08 +02:00
|
|
|
ipcRenderer.once('get-password-response', (event, password) => {
|
|
|
|
resolve(password);
|
|
|
|
});
|
|
|
|
ipcRenderer.send('get-password');
|
2019-10-15 06:20:12 +02:00
|
|
|
// @endif
|
|
|
|
|
|
|
|
// @if TARGET='web'
|
2019-10-15 18:09:33 +02:00
|
|
|
// Will handle saved passwords on web differently
|
|
|
|
resolve('');
|
2019-10-15 06:20:12 +02:00
|
|
|
// @endif
|
2019-09-26 18:28:08 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
export const deleteSavedPassword = () => {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
// @if TARGET='app'
|
|
|
|
ipcRenderer.once('delete-password-response', (event, success) => {
|
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
ipcRenderer.send('delete-password');
|
|
|
|
// @endif;
|
|
|
|
});
|
2019-08-26 22:18:30 +02:00
|
|
|
};
|
2019-08-20 14:29:59 +02:00
|
|
|
|
2019-09-26 18:07:11 +02:00
|
|
|
export const deleteAuthToken = () => {
|
2019-09-26 18:28:08 +02:00
|
|
|
return new Promise(resolve => {
|
|
|
|
// @if TARGET='app'
|
|
|
|
ipcRenderer.once('delete-auth-token-response', (event, success) => {
|
2019-09-26 18:07:11 +02:00
|
|
|
resolve();
|
2019-09-26 18:28:08 +02:00
|
|
|
});
|
|
|
|
ipcRenderer.send('delete-auth-token');
|
|
|
|
// @endif;
|
|
|
|
// @if TARGET='web'
|
|
|
|
document.cookie = 'auth_token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT';
|
|
|
|
resolve();
|
|
|
|
// @endif
|
|
|
|
});
|
2019-08-28 04:35:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const testKeychain = () => {
|
|
|
|
// we should make sure it works on startup
|
2019-08-27 21:11:56 +02:00
|
|
|
};
|