Browse Source

Generalize naming

Ralph Plawetzki 11 months ago
parent
commit
953aee560f

+ 5 - 5
src/main/java/org/cryptomator/common/settings/VaultSettings.java

@@ -40,7 +40,7 @@ public class VaultSettings {
 	static final boolean DEFAULT_AUTOLOCK_WHEN_IDLE = false;
 	static final int DEFAULT_AUTOLOCK_IDLE_SECONDS = 30 * 60;
 	static final int DEFAULT_PORT = 42427;
-	static final boolean DEFAULT_USE_TOUCH_ID = false;
+	static final boolean DEFAULT_NEED_AUTHENTICATED_USER = false;
 
 	private static final Random RNG = new Random();
 
@@ -59,7 +59,7 @@ public class VaultSettings {
 	public final StringExpression mountName;
 	public final StringProperty mountService;
 	public final IntegerProperty port;
-	public final BooleanProperty useTouchID;
+	public final BooleanProperty needAuthenticatedUser;
 
 	VaultSettings(VaultSettingsJson json) {
 		this.id = json.id;
@@ -86,7 +86,7 @@ public class VaultSettings {
 			}
 			return normalizeDisplayName(name);
 		}, displayName, path));
-		this.useTouchID = new SimpleBooleanProperty(this, "useTouchID", json.useTouchID);
+		this.needAuthenticatedUser = new SimpleBooleanProperty(this, "needAuthenticatedUser", json.needAuthenticatedUser);
 
 		migrateLegacySettings(json);
 	}
@@ -102,7 +102,7 @@ public class VaultSettings {
 	}
 
 	Observable[] observables() {
-		return new Observable[]{actionAfterUnlock, autoLockIdleSeconds, autoLockWhenIdle, displayName, maxCleartextFilenameLength, mountFlags, mountPoint, path, revealAfterMount, unlockAfterStartup, usesReadOnlyMode, port, mountService, useTouchID};
+		return new Observable[]{actionAfterUnlock, autoLockIdleSeconds, autoLockWhenIdle, displayName, maxCleartextFilenameLength, mountFlags, mountPoint, path, revealAfterMount, unlockAfterStartup, usesReadOnlyMode, port, mountService, needAuthenticatedUser};
 	}
 
 	public static VaultSettings withRandomId() {
@@ -133,7 +133,7 @@ public class VaultSettings {
 		json.mountPoint = mountPoint.map(Path::toString).getValue();
 		json.mountService = mountService.get();
 		json.port = port.get();
-		json.useTouchID = useTouchID.get();
+		json.needAuthenticatedUser = needAuthenticatedUser.get();
 		return json;
 	}
 

+ 2 - 2
src/main/java/org/cryptomator/common/settings/VaultSettingsJson.java

@@ -65,6 +65,6 @@ class VaultSettingsJson {
 	@JsonAlias("individualMountPath")
 	String customMountPath;
 
-	@JsonProperty("useTouchID")
-	boolean useTouchID = VaultSettings.DEFAULT_USE_TOUCH_ID;
+	@JsonProperty("needAuthenticatedUser")
+	boolean needAuthenticatedUser = VaultSettings.DEFAULT_NEED_AUTHENTICATED_USER;
 }

+ 1 - 1
src/main/java/org/cryptomator/ui/keyloading/masterkeyfile/MasterkeyFileLoadingStrategy.java

@@ -114,7 +114,7 @@ public class MasterkeyFileLoadingStrategy implements KeyLoadingStrategy {
 	private void savePasswordToSystemkeychain(Passphrase passphrase) {
 		if (keychain.isSupported()) {
 			try {
-				if (vault.getVaultSettings().useTouchID.get()) {
+				if (vault.getVaultSettings().needAuthenticatedUser.get()) {
 					keychain.storePassphraseForAuthenticatedUser(vault.getId(), vault.getDisplayName(), passphrase);
 				} else {
 					keychain.storePassphrase(vault.getId(), vault.getDisplayName(), passphrase);

+ 7 - 5
src/main/java/org/cryptomator/ui/vaultoptions/MasterkeyOptionsController.java

@@ -30,7 +30,7 @@ public class MasterkeyOptionsController implements FxController {
 	private final ChangePasswordComponent.Builder changePasswordWindow;
 	private final RecoveryKeyComponent.Factory recoveryKeyWindow;
 	private final ForgetPasswordComponent.Builder forgetPasswordWindow;
-	public CheckBox useTouchIDheckbox;
+	public CheckBox needAuthenticatedUserCheckbox;
 	private final KeychainManager keychain;
 	private final ObservableValue<Boolean> passwordSaved;
 
@@ -52,10 +52,12 @@ public class MasterkeyOptionsController implements FxController {
 
 	@FXML
 	public void initialize() {
-		useTouchIDheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().useTouchID);
-		useTouchIDheckbox.selectedProperty().addListener(this::useTouchIDheckboxToggled);
+		needAuthenticatedUserCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().needAuthenticatedUser);
+		needAuthenticatedUserCheckbox.selectedProperty().addListener(this::needAuthenticatedUserCheckboxToggled);
+		// ToDo Remove or adjust, as soon as there are implementations for integrations-api
+		//  KeychainAccessProvider:storePassphraseForAuthenticatedUser for other OSes
 		if (!SystemUtils.IS_OS_MAC) {
-			useTouchIDheckbox.visibleProperty().set(false);
+			needAuthenticatedUserCheckbox.visibleProperty().set(false);
 		}
 	}
 
@@ -67,7 +69,7 @@ public class MasterkeyOptionsController implements FxController {
 	 * @param wasSet
 	 * @param isSet		 <code>true</code>, when the checkbox is ticked, <code>false</code> otherwise
 	 */
-	private void useTouchIDheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
+	private void needAuthenticatedUserCheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
 		try {
 			var vautID = vault.getId();
 			if (keychain.isPassphraseStored(vautID)) {

+ 1 - 1
src/main/resources/fxml/vault_options_masterkey.fxml

@@ -32,7 +32,7 @@
 		</VBox>
 
 		<HBox spacing="6" alignment="CENTER_LEFT">
-			<CheckBox text="%vaultOptions.masterkey.useTouchID" fx:id="useTouchIDheckbox"/>
+			<CheckBox text="%vaultOptions.masterkey.needAuthenticatedUser" fx:id="needAuthenticatedUserCheckbox"/>
 		</HBox>
 
 		<Region VBox.vgrow="ALWAYS"/>

+ 1 - 1
src/main/resources/i18n/strings.properties

@@ -480,7 +480,7 @@ vaultOptions.mount.volume.type=Volume Type
 vaultOptions.masterkey=Password
 vaultOptions.masterkey.changePasswordBtn=Change Password
 vaultOptions.masterkey.forgetSavedPasswordBtn=Forget Saved Password
-vaultOptions.masterkey.useTouchID=Use Touch ID
+vaultOptions.masterkey.needAuthenticatedUser=Requires authenticated user
 vaultOptions.masterkey.recoveryKeyExplanation=A recovery key is your only means to restore access to a vault if you lose your password.
 vaultOptions.masterkey.showRecoveryKeyBtn=Display Recovery Key
 vaultOptions.masterkey.recoverPasswordBtn=Reset Password