const ETRADE_LICENSE_NO_KEY = "etrade-auth-license-no";

/** Persist license number for the eTrade OTP verification step. */
export function storeEtradeLicenseNo(licenseNo: string): void {
  if (typeof sessionStorage === "undefined") return;
  sessionStorage.setItem(ETRADE_LICENSE_NO_KEY, licenseNo.trim());
}

export function getEtradeLicenseNo(): string | null {
  if (typeof sessionStorage === "undefined") return null;
  return sessionStorage.getItem(ETRADE_LICENSE_NO_KEY);
}

export function clearEtradeLicenseNo(): void {
  if (typeof sessionStorage === "undefined") return;
  sessionStorage.removeItem(ETRADE_LICENSE_NO_KEY);
}
