getMfaMethods method

Future<MfaMethodsResponse> getMfaMethods()

Gets verified MFA devices and passkeys.

Implementation

Future<MfaMethodsResponse> getMfaMethods() async {
  Future<MfaMethodsResponse> instrumentationOperation() async {
    final operationScope = _state.flowScope.capture(replace: false);
    await operationScope.ready();
    if (!_state.initialized) {
      throw DynamicStateException("call initialize() before using the client");
    }
    if (_state.token == null) {
      throw DynamicStateException("not authenticated — sign in first");
    }
    operationScope.check();
    final result = await _api.get<MfaMethodsResponse>(path: "/users/mfa/methods", token: _state.token, sessionPublicKey: _state.sessionPublicKey, parse: MfaMethodsResponse.fromJson, query: <String, String>{"verifiedOnly": "true"});
    operationScope.check();
    return result;
  }
  return await _api.instrumentation.runAsync("auth.getMfaMethods", instrumentationOperation);
}