passwordPolicy method

Future<PasswordPolicy> passwordPolicy()

Get the password policy configured for the ReachFive client.

These are the values configured on the Password policy page of the ReachFive console (minimum length, minimum strength, required character classes, ...).

Implementation

Future<PasswordPolicy> passwordPolicy() async {
  final response = await configApi.getConfig(
    clientId: reachFiveKey.sdkConfig.clientId,
  );

  final passwordPolicy = response.data?.passwordPolicy;

  if (passwordPolicy == null) {
    throw const FormatException(
      'The ReachFive config response did not contain a password policy.',
    );
  }

  return PasswordPolicyConverter.fromInterface(passwordPolicy);
}