···11// See https://svelte.dev/docs/kit/types#app.d.ts
2233-import type { Agent, AtpBaseClient } from "@atproto/api";
33+import type { Agent } from "@atproto/api";
44import type { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
5566// for information about these interfaces
···10101111 // set on `hooks.server.ts`, available on server functions
1212 interface Locals {
1313- agent: Agent | AtpBaseClient | undefined;
1313+ authedAgent: Agent | undefined;
1414 user: ProfileViewDetailed | undefined;
1515 }
1616
+4-11
src/hooks.server.ts
···11+import { Agent } from "@atproto/api";
12import { atclient } from "$lib/atproto";
22-import { AtpBaseClient, Agent } from "@atproto/api";
3344import { decryptToString } from "$lib/server/encryption";
55import { decodeBase64, decodeBase64urlIgnorePadding } from "@oslojs/encoding";
···2525 const oauthSession = await atclient.restore(decrypted);
26262727 // set the authed agent
2828- const agent = new Agent(oauthSession);
2929- event.locals.agent = agent;
2828+ const authedAgent = new Agent(oauthSession);
2929+ event.locals.authedAgent = authedAgent;
30303131 // set the authed user with decrypted session DID
3232- const user = await agent.getProfile({ actor: decrypted });
3232+ const user = await authedAgent.getProfile({ actor: decrypted });
3333 event.locals.user = user.data;
3434- }
3535- else {
3636- // set public API agent
3737- const agent = new AtpBaseClient({
3838- service: "https://slingshot.microcosm.blue"
3939- });
4040- event.locals.agent = agent;
4134 }
42354336 return resolve(event);
···2233export async function load({ locals }: ServerLoadEvent) {
44 // have user available throughout the app via LayoutData
55- return { user: locals.user };
55+ return { user: locals.user, authedAgent: locals.authedAgent };
66}