|
@@ -3,6 +3,7 @@ package org.cryptomator.ui.keyloading;
|
|
import org.cryptomator.cryptolib.api.Masterkey;
|
|
import org.cryptomator.cryptolib.api.Masterkey;
|
|
import org.cryptomator.cryptolib.api.MasterkeyLoader;
|
|
import org.cryptomator.cryptolib.api.MasterkeyLoader;
|
|
import org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException;
|
|
import org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException;
|
|
|
|
+import org.cryptomator.ui.keyloading.hub.HubKeyLoadingStrategy;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@@ -28,6 +29,20 @@ public interface KeyLoadingStrategy extends MasterkeyLoader {
|
|
@Override
|
|
@Override
|
|
Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException;
|
|
Masterkey loadKey(URI keyId) throws MasterkeyLoadingFailedException;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Determines whether the provided key loader scheme corresponds to a Hub Vault.
|
|
|
|
+ * <p>
|
|
|
|
+ * This method compares the {@code keyLoader} parameter with the known Hub Vault schemes
|
|
|
|
+ * {@link HubKeyLoadingStrategy#SCHEME_HUB_HTTP} and {@link HubKeyLoadingStrategy#SCHEME_HUB_HTTPS}.
|
|
|
|
+ *
|
|
|
|
+ * @param keyLoader A string representing the key loader scheme to be checked.
|
|
|
|
+ * @return {@code true} if the given key loader scheme represents a Hub Vault; {@code false} otherwise.
|
|
|
|
+ */
|
|
|
|
+ static boolean isHubVault(String keyLoader) {
|
|
|
|
+ return keyLoader.equals(HubKeyLoadingStrategy.SCHEME_HUB_HTTP) ||
|
|
|
|
+ keyLoader.equals(HubKeyLoadingStrategy.SCHEME_HUB_HTTPS);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Allows the loader to try and recover from an exception thrown during the last attempt.
|
|
* Allows the loader to try and recover from an exception thrown during the last attempt.
|
|
*
|
|
*
|