diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt b/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt index 17ebce49..a2dacc84 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/fido/FidoManager.kt @@ -115,22 +115,22 @@ class FidoManager( fidoChannel.setHandler(coroutineScope) { method, args -> when (method) { - "fido_reset" -> resetHelper.reset() + "reset" -> resetHelper.reset() - "fido_reset_cancel" -> resetHelper.cancelReset() + "cancelReset" -> resetHelper.cancelReset() - "session_unlock" -> unlock( + "unlock" -> unlock( (args["pin"] as String).toCharArray() ) - "session_set_pin" -> setPin( + "setPin" -> setPin( (args["pin"] as String?)?.toCharArray(), - (args["new_pin"] as String).toCharArray(), + (args["newPin"] as String).toCharArray(), ) - "credential_delete" -> deleteCredential( - args["rp_id"] as String, - args["credential_id"] as String + "deleteCredential" -> deleteCredential( + args["rpId"] as String, + args["credentialId"] as String ) else -> throw NotImplementedError() @@ -288,8 +288,8 @@ class FidoManager( JSONObject( mapOf( "success" to false, - "pin_retries" to pinRetriesResult.count, - "auth_blocked" to (ctapException.ctapError == CtapException.ERR_PIN_AUTH_BLOCKED) + "pinRetries" to pinRetriesResult.count, + "authBlocked" to (ctapException.ctapError == CtapException.ERR_PIN_AUTH_BLOCKED) ) ).toString() } else { diff --git a/lib/android/fido/state.dart b/lib/android/fido/state.dart index e5f42737..16df329a 100644 --- a/lib/android/fido/state.dart +++ b/lib/android/fido/state.dart @@ -72,7 +72,7 @@ class _FidoStateNotifier extends FidoStateNotifier { }); controller.onCancel = () async { - await _methods.invokeMethod('fido_reset_cancel'); + await _methods.invokeMethod('cancelReset'); if (!controller.isClosed) { await subscription.cancel(); } @@ -80,11 +80,11 @@ class _FidoStateNotifier extends FidoStateNotifier { controller.onListen = () async { try { - await _methods.invokeMethod('fido_reset'); + await _methods.invokeMethod('reset'); await controller.sink.close(); ref.invalidateSelf(); } catch (e) { - _log.debug('Error during fido_reset: \'$e\''); + _log.debug('Error during reset: \'$e\''); controller.sink.addError(e); } }; @@ -96,10 +96,10 @@ class _FidoStateNotifier extends FidoStateNotifier { Future setPin(String newPin, {String? oldPin}) async { try { final response = jsonDecode(await _methods.invokeMethod( - 'session_set_pin', + 'setPin', { 'pin': oldPin, - 'new_pin': newPin, + 'newPin': newPin, }, )); if (response['success'] == true) { @@ -109,8 +109,8 @@ class _FidoStateNotifier extends FidoStateNotifier { _log.debug('FIDO pin set/change failed'); return PinResult.failed( - response['pin_retries'], - response['auth_blocked'], + response['pinRetries'], + response['authBlocked'], ); } on PlatformException catch (pe) { var decodedException = pe.decode(); @@ -125,7 +125,7 @@ class _FidoStateNotifier extends FidoStateNotifier { Future unlock(String pin) async { try { final response = jsonDecode(await _methods.invokeMethod( - 'session_unlock', + 'unlock', {'pin': pin}, )); @@ -136,8 +136,8 @@ class _FidoStateNotifier extends FidoStateNotifier { _log.debug('FIDO applet unlock failed'); return PinResult.failed( - response['pin_retries'], - response['auth_blocked'], + response['pinRetries'], + response['authBlocked'], ); } on PlatformException catch (pe) { var decodedException = pe.decode(); @@ -207,10 +207,10 @@ class _FidoCredentialsNotifier extends FidoCredentialsNotifier { Future deleteCredential(FidoCredential credential) async { try { await _methods.invokeMethod( - 'credential_delete', + 'deleteCredential', { - 'rp_id': credential.rpId, - 'credential_id': credential.credentialId, + 'rpId': credential.rpId, + 'credentialId': credential.credentialId, }, ); } on PlatformException catch (pe) {