use same naming style of channel methods as oath

This commit is contained in:
Adam Velebil 2024-03-01 10:05:03 +01:00
parent b6054a258b
commit 87c28e3328
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
2 changed files with 23 additions and 23 deletions

View File

@ -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 {

View File

@ -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<PinResult> 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<PinResult> 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<void> 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) {