mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-18 00:26:54 -04:00
@@ -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_NEED_AUTHENTICATED_USER = false;
|
||||
static final boolean DEFAULT_USE_TOUCH_ID = 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 needAuthenticatedUser;
|
||||
public final BooleanProperty useTouchID;
|
||||
|
||||
VaultSettings(VaultSettingsJson json) {
|
||||
this.id = json.id;
|
||||
@@ -86,7 +86,7 @@ public class VaultSettings {
|
||||
}
|
||||
return normalizeDisplayName(name);
|
||||
}, displayName, path));
|
||||
this.needAuthenticatedUser = new SimpleBooleanProperty(this, "needAuthenticatedUser", json.needAuthenticatedUser);
|
||||
this.useTouchID = new SimpleBooleanProperty(this, "useTouchID", json.useTouchID);
|
||||
|
||||
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, needAuthenticatedUser};
|
||||
return new Observable[]{actionAfterUnlock, autoLockIdleSeconds, autoLockWhenIdle, displayName, maxCleartextFilenameLength, mountFlags, mountPoint, path, revealAfterMount, unlockAfterStartup, usesReadOnlyMode, port, mountService, useTouchID};
|
||||
}
|
||||
|
||||
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.needAuthenticatedUser = needAuthenticatedUser.get();
|
||||
json.useTouchID = useTouchID.get();
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,6 @@ class VaultSettingsJson {
|
||||
@JsonAlias("individualMountPath")
|
||||
String customMountPath;
|
||||
|
||||
@JsonProperty("needAuthenticatedUser")
|
||||
boolean needAuthenticatedUser = VaultSettings.DEFAULT_NEED_AUTHENTICATED_USER;
|
||||
@JsonProperty("useTouchID")
|
||||
boolean useTouchID = VaultSettings.DEFAULT_USE_TOUCH_ID;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MasterkeyFileLoadingStrategy implements KeyLoadingStrategy {
|
||||
private void savePasswordToSystemkeychain(Passphrase passphrase) {
|
||||
if (keychain.isSupported()) {
|
||||
try {
|
||||
if (vault.getVaultSettings().needAuthenticatedUser.get()) {
|
||||
if (vault.getVaultSettings().useTouchID.get()) {
|
||||
keychain.storePassphraseForAuthenticatedUser(vault.getId(), vault.getDisplayName(), passphrase);
|
||||
} else {
|
||||
keychain.storePassphrase(vault.getId(), vault.getDisplayName(), passphrase);
|
||||
|
||||
@@ -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 needAuthenticatedUserCheckbox;
|
||||
public CheckBox useTouchIDheckbox;
|
||||
private final KeychainManager keychain;
|
||||
private final ObservableValue<Boolean> passwordSaved;
|
||||
|
||||
@@ -52,12 +52,10 @@ public class MasterkeyOptionsController implements FxController {
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
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
|
||||
useTouchIDheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().useTouchID);
|
||||
useTouchIDheckbox.selectedProperty().addListener(this::useTouchIDheckboxToggled);
|
||||
if (!SystemUtils.IS_OS_MAC) {
|
||||
needAuthenticatedUserCheckbox.visibleProperty().set(false);
|
||||
useTouchIDheckbox.visibleProperty().set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ public class MasterkeyOptionsController implements FxController {
|
||||
* @param wasSet
|
||||
* @param isSet <code>true</code>, when the checkbox is ticked, <code>false</code> otherwise
|
||||
*/
|
||||
private void needAuthenticatedUserCheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
|
||||
private void useTouchIDheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
|
||||
try {
|
||||
var vautID = vault.getId();
|
||||
if (keychain.isPassphraseStored(vautID)) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</VBox>
|
||||
|
||||
<HBox spacing="6" alignment="CENTER_LEFT">
|
||||
<CheckBox text="%vaultOptions.masterkey.needAuthenticatedUser" fx:id="needAuthenticatedUserCheckbox"/>
|
||||
<CheckBox text="%vaultOptions.masterkey.useTouchID" fx:id="useTouchIDheckbox"/>
|
||||
</HBox>
|
||||
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
|
||||
@@ -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.needAuthenticatedUser=Requires authenticated user
|
||||
vaultOptions.masterkey.useTouchID=Use Touch ID
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user