mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-25 23:14:18 +03:00
use same naming style of channel methods as oath
This commit is contained in:
parent
b6054a258b
commit
87c28e3328
@ -115,22 +115,22 @@ class FidoManager(
|
|||||||
|
|
||||||
fidoChannel.setHandler(coroutineScope) { method, args ->
|
fidoChannel.setHandler(coroutineScope) { method, args ->
|
||||||
when (method) {
|
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()
|
(args["pin"] as String).toCharArray()
|
||||||
)
|
)
|
||||||
|
|
||||||
"session_set_pin" -> setPin(
|
"setPin" -> setPin(
|
||||||
(args["pin"] as String?)?.toCharArray(),
|
(args["pin"] as String?)?.toCharArray(),
|
||||||
(args["new_pin"] as String).toCharArray(),
|
(args["newPin"] as String).toCharArray(),
|
||||||
)
|
)
|
||||||
|
|
||||||
"credential_delete" -> deleteCredential(
|
"deleteCredential" -> deleteCredential(
|
||||||
args["rp_id"] as String,
|
args["rpId"] as String,
|
||||||
args["credential_id"] as String
|
args["credentialId"] as String
|
||||||
)
|
)
|
||||||
|
|
||||||
else -> throw NotImplementedError()
|
else -> throw NotImplementedError()
|
||||||
@ -288,8 +288,8 @@ class FidoManager(
|
|||||||
JSONObject(
|
JSONObject(
|
||||||
mapOf(
|
mapOf(
|
||||||
"success" to false,
|
"success" to false,
|
||||||
"pin_retries" to pinRetriesResult.count,
|
"pinRetries" to pinRetriesResult.count,
|
||||||
"auth_blocked" to (ctapException.ctapError == CtapException.ERR_PIN_AUTH_BLOCKED)
|
"authBlocked" to (ctapException.ctapError == CtapException.ERR_PIN_AUTH_BLOCKED)
|
||||||
)
|
)
|
||||||
).toString()
|
).toString()
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,7 +72,7 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
});
|
});
|
||||||
|
|
||||||
controller.onCancel = () async {
|
controller.onCancel = () async {
|
||||||
await _methods.invokeMethod('fido_reset_cancel');
|
await _methods.invokeMethod('cancelReset');
|
||||||
if (!controller.isClosed) {
|
if (!controller.isClosed) {
|
||||||
await subscription.cancel();
|
await subscription.cancel();
|
||||||
}
|
}
|
||||||
@ -80,11 +80,11 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
|
|
||||||
controller.onListen = () async {
|
controller.onListen = () async {
|
||||||
try {
|
try {
|
||||||
await _methods.invokeMethod('fido_reset');
|
await _methods.invokeMethod('reset');
|
||||||
await controller.sink.close();
|
await controller.sink.close();
|
||||||
ref.invalidateSelf();
|
ref.invalidateSelf();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
_log.debug('Error during fido_reset: \'$e\'');
|
_log.debug('Error during reset: \'$e\'');
|
||||||
controller.sink.addError(e);
|
controller.sink.addError(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -96,10 +96,10 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
Future<PinResult> setPin(String newPin, {String? oldPin}) async {
|
Future<PinResult> setPin(String newPin, {String? oldPin}) async {
|
||||||
try {
|
try {
|
||||||
final response = jsonDecode(await _methods.invokeMethod(
|
final response = jsonDecode(await _methods.invokeMethod(
|
||||||
'session_set_pin',
|
'setPin',
|
||||||
{
|
{
|
||||||
'pin': oldPin,
|
'pin': oldPin,
|
||||||
'new_pin': newPin,
|
'newPin': newPin,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
if (response['success'] == true) {
|
if (response['success'] == true) {
|
||||||
@ -109,8 +109,8 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
|
|
||||||
_log.debug('FIDO pin set/change failed');
|
_log.debug('FIDO pin set/change failed');
|
||||||
return PinResult.failed(
|
return PinResult.failed(
|
||||||
response['pin_retries'],
|
response['pinRetries'],
|
||||||
response['auth_blocked'],
|
response['authBlocked'],
|
||||||
);
|
);
|
||||||
} on PlatformException catch (pe) {
|
} on PlatformException catch (pe) {
|
||||||
var decodedException = pe.decode();
|
var decodedException = pe.decode();
|
||||||
@ -125,7 +125,7 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
Future<PinResult> unlock(String pin) async {
|
Future<PinResult> unlock(String pin) async {
|
||||||
try {
|
try {
|
||||||
final response = jsonDecode(await _methods.invokeMethod(
|
final response = jsonDecode(await _methods.invokeMethod(
|
||||||
'session_unlock',
|
'unlock',
|
||||||
{'pin': pin},
|
{'pin': pin},
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -136,8 +136,8 @@ class _FidoStateNotifier extends FidoStateNotifier {
|
|||||||
|
|
||||||
_log.debug('FIDO applet unlock failed');
|
_log.debug('FIDO applet unlock failed');
|
||||||
return PinResult.failed(
|
return PinResult.failed(
|
||||||
response['pin_retries'],
|
response['pinRetries'],
|
||||||
response['auth_blocked'],
|
response['authBlocked'],
|
||||||
);
|
);
|
||||||
} on PlatformException catch (pe) {
|
} on PlatformException catch (pe) {
|
||||||
var decodedException = pe.decode();
|
var decodedException = pe.decode();
|
||||||
@ -207,10 +207,10 @@ class _FidoCredentialsNotifier extends FidoCredentialsNotifier {
|
|||||||
Future<void> deleteCredential(FidoCredential credential) async {
|
Future<void> deleteCredential(FidoCredential credential) async {
|
||||||
try {
|
try {
|
||||||
await _methods.invokeMethod(
|
await _methods.invokeMethod(
|
||||||
'credential_delete',
|
'deleteCredential',
|
||||||
{
|
{
|
||||||
'rp_id': credential.rpId,
|
'rpId': credential.rpId,
|
||||||
'credential_id': credential.credentialId,
|
'credentialId': credential.credentialId,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} on PlatformException catch (pe) {
|
} on PlatformException catch (pe) {
|
||||||
|
Loading…
Reference in New Issue
Block a user