Skip to content

Commit f3752d6

Browse files
committed
refactor: improve passkey signing error handling and method naming
1 parent b44c648 commit f3752d6

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

packages/ion_identity_client/lib/src/signer/passkey_signer.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ class PasskeysSigner {
189189
}
190190
throw const NoLocalPasskeyCredsFoundIONIdentityException();
191191
} on PasskeyValidationException catch (e) {
192-
// Auto-passkey attempt (username == '') is triggered on focus.
193-
// If backend sends an invalid challenge (empty rpId), don't crash the UI
192+
// Auto-login with passkey is tried when username is empty (e.g., field focus).
193+
// If the backend returns a bad challenge (like empty rpId), just avoid showing an error to the user.
194194
if (username.isEmpty && localCredsOnly) {
195195
throw NoLocalPasskeyCredsFoundIONIdentityException(e.message);
196196
}
@@ -208,8 +208,7 @@ class PasskeysSigner {
208208
}
209209
}
210210

211-
String _resolveRelyingPartyId(UserActionChallenge challenge) {
212-
// direct rp.id from challenge should be not empty
211+
String _resolveRelyingId(UserActionChallenge challenge) {
213212
final direct = challenge.rp.id.trim();
214213
if (direct.isNotEmpty) {
215214
return direct;
@@ -229,7 +228,7 @@ class PasskeysSigner {
229228
UserActionChallenge challenge, {
230229
bool localCredsOnly = false,
231230
}) async {
232-
final relyingPartyId = _resolveRelyingPartyId(challenge);
231+
final relyingPartyId = _resolveRelyingId(challenge);
233232
final timeoutMs = localCredsOnly == true ? options.timeout : options.otherDeviceTimeout;
234233
try {
235234
final fido2Assertion = await _withWatchdog(

0 commit comments

Comments
 (0)