From 5fcd53be184be0d938f26a0a0d3558878aa39602 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 29 Dec 2022 18:17:47 +0100 Subject: [PATCH] load device key before showing UI to prevent uncatched failure of UI loading --- .../cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java index dcb5722d2..a3c2ed820 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingStrategy.java @@ -48,9 +48,10 @@ public class HubKeyLoadingStrategy implements KeyLoadingStrategy { public Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException { Preconditions.checkArgument(keyId.getScheme().startsWith(SCHEME_PREFIX)); try { + var keypair = deviceKey.get(); startAuthFlow(); var jwe = result.get(); - return JWEHelper.decrypt(jwe, deviceKey.get().getPrivate()); + return JWEHelper.decrypt(jwe, keypair.getPrivate()); } catch (DeviceKey.DeviceKeyRetrievalException e) { throw new MasterkeyLoadingFailedException("Failed to load keypair", e); } catch (CancellationException e) {