getRecoveryCodes method

Future<List<String>> getRecoveryCodes({
  1. bool generateNewCodes = false,
})

Gets the recovery codes for the authenticated user.

generateNewCodes if true, generates new recovery codes and invalidates existing ones. If false, returns the current recovery codes (if any exist).

Returns a Future that completes with a list of recovery code strings. If generateNewCodes is true, the user must acknowledge the new codes using completeAcknowledgement before they can be used.

Implementation

Future<List<String>> getRecoveryCodes({bool generateNewCodes = false}) =>
    _requestChannel.request<List<String>>(
      'getRecoveryCodes',
      args: [generateNewCodes],
      builder: (data) {
        if (data is List) {
          return data.map((item) => item.toString()).toList();
        }
        return <String>[];
      },
    );