@@ -246,7 +246,7 @@ public Map<String, Object> getLogins(String url, String submitUrl, boolean httpA
246
246
}
247
247
248
248
/**
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
250
250
* {@link org.purejava.KeepassProxyAccess#getLogins(String, String, boolean, List) getLogins} to search
251
251
* the KeePassXC databases.
252
252
* @see org.purejava.KeepassProxyAccess#getLogins(String, String, boolean, List)
@@ -256,19 +256,19 @@ public Map<String, Object> getLogins(String url, String submitUrl, boolean httpA
256
256
* @param httpAuth Include database entries into search that are restricted to HTTP Basic Auth.
257
257
* @param list Id / key combinations identifying and granting access to KeePassXC databases.
258
258
* @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 .
260
260
*/
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 ) {
262
262
var response = getLogins (url , submitUrl , httpAuth , list );
263
263
if (response .isEmpty ()) {
264
- return false ;
264
+ return new ValidLogin ( false , null ) ;
265
265
}
266
266
var array = (ArrayList <Object >) response .get ("entries" );
267
267
for (Object o : array ) {
268
268
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 ()) ;
270
270
}
271
- return false ;
271
+ return new ValidLogin ( true , null ) ;
272
272
}
273
273
274
274
/**
0 commit comments