Skip to content

Commit 4702a36

Browse files
committed
Merge branch 'develop' into main
2 parents 8623695 + 376a799 commit 4702a36

File tree

4 files changed

+45
-12
lines changed

4 files changed

+45
-12
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Add `keepassxc-proxy-access` as a dependency to your project.
1515
<dependency>
1616
<groupId>org.purejava</groupId>
1717
<artifactId>keepassxc-proxy-access</artifactId>
18-
<version>0.0.5</version>
18+
<version>0.0.6</version>
1919
</dependency>
2020
```
2121

@@ -48,6 +48,7 @@ Communication with KeePassXC happens via the KeePassXC protocol. Currently, the
4848
* `get-database-groups`: Request to retrieve all database groups together with their groupUuids.
4949
* `create-new-group`: Request to create a new group for the given name or path.
5050
* `get-totp`: Request for receiving the current TOTP.
51+
* `delete-entry`: Request for deleting an entry in the database, identified by its uuid.
5152
* `database-locked`: A signal from KeePassXC, the current active database is locked.
5253
* `database-unlocked`: A signal from KeePassXC, the current active database is unlocked.
5354

@@ -61,4 +62,4 @@ Copyright (C) 2021 Ralph Plawetzki
6162

6263
The keepassxc-proxy-access logo is based on an [ICONFINDER logo](https://www.iconfinder.com/icons/4484570/hosting_link_proxy_server_url_window_icon) that is published under the [Creative Commons Attribution 3.0 Unported licence](https://creativecommons.org/licenses/by/3.0/) (CC BY 3.0). I modified the icon to my needs by changing the interior and adding the KeePassXC logo.
6364

64-
The KeePassXC logo is Copyright (C) of https://keepassxc.org/
65+
The KeePassXC logo is Copyright (C) of https://keepassxc.org/

pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.purejava</groupId>
88
<artifactId>keepassxc-proxy-access</artifactId>
9-
<version>0.0.5</version>
9+
<version>0.0.6</version>
1010
<packaging>jar</packaging>
1111

1212
<name>keepassxc-proxy-access</name>
@@ -54,11 +54,11 @@
5454
<maven.compiler.target>1.9</maven.compiler.target>
5555

5656
<tweetnacl.version>1.1.2</tweetnacl.version>
57-
<junixsocket.version>2.3.4</junixsocket.version>
57+
<junixsocket.version>2.4.0</junixsocket.version>
5858
<json.version>20210307</json.version>
5959
<commons-lang3.version>3.12.0</commons-lang3.version>
60-
<junit.version>5.7.0</junit.version>
61-
<slf4j.version>1.7.30</slf4j.version>
60+
<junit.version>5.8.1</junit.version>
61+
<slf4j.version>1.7.32</slf4j.version>
6262
</properties>
6363

6464
<!-- tweetnacl-java -->
@@ -74,6 +74,7 @@
7474
<groupId>com.kohlschutter.junixsocket</groupId>
7575
<artifactId>junixsocket-core</artifactId>
7676
<version>${junixsocket.version}</version>
77+
<type>pom</type>
7778
</dependency>
7879

7980
<!-- JSON for Java -->

src/main/java/org/purejava/KeepassProxyAccess.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public Map<String, Object> getLogins(String url, String submitUrl, boolean httpA
246246
}
247247

248248
/**
249-
* Checks, if a password is stored in the KeePassXC databases. This method calls
249+
* Checks, whether a login exists and a given password is stored in the KeePassXC databases. This method calls
250250
* {@link org.purejava.KeepassProxyAccess#getLogins(String, String, boolean, List) getLogins} to search
251251
* the KeePassXC databases.
252252
* @see org.purejava.KeepassProxyAccess#getLogins(String, String, boolean, List)
@@ -256,19 +256,19 @@ public Map<String, Object> getLogins(String url, String submitUrl, boolean httpA
256256
* @param httpAuth Include database entries into search that are restricted to HTTP Basic Auth.
257257
* @param list Id / key combinations identifying and granting access to KeePassXC databases.
258258
* @param password Password to check.
259-
* @return True, if the password was found in a KeePassXC database, false otherwise.
259+
* @return ValidLogin The object describes whether a valid login exists for the given URL and whether the given password matches too.
260260
*/
261-
public boolean loginExists(String url, String submitUrl, boolean httpAuth, List<Map<String, String>> list, String password) {
261+
public ValidLogin loginExists(String url, String submitUrl, boolean httpAuth, List<Map<String, String>> list, String password) {
262262
var response = getLogins(url, submitUrl, httpAuth, list);
263263
if (response.isEmpty()) {
264-
return false;
264+
return new ValidLogin(false, null);
265265
}
266266
var array = (ArrayList<Object>) response.get("entries");
267267
for (Object o : array) {
268268
var credentials = (HashMap<String, Object>) o;
269-
if (credentials.get("password").equals(password)) return true;
269+
if (credentials.get("password").equals(password)) return new ValidLogin(true, credentials.get("uuid").toString());
270270
}
271-
return false;
271+
return new ValidLogin(true, null);
272272
}
273273

274274
/**
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.purejava;
2+
3+
import java.util.List;
4+
5+
/**
6+
* This holds the result of a call to {@link org.purejava.KeepassProxyAccess#loginExists(String, String, boolean, List, String)}
7+
* @see org.purejava.KeepassProxyAccess#loginExists(String, String, boolean, List, String)
8+
*/
9+
public class ValidLogin {
10+
private boolean found;
11+
private String uuid;
12+
13+
/**
14+
* Does a valid login exist for the given URL? And does the given password match too?
15+
* @param found True, if an entry was found in the KeePassXC database for the given URL.
16+
* @param uuid If found is true, this contains either the uuid, in case the given password matches
17+
* the password already stored in the entry or null in case the given password does not match.
18+
*/
19+
public ValidLogin(boolean found, String uuid) {
20+
this.found = found;
21+
this.uuid = uuid;
22+
}
23+
24+
public boolean isFound() {
25+
return found;
26+
}
27+
28+
public String getUuid() {
29+
return uuid;
30+
}
31+
}

0 commit comments

Comments
 (0)