dev vouch dev on at. thats about it atvouch.dev
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

frontend: add mechanism for me to invalidate all sessions

Luna afb10a35 b8215d7c

+12
+12
frontend/src/auth.ts
··· 16 16 } from "@atcute/identity-resolver"; 17 17 18 18 const STORAGE_KEY = "atvouch_did"; 19 + const AUTH_VERSION_KEY = "authVersion"; 20 + const AUTH_VERSION = 1; 19 21 20 22 export function initOAuth() { 21 23 configureOAuth({ ··· 61 63 const result = await finalizeAuthorization(params); 62 64 const agent = new OAuthUserAgent(result.session); 63 65 localStorage.setItem(STORAGE_KEY, agent.sub); 66 + localStorage.setItem(AUTH_VERSION_KEY, String(AUTH_VERSION)); 64 67 return agent; 65 68 } 66 69 ··· 68 71 const did = localStorage.getItem(STORAGE_KEY); 69 72 if (!did) return null; 70 73 74 + const storedVersion = parseInt(localStorage.getItem(AUTH_VERSION_KEY) ?? "0", 10); 75 + if (storedVersion < AUTH_VERSION) { 76 + localStorage.removeItem(STORAGE_KEY); 77 + localStorage.removeItem(AUTH_VERSION_KEY); 78 + return null; 79 + } 80 + 71 81 try { 72 82 const session = await getSession(did as Did, { allowStale: true }); 73 83 return new OAuthUserAgent(session); 74 84 } catch { 75 85 localStorage.removeItem(STORAGE_KEY); 86 + localStorage.removeItem(AUTH_VERSION_KEY); 76 87 return null; 77 88 } 78 89 } ··· 86 97 } 87 98 await deleteStoredSession(did); 88 99 localStorage.removeItem(STORAGE_KEY); 100 + localStorage.removeItem(AUTH_VERSION_KEY); 89 101 }