From c865bbd96a0cc5fd38339773bad73b6630d33ed0 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 06 May 2026 18:40:27 +0000 Subject: [PATCH] docs: add info for use with @atproto/api Signed-off-by: Trezy --- packages/docs/docs/sdk/overview.md | 2 ++ packages/oauth-client-browser/README.md | 14 ++++++++++++++ 2 file(s) changed, 16 insertion(s)(+), 0 deletion(s)(-) diff --git a/packages/docs/docs/sdk/overview.md b/packages/docs/docs/sdk/overview.md --- a/packages/docs/docs/sdk/overview.md +++ b/packages/docs/docs/sdk/overview.md @@ -13,6 +13,8 @@ ## Which package do I need? **Starting a new app?** Use `@happyview/lex-agent` with `@atproto/lex`. It gives you type-safe XRPC calls through a `Client` that routes requests to your HappyView instance with DPoP authentication. This is the recommended way to interact with HappyView from JavaScript. +**Already using `@atproto/api`?** `HappyViewSession` works directly as a session manager for `@atproto/api`'s `Agent` — just pass it to `new Agent(session)`. See [Using with @atproto/api](./oauth-client-browser.md#using-with-atprotoapi). + **Already using `@atproto/oauth-client-browser`?** Add `@happyview/oauth-client-browser` to get a `HappyViewBrowserClient` that handles the HappyView-specific DPoP key provisioning and session registration on top of the standard atproto OAuth flow. **Building a server-side (Node.js) app?** Use `@happyview/oauth-client-node` — it handles handle resolution, DID resolution, PDS discovery, and the full OAuth flow server-side. Matches the API surface of `@atproto/oauth-client-node`. diff --git a/packages/oauth-client-browser/README.md b/packages/oauth-client-browser/README.md --- a/packages/oauth-client-browser/README.md +++ b/packages/oauth-client-browser/README.md @@ -70,6 +70,20 @@ { method: "GET" }, ); ``` +### Using with @atproto/api + +`HappyViewSession` works directly with `@atproto/api`'s `Agent`: + +```typescript +import { Agent } from "@atproto/api"; + +const result = await client.init(); +if (result) { + const agent = new Agent(result.session); + const profile = await agent.getProfile({ actor: agent.did }); +} +``` + ### Revoke Session ```typescript -- tangled.sh