blob: 321e5cfd7f960b2a3f713e6dd895b6420978613e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie";
import { encryptFeedToken } from "$lib/Utility/feedToken";
// Mint the RSS feed token server-side: the encryption key never reaches the
// client, so the URL is built here from the refresh token already in the cookie
// rather than from tokens handed to the browser.
export const load = async ({ cookies }) => {
const cookie = cookies.get("user");
const user = cookie ? decodeAuthCookieOrNull(cookie) : null;
return {
feedToken: user ? await encryptFeedToken(user.refreshToken) : undefined,
};
};
|