mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 18:22:39 +03:00
Add specific error status for FIDO key mismatch.
This commit is contained in:
parent
a08fb71ec6
commit
9fcf468fe5
@ -55,6 +55,13 @@ class InactivityException(RpcException):
|
||||
)
|
||||
|
||||
|
||||
class KeyMismatchException(RpcException):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
"key-mismatch", "Re-inserted YubiKey does not match initial device"
|
||||
)
|
||||
|
||||
|
||||
def _ctap_id(ctap):
|
||||
return (ctap.info.aaguid, ctap.info.firmware_version)
|
||||
|
||||
@ -171,7 +178,7 @@ class Ctap2Node(RpcNode):
|
||||
logger.debug("Performing reset...")
|
||||
self.ctap = Ctap2(connection)
|
||||
if target != _ctap_id(self.ctap):
|
||||
raise ValueError("Re-inserted YubiKey does not match initial device")
|
||||
raise KeyMismatchException()
|
||||
try:
|
||||
self.ctap.reset(event=event)
|
||||
except CtapError as e:
|
||||
|
@ -99,7 +99,7 @@ class _ResetDialogState extends ConsumerState<ResetDialog> {
|
||||
if (e is RpcError) {
|
||||
if (e.status == 'connection-error') {
|
||||
errorMessage = l10n.l_failed_connecting_to_fido;
|
||||
} else if (e.status == 'invalid-command') {
|
||||
} else if (e.status == 'key-mismatch') {
|
||||
errorMessage = l10n.l_wrong_inserted_yk_error;
|
||||
} else if (e.status == 'user-action-timeout') {
|
||||
errorMessage = l10n.l_user_action_timeout_error;
|
||||
|
Loading…
Reference in New Issue
Block a user