summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/app.tsx
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2019-07-04 15:10:22 +0100
committerEmīls Piņķis <emils@mullvad.net>2019-07-05 16:49:28 +0100
commit58522c19b48b7bde4e094b3d9b46d0dc556b35a9 (patch)
tree007b347829c0031d7fa3a8f180383617259b88a7 /gui/src/renderer/app.tsx
parente88ea055298552206caf1970856916a121a87395 (diff)
downloadmullvadvpn-58522c19b48b7bde4e094b3d9b46d0dc556b35a9.tar.xz
mullvadvpn-58522c19b48b7bde4e094b3d9b46d0dc556b35a9.zip
Wire up IPC for generating and verifying wireguard keys
Diffstat (limited to 'gui/src/renderer/app.tsx')
-rw-r--r--gui/src/renderer/app.tsx23
1 files changed, 23 insertions, 0 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 3d5a6eb0e5..cbe37339f1 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -150,6 +150,10 @@ export default class AppRenderer {
this.storeAutoStart(autoStart);
});
+ IpcRendererEventChannel.wireguardKeys.listen((publicKey?: string) => {
+ this.setWireguardPublicKey(publicKey);
+ });
+
// Request the initial state from the main process
const initialState = IpcRendererEventChannel.state.get();
@@ -172,6 +176,7 @@ export default class AppRenderer {
this.setUpgradeVersion(initialState.upgradeVersion);
this.setGuiSettings(initialState.guiSettings);
this.storeAutoStart(initialState.autoStart);
+ this.setWireguardPublicKey(initialState.wireguardPublicKey);
if (initialState.isConnected) {
this.onDaemonConnected();
@@ -346,6 +351,20 @@ export default class AppRenderer {
IpcRendererEventChannel.guiSettings.setMonochromaticIcon(monochromaticIcon);
}
+ public async verifyWireguardKey(publicKey: string) {
+ const actions = this.reduxActions;
+ actions.settings.verifyWireguardKey(publicKey);
+ const valid = await IpcRendererEventChannel.wireguardKeys.verifyKey();
+ actions.settings.completeWireguardKeyVerification(valid);
+ }
+
+ public async generateWireguardKey() {
+ const actions = this.reduxActions;
+ actions.settings.generateWireguardKey();
+ const keygenEvent = await IpcRendererEventChannel.wireguardKeys.generateKey();
+ actions.settings.setWireguardKeygenEvent(keygenEvent);
+ }
+
private setRelaySettings(relaySettings: RelaySettings) {
const actions = this.reduxActions;
@@ -615,4 +634,8 @@ export default class AppRenderer {
private storeAutoStart(autoStart: boolean) {
this.reduxActions.settings.updateAutoStart(autoStart);
}
+
+ private setWireguardPublicKey(publicKey?: string) {
+ this.reduxActions.settings.setWireguardKey(publicKey);
+ }
}