From be8823c4cf53ba5f9f3b88e896ccd9b3a48326b6 Mon Sep 17 00:00:00 2001 From: shay Date: Sun, 19 Apr 2026 19:18:32 -0400 Subject: [PATCH] chore(frontend): delete lib/editToken.ts (replaced by OAuth) Co-Authored-By: Claude Opus 4.7 --- generator/frontend/src/lib/editToken.ts | 36 ------------------------- 1 file changed, 36 deletions(-) delete mode 100644 generator/frontend/src/lib/editToken.ts diff --git a/generator/frontend/src/lib/editToken.ts b/generator/frontend/src/lib/editToken.ts deleted file mode 100644 index 2ec73f7..0000000 --- a/generator/frontend/src/lib/editToken.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Per-username edit token issued by the backend at enrollment. Presented -// as `Authorization: Bearer` on mutating endpoints (PATCH settings, -// POST refresh). Stored in localStorage so a reload keeps the user in -// control of their own profile. -// -// Without this token the backend rejects mutations with HTTP 401. Token is -// only surfaced on the FIRST enroll for a given username — re-hitting the -// enroll path for an existing user returns no token, so we never blow away -// a previously-saved token. - -const STORAGE_PREFIX = 'grs:edit_token:' - -const keyFor = (username: string) => STORAGE_PREFIX + username.toLowerCase() - -export function getEditToken(username: string): string | null { - if (!username) return null - try { - return window.localStorage.getItem(keyFor(username)) - } catch { - return null - } -} - -export function saveEditToken(username: string, token: string | null | undefined): void { - if (!username || !token) return - try { - window.localStorage.setItem(keyFor(username), token) - } catch { - // localStorage can throw in private mode — fall through silently. - } -} - -export function authHeaders(username: string): Record { - const t = getEditToken(username) - return t ? { Authorization: `Bearer ${t}` } : {} -}