2022-05-27 09:39:24 +00:00
|
|
|
import { AuthDemuxBase } from 'utils/auth/types';
|
2022-04-18 11:29:20 +00:00
|
|
|
import { IPC_ACTIONS } from 'utils/messages';
|
2022-05-27 09:39:24 +00:00
|
|
|
import { Creds } from 'utils/types';
|
2023-06-14 08:40:03 +00:00
|
|
|
const { ipcRenderer } = require('electron');
|
2022-04-18 11:29:20 +00:00
|
|
|
|
|
|
|
export class AuthDemux extends AuthDemuxBase {
|
2023-06-22 08:52:54 +00:00
|
|
|
#isElectron = false;
|
2022-04-18 11:29:20 +00:00
|
|
|
constructor(isElectron: boolean) {
|
|
|
|
super();
|
|
|
|
this.#isElectron = isElectron;
|
|
|
|
}
|
|
|
|
|
2022-05-27 09:39:24 +00:00
|
|
|
async getCreds(): Promise<Creds> {
|
2022-04-18 11:29:20 +00:00
|
|
|
if (this.#isElectron) {
|
2022-05-27 09:39:24 +00:00
|
|
|
return (await ipcRenderer.invoke(IPC_ACTIONS.GET_CREDS)) as Creds;
|
2022-04-18 11:29:20 +00:00
|
|
|
} else {
|
2022-05-27 09:39:24 +00:00
|
|
|
return { errorLogUrl: '', tokenString: '', telemetryUrl: '' };
|
2022-04-18 11:29:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|