Skip to content

Automate browser based workflows with AI

467 B
Raw Blame
const AUTHENTICATOR_KEY_REQUIRED_MESSAGE = "Authenticator key is required.";

type AuthenticatorKeyValues = {
  totp: string;
  totp_type: string;
};

function getAuthenticatorKeyError(
  values: AuthenticatorKeyValues,
): string | null {
  if (values.totp_type !== "authenticator") {
    return null;
  }

  const raw = values.totp.trim();
  if (raw === "") {
    return AUTHENTICATOR_KEY_REQUIRED_MESSAGE;
  }
  return null;
}

export { getAuthenticatorKeyError };