triggerLogin static method
Future<TorusCredentials>
triggerLogin({
- required TorusLogin typeOfLogin,
- required String verifier,
- required String clientId,
- Map jwtParams = const {},
Implementation
static Future<TorusCredentials> triggerLogin({
required TorusLogin typeOfLogin,
required String verifier,
required String clientId,
Map jwtParams = const {},
}) async {
try {
final String typeOfLoginString = typeOfLogin.toString();
final Map loginResponse = await _channel.invokeMethod('triggerLogin', {
'typeOfLogin':
typeOfLoginString.substring(typeOfLoginString.lastIndexOf('.') + 1),
'verifier': verifier,
'clientId': clientId,
'jwtParams': jwtParams
});
return TorusCredentials(
loginResponse['publicAddress'],
loginResponse['privateKey'],
_convertUserInfo(loginResponse['userInfo']),
);
} on PlatformException catch (e) {
switch (e.code) {
case "UserCancelledException":
throw UserCancelledException();
case "NoAllowedBrowserFoundException":
throw NoAllowedBrowserFoundException();
default:
rethrow;
}
}
}