aboutsummaryrefslogtreecommitdiff
path: root/src/graphql/user
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-03 08:57:37 -0800
committerFuwn <[email protected]>2026-03-03 08:57:48 -0800
commit39790c764eccc088b83d375a65fc89174d5dea01 (patch)
treeabd318702992d809913ff05444b731393bb971ab /src/graphql/user
parentchore(effect): add v4 cookie decode foundation and tests (diff)
downloaddue.moe-39790c764eccc088b83d375a65fc89174d5dea01.tar.xz
due.moe-39790c764eccc088b83d375a65fc89174d5dea01.zip
refactor(effect): migrate core auth decode boundaries
Diffstat (limited to 'src/graphql/user')
-rw-r--r--src/graphql/user/resolvers.ts10
1 files changed, 3 insertions, 7 deletions
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<Partial<Record<string, string>>, 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 (