AT protocol bookmarking platforms in obsidian
at margin 18 lines 554 B view raw
1import { Client, CredentialManager, simpleFetchHandler } from "@atcute/client"; 2 3const DEFAULT_PDS = "https://bsky.social"; 4 5export interface Credentials { 6 identifier: string; 7 password: string; 8} 9 10export async function createAuthenticatedClient(creds: Credentials): Promise<Client> { 11 const manager = new CredentialManager({ service: DEFAULT_PDS }); 12 await manager.login(creds); 13 return new Client({ handler: manager }); 14} 15 16export function createPublicClient(): Client { 17 return new Client({ handler: simpleFetchHandler({ service: DEFAULT_PDS }) }); 18}