oneTimePasscodeActivate method

  1. @override
Future<AuthResult> oneTimePasscodeActivate(
  1. String otp,
  2. String otpId
)
override

Implementation

@override
Future<AuthResult> oneTimePasscodeActivate(String otp, String otpId) async {
  try {
    final resultPromise = passage.oneTimePasscodeActivate(otp, otpId);
    final jsObject = await js_util.promiseToFuture(resultPromise);
    return AuthResult.fromJson(jsObject);
  } catch (e) {
    final overrideCode = e.toString().contains('exceeded number of attempts')
        ? PassageErrorCode.otpActivationExceededAttempts
        : PassageErrorCode.otpError;
    throw PassageError.fromObject(object: e, overrideCode: overrideCode);
  }
}