A Deno-compatible AT Protocol OAuth client that serves as a drop-in replacement for @atproto/oauth-client-node
at main 58 lines 1.9 kB view raw
1/** 2 * @fileoverview AT Protocol OAuth client for Deno 3 * 4 * A Deno-compatible AT Protocol OAuth client built for handle-based authentication. 5 * **Not a drop-in replacement** for @atproto/oauth-client-node - this client is 6 * handle-focused and designed specifically for Deno environments using Web Crypto API. 7 * Built to solve crypto compatibility issues between Node.js-specific implementations 8 * and Deno runtime environments. 9 * 10 * Uses Web Crypto API exclusively for maximum cross-platform compatibility. 11 * 12 * @example Basic usage 13 * ```ts 14 * import { OAuthClient, MemoryStorage } from "@tijs/oauth-client-deno"; 15 * 16 * const client = new OAuthClient({ 17 * clientId: "https://myapp.com/client-metadata.json", 18 * redirectUri: "https://myapp.com/oauth/callback", 19 * storage: new MemoryStorage(), 20 * }); 21 * 22 * // Start OAuth flow 23 * const authUrl = await client.authorize("alice.bsky.social"); 24 * 25 * // Handle callback 26 * const { session } = await client.callback({ code: "...", state: "..." }); 27 * 28 * // Make authenticated requests 29 * const response = await session.makeRequest("GET", "https://bsky.social/xrpc/..."); 30 * ``` 31 * 32 * @module 33 */ 34 35export { OAuthClient } from "./src/client.ts"; 36export { Session, type SessionData } from "./src/session.ts"; 37export { LocalStorage, MemoryStorage, SQLiteStorage, type Storage } from "./src/storage.ts"; 38export { 39 createDefaultResolver, 40 CustomResolver, 41 DirectoryResolver, 42 SlingshotResolver, 43} from "./src/resolvers.ts"; 44export { ConsoleLogger, type Logger, NoOpLogger } from "./src/logger.ts"; 45export type { 46 AuthorizeOptions, 47 HandleResolver, 48 OAuthClientConfig, 49 OAuthSession, 50 OAuthStorage, 51} from "./src/types.ts"; 52export * from "./src/errors.ts"; 53export { 54 validateAuthServerMetadata, 55 type ValidatedAuthServerMetadata, 56 type ValidatedTokenResponse, 57 validateTokenResponse, 58} from "./src/validation.ts";