Skip to content

Commit 7b6759d

Browse files
committed
Bring up KeePassXC unlock dialog, when KeePassXC database is locked
Implements #94
1 parent 366f0bb commit 7b6759d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/purejava/integrations/keychain/KeePassXCAccess.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class KeePassXCAccess implements KeychainAccessProvider {
1515

1616
private static final Logger LOG = LoggerFactory.getLogger(KeePassXCAccess.class);
1717

18-
private KeepassProxyAccess proxy;
18+
private final KeepassProxyAccess proxy;
1919
private final String URL_SCHEME = "https://";
2020
private final String APP_NAME = "Cryptomator";
2121

@@ -65,6 +65,7 @@ public void storePassphrase(String vault, String displayName, CharSequence passw
6565
public void storePassphrase(String vault, String name, CharSequence password, boolean requireOsAuthentication) throws KeychainAccessException {
6666
if (isLocked()) {
6767
LOG.info("Failed to store password. KeePassXC database is locked. Needs to be unlocked first.");
68+
unlock();
6869
return;
6970
}
7071
ensureAssociation();
@@ -85,6 +86,7 @@ public void storePassphrase(String vault, String name, CharSequence password, bo
8586
public char[] loadPassphrase(String vault) throws KeychainAccessException {
8687
if (isLocked()) {
8788
LOG.info("Failed to load password. KeePassXC database is locked. Needs to be unlocked first.");
89+
unlock();
8890
return null;
8991
}
9092
ensureAssociation();
@@ -108,6 +110,7 @@ public char[] loadPassphrase(String vault) throws KeychainAccessException {
108110
public void deletePassphrase(String vault) throws KeychainAccessException {
109111
if (isLocked()) {
110112
LOG.info("Failed to delete password. KeePassXC database is locked. Needs to be unlocked first.");
113+
unlock();
111114
return;
112115
}
113116
ensureAssociation();
@@ -137,6 +140,7 @@ public void changePassphrase(String vault, CharSequence password) throws Keychai
137140
public void changePassphrase(String vault, String name, CharSequence password) throws KeychainAccessException {
138141
if (isLocked()) {
139142
LOG.info("Failed to change password. KeePassXC database is locked. Needs to be unlocked first.");
143+
unlock();
140144
return;
141145
}
142146
ensureAssociation();

0 commit comments

Comments
 (0)