@@ -464,6 +464,48 @@ public JSONObject passkeysRegister(JSONObject publicKey, String origin, List<Map
464464 return new JSONObject ();
465465 }
466466
467+ /**
468+ * Request passkeys-get from the KeePassXC database (KeePassXC 2.8.0 and newer).
469+ * @param publicKey An object containing all required information for the public key.
470+ * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API">Web Authentication API</a> for publicKey contents.
471+ * @param origin The origin the request originates from in the form {@code https://...}
472+ * @param list A list of pairs of associateID and IDKeyPublicKey stored on association.
473+ * @return An object that contains the result of the operation. In case authenticating with the Passkey was successful, the response
474+ * looks like: <pre>{@code "response": {
475+ * "authenticatorAttachment": "platform",
476+ * "id": "tX6nBMj5Ksxg6QnTL1ilSwipm_up7rIiYsIQmYTKIAg",
477+ * "response": {
478+ * "authenticatorData": "5Yaf4EYzO6ALp_K7s-p-BQLPSCYVYcKLZptoXwxqQzsFAAAAAA",
479+ * "clientDataJSON": "eyJj...",
480+ * "signature": "MEYC...",
481+ * "userHandle": "DEMO__9fX19ERU1P"
482+ * },
483+ * "type": "public-key"
484+ * }}</pre>
485+ * In case the authentication failed, the response looks like: <pre>{@code "response": {
486+ * "errorCode": 15
487+ * }}</pre>
488+ */
489+ public JSONObject passkeysGet (JSONObject publicKey , String origin , List <Map <String , String >> list ) {
490+ try {
491+ var response = connection .passkeysGet (publicKey , origin , list );
492+ if (response .has ("response" ) && response .has ("success" ) && response .getString ("success" ).equals ("true" )) {
493+ try {
494+ var errorCode = response .getJSONObject ("response" ).getInt ("errorCode" );
495+ throw new KeepassProxyAccessException ("ErrorCode: " + errorCode );
496+
497+ } catch (JSONException e ) {
498+ return response .getJSONObject ("response" ); // PublicKeyCredential
499+ }
500+ } else {
501+ return new JSONObject ();
502+ }
503+ } catch (IOException | KeepassProxyAccessException e ) {
504+ LOG .info (e .toString (), e .getCause ());
505+ }
506+ return new JSONObject ();
507+ }
508+
467509 /**
468510 * Extract the groupUuid for the newly created group.
469511 * Note: in case a group with the following path was created: level1/level2, only level2 gets returned as name.
0 commit comments