From 39790c764eccc088b83d375a65fc89174d5dea01 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 3 Mar 2026 08:57:37 -0800 Subject: refactor(effect): migrate core auth decode boundaries --- src/graphql/user/resolvers.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/graphql/user') diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts index 986b9684..dfbaa927 100644 --- a/src/graphql/user/resolvers.ts +++ b/src/graphql/user/resolvers.ts @@ -24,6 +24,7 @@ import { type UserPreferences, } from "$lib/Database/SB/User/preferences"; import privilegedUser from "$lib/Utility/privilegedUser"; +import { decodeAuthCookieOrThrow } from "$lib/Effect/authCookie"; type Context = RequestEvent>, string | null>; type UserResolvers = Pick< @@ -51,14 +52,9 @@ const auth = async (context: Context) => { if (!userCookie) return Error("Unauthorised"); - const user = JSON.parse(userCookie); + const user = decodeAuthCookieOrThrow(userCookie); - return await userIdentity({ - tokenType: user["token_type"], - expiresIn: user["expires_in"], - accessToken: user["access_token"], - refreshToken: user["refresh_token"], - }); + return await userIdentity(user); }; const authenticatedBadgesOperation = async ( -- cgit v1.2.3