Lanyards is a dedicated profile for researchers, built on the AT Protocol.
1/**
2 * OAuth Client Configuration
3 *
4 * Note: The @atproto/oauth-client-node package requires complex setup.
5 * This is a temporary type-safe placeholder implementation.
6 *
7 * To properly implement OAuth:
8 * 1. Review AT Protocol OAuth documentation
9 * 2. Set up NodeSavedStateStore and NodeSavedSessionStore
10 * 3. Configure client metadata properly
11 * 4. Handle DPoP tokens
12 *
13 * For initial development, consider using app passwords or direct API auth
14 */
15
16// Placeholder type
17export type OAuthClient = {
18 authorize: (handle: string) => Promise<string>;
19 callback: (params: URLSearchParams) => Promise<{
20 session: {
21 sub: string;
22 scope: string;
23 };
24 state: string | null;
25 }>;
26};
27
28let oauthClient: OAuthClient | null = null;
29
30export async function getOAuthClient(): Promise<OAuthClient> {
31 if (oauthClient) {
32 return oauthClient;
33 }
34
35 // TODO: Implement proper OAuth client initialization
36 // See @atproto/oauth-client-node documentation
37
38 throw new Error(
39 'OAuth client not yet fully configured. Please set up OAuth according to AT Protocol documentation.'
40 );
41}
42
43export async function createAuthUrl(handle: string): Promise<string> {
44 const client = await getOAuthClient();
45 return await client.authorize(handle);
46}