浏览代码

deduplicate and add convenience method

Armin Schrenk 2 年之前
父节点
当前提交
5665e92839

+ 5 - 0
src/main/java/org/cryptomator/common/Constants.java

@@ -1,5 +1,9 @@
 package org.cryptomator.common;
 
+import org.cryptomator.ui.keyloading.masterkeyfile.MasterkeyFileLoadingStrategy;
+
+import java.net.URI;
+
 public interface Constants {
 
 	String MASTERKEY_FILENAME = "masterkey.cryptomator";
@@ -7,6 +11,7 @@ public interface Constants {
 	String VAULTCONFIG_FILENAME = "vault.cryptomator";
 	String CRYPTOMATOR_FILENAME_EXT = ".cryptomator";
 	String CRYPTOMATOR_FILENAME_GLOB = "*.cryptomator";
+	URI DEFAULT_KEY_ID = URI.create(MasterkeyFileLoadingStrategy.SCHEME + ":" + MASTERKEY_FILENAME);
 	byte[] PEPPER = new byte[0];
 
 }

+ 1 - 1
src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultPasswordController.java

@@ -48,13 +48,13 @@ import java.util.ResourceBundle;
 import java.util.concurrent.ExecutorService;
 
 import static java.nio.charset.StandardCharsets.US_ASCII;
+import static org.cryptomator.common.Constants.DEFAULT_KEY_ID;
 import static org.cryptomator.common.Constants.MASTERKEY_FILENAME;
 
 @AddVaultWizardScoped
 public class CreateNewVaultPasswordController implements FxController {
 
 	private static final Logger LOG = LoggerFactory.getLogger(CreateNewVaultPasswordController.class);
-	private static final URI DEFAULT_KEY_ID = URI.create(MasterkeyFileLoadingStrategy.SCHEME + ":" + MASTERKEY_FILENAME); // TODO better place?
 
 	private final Stage window;
 	private final Lazy<Scene> chooseLocationScene;

+ 5 - 0
src/main/java/org/cryptomator/ui/changepassword/NewPasswordController.java

@@ -1,5 +1,6 @@
 package org.cryptomator.ui.changepassword;
 
+import org.cryptomator.common.Passphrase;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.controls.FontAwesome5IconView;
 import org.cryptomator.ui.controls.NiceSecurePasswordField;
@@ -92,4 +93,8 @@ public class NewPasswordController implements FxController {
 		return passwordStrength.get();
 	}
 
+	public Passphrase getNewPassword() {
+		return passwordField.getCharacters();
+	}
+
 }