/** * Remember which sign-in method the user last used (local only). */ export type LoginMethodId = "email" | "konnos" | "metamask" | "mavi"; const KEY = "krypco_last_login_method"; export function readLastLoginMethod(): LoginMethodId | null { if (typeof window === "undefined") return null; try { const v = window.localStorage.getItem(KEY); if ( v === "email" || v === "konnos" || v === "metamask" || v === "mavi" ) { return v; } return null; } catch { return null; } } export function writeLastLoginMethod(method: LoginMethodId): void { if (typeof window === "undefined") return; try { window.localStorage.setItem(KEY, method); } catch { /* ignore */ } } export function lastLoginLabel(method: LoginMethodId): string { switch (method) { case "email": return "Email code"; case "konnos": return "Konnos"; case "metamask": return "MetaMask"; case "mavi": return "mavi wallet"; } }