### Install @atcute/oauth-browser-client Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/browser-client/README.md Install the package using npm. ```sh npm install @atcute/oauth-browser-client ``` -------------------------------- ### Install @atcute/xrpc-server-bun Source: https://github.com/mary-ext/atcute/blob/trunk/packages/servers/xrpc-server-bun/README.md Install the package using npm. ```sh npm install @atcute/xrpc-server-bun ``` -------------------------------- ### Install @atcute/oauth-keyset Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/keyset/README.md Install the package using npm. ```sh npm install @atcute/oauth-keyset ``` -------------------------------- ### Install @atcute/oauth-node-client Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/node-client/README.md Install the package using npm. ```sh npm install @atcute/oauth-node-client ``` -------------------------------- ### Install @atcute/lexicon-doc Source: https://github.com/mary-ext/atcute/blob/trunk/packages/lexicons/lexicon-doc/README.md Install the package using npm. ```sh npm install @atcute/lexicon-doc ``` -------------------------------- ### Install Runtimes with Mise Source: https://github.com/mary-ext/atcute/blob/trunk/README.md Installs the necessary runtimes for the project using the mise tool. Ensure mise is installed and configured. ```sh mise install ``` -------------------------------- ### Install @atcute/standard-site Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/standard-site/README.md Install the package using npm. ```sh npm install @atcute/standard-site ``` -------------------------------- ### Install @atcute/crypto Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/crypto/README.md Install the package using npm. ```sh npm install @atcute/crypto ``` -------------------------------- ### Install @atcute/frontpage Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/frontpage/README.md Install the package using npm. ```sh npm install @atcute/frontpage ``` -------------------------------- ### Install @atcute/multibase Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/multibase/README.md Install the package using npm. ```bash npm install @atcute/multibase ``` -------------------------------- ### Install @atcute/tid Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/tid/README.md Install the library using npm. ```sh npm install @atcute/tid ``` -------------------------------- ### Install @atcute/labeler Source: https://github.com/mary-ext/atcute/blob/trunk/packages/servers/labeler/README.md Install the package using npm. ```sh npm install @atcute/labeler ``` -------------------------------- ### Install @atcute/time-ms Source: https://github.com/mary-ext/atcute/blob/trunk/packages/misc/time-ms/README.md Install the package using npm. ```sh npm install @atcute/time-ms ``` -------------------------------- ### Install @atcute/xrpc-server-node Source: https://github.com/mary-ext/atcute/blob/trunk/packages/servers/xrpc-server-node/README.md Install the package using npm. ```sh npm install @atcute/xrpc-server-node ``` -------------------------------- ### Install @atcute/lexicon-resolver Source: https://github.com/mary-ext/atcute/blob/trunk/packages/lexicons/lexicon-resolver/README.md Install the package using npm. ```sh npm install @atcute/lexicon-resolver ``` -------------------------------- ### Install @atcute/bluemoji Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/bluemoji/README.md Install the package using npm. ```sh npm install @atcute/bluemoji ``` -------------------------------- ### Install @atcute/bluesky-search-parser Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/search-parser/README.md Install the package using npm. ```sh npm install @atcute/bluesky-search-parser ``` -------------------------------- ### Install @atcute/lexicons Source: https://github.com/mary-ext/atcute/blob/trunk/packages/lexicons/lexicons/README.md Install the @atcute/lexicons package using npm. ```sh npm install @atcute/lexicons ``` -------------------------------- ### Install @atcute/repo Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/repo/README.md Install the @atcute/repo package using npm. ```sh npm install @atcute/repo ``` -------------------------------- ### Install @atcute/lexicon-community Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/lexicon-community/README.md Install the package using npm. ```sh npm install @atcute/lexicon-community ``` -------------------------------- ### Install @atcute/ozone Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/ozone/README.md Install the @atcute/ozone package using npm. ```sh npm install @atcute/ozone ``` -------------------------------- ### Install @atcute/pckt Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/pckt/README.md Install the package using npm. ```sh npm install @atcute/pckt ``` -------------------------------- ### Install Dependencies Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/node-client-example/README.md Install project dependencies using bun. ```sh bun install ``` -------------------------------- ### Install @atcute/firehose Source: https://github.com/mary-ext/atcute/blob/trunk/packages/clients/firehose/README.md Install the package using npm. ```sh npm install @atcute/firehose ``` -------------------------------- ### Install @atcute/bluesky-threading Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/threading/README.md Install the package using npm. ```sh npm install @atcute/bluesky-threading ``` -------------------------------- ### Install @atcute/lexicon-resolver-node Source: https://github.com/mary-ext/atcute/blob/trunk/packages/lexicons/lexicon-resolver-node/README.md Install the package using npm. ```sh npm install @atcute/lexicon-resolver-node ``` -------------------------------- ### Install @atcute/identity-resolver Source: https://github.com/mary-ext/atcute/blob/trunk/packages/identity/identity-resolver/README.md Install the package using npm. ```sh npm install @atcute/identity-resolver ``` -------------------------------- ### Install @atcute/bluesky-richtext-builder Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/richtext-builder/README.md Install the package using npm. ```sh npm install @atcute/bluesky-richtext-builder ``` -------------------------------- ### Install @atcute/did-plc Package Source: https://github.com/mary-ext/atcute/blob/trunk/packages/identity/did-plc/README.md Install the package using npm. ```sh npm install @atcute/did-plc ``` -------------------------------- ### Install @atcute/bluesky-richtext-segmenter Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/richtext-segmenter/README.md Install the package using npm. ```sh npm install @atcute/bluesky-richtext-segmenter ``` -------------------------------- ### Install @atcute/oauth-cab Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/cab/README.md Install the @atcute/oauth-cab package using npm. ```sh npm install @atcute/oauth-cab ``` -------------------------------- ### Install @atcute/xrpc-server Source: https://github.com/mary-ext/atcute/blob/trunk/packages/servers/xrpc-server/README.md Install the xrpc-server package using npm. ```sh npm install @atcute/xrpc-server ``` -------------------------------- ### Install @atcute/cid Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/cid/README.md Install the @atcute/cid package using npm. ```sh npm install @atcute/cid ``` -------------------------------- ### Install @atcute/atproto Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/atproto/README.md Install the @atcute/atproto package using npm. ```sh npm install @atcute/atproto ``` -------------------------------- ### Usage Example with CommunityLexiconCalendarEvent Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/lexicon-community/README.md Demonstrates creating and validating a CommunityLexiconCalendarEvent record. Ensure '@atcute/lexicons' is installed for the 'is' function. ```ts import { CommunityLexiconCalendarEvent } from '@atcute/lexicon-community'; import { is } from '@atcute/lexicons'; const record: CommunityLexiconCalendarEvent.Main = { $type: 'community.lexicon.calendar.event', name: 'DoD Stammtisch May 2025', description: 'The last Stammtisch before @protocol.berlin v2', status: 'community.lexicon.calendar.event#scheduled', mode: 'community.lexicon.calendar.event#inperson', startsAt: '2025-05-21T17:00:00.000Z', createdAt: '2025-05-14T23:13:18.129Z', locations: [ { $type: 'community.lexicon.location.address', name: '@c-base.org', country: 'DE', locality: 'Berlin', region: 'Berlin', street: 'Rungestrasse 20', postalCode: '10179', }, ], }; is(CommunityLexiconCalendarEvent.mainSchema, record); // -> true ``` -------------------------------- ### Setup Environment Variables Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/node-client-example/README.md Create and generate a private key for the .env.local file. ```sh bun run setup:env ``` -------------------------------- ### Install @atcute/tap Source: https://github.com/mary-ext/atcute/blob/trunk/packages/clients/tap/README.md Install the Tap client using npm. This is the first step before using the client in your project. ```sh npm install @atcute/tap ``` -------------------------------- ### Creating a Bluesky Post with RichtextBuilder Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/richtext-builder/README.md Example of using RichtextBuilder with @atcute/client to create and post rich text content to Bluesky. Requires installation of related packages. ```sh npm install @atcute/client @atcute/password-session @atcute/bluesky ``` ```ts import { Client, ok } from '@atcute/client'; import { PasswordSession } from '@atcute/password-session'; import RichtextBuilder from '@atcute/bluesky-richtext-builder'; import type {} from '@atcute/bluesky'; const session = await PasswordSession.login({ service: 'https://bsky.social', identifier: 'you.bsky.social', password: 'your-app-password', }); const rpc = new Client({ handler: session }); const rt = new RichtextBuilder() .addText('hello ') .addMention('@bsky.app', 'did:plc:z72i7hdynmk6r22z27h6tvur') .addText('! ') .addTag('#atproto', 'atproto'); await ok( rpc.post('com.atproto.repo.createRecord', { input: { repo: session.did, collection: 'app.bsky.feed.post', record: { $type: 'app.bsky.feed.post', text: rt.text, facets: rt.facets, createdAt: new Date().toISOString(), }, }, }), ); ``` -------------------------------- ### Fetch Profile using @atcute/client Source: https://github.com/mary-ext/atcute/blob/trunk/packages/definitions/bluesky/README.md Example of using the @atcute/client to make an XRPC call to get a user profile. Ensure the client is initialized with a valid handler and service endpoint. ```typescript import { Client, simpleFetchHandler } from '@atcute/client'; const client = new Client({ handler: simpleFetchHandler({ service: 'https://public.api.bsky.app' }), }); const response = await client.get('app.bsky.actor.getProfile', { params: { act: 'did:plc:z72i7hdynmk6r22z27h6tvur', }, }); // ... ``` -------------------------------- ### Implementing Subscriptions Source: https://github.com/mary-ext/atcute/blob/trunk/packages/servers/xrpc-server/README.md This example demonstrates how to set up a subscription handler using the XRPCRouter and a runtime-specific WebSocket adapter. The handler is an async generator that yields messages to clients. ```APIDOC ## addSubscription ### Description Adds a subscription to the router. The handler is an async generator that yields messages to clients. The `signal` is aborted when the client disconnects. ### Method `router.addSubscription(ComExampleSubscribe, { handler, ... })` ### Parameters - **ComExampleSubscribe**: The lexicon for the subscription. - **handler**: An async generator function that yields messages. - **params**: Parameters for the subscription. - **signal**: An AbortSignal that is aborted when the client disconnects. ### Request Example ```ts import { XRPCRouter } from '@atcute/xrpc-server'; import { createBunWebSocket } from '@atcute/xrpc-server-bun'; import { ComExampleSubscribe } from './lexicons/index.js'; const ws = createBunWebSocket(); const router = new XRPCRouter({ websocket: ws.adapter }); router.addSubscription(ComExampleSubscribe, { async *handler({ params, signal }) { while (!signal.aborted) { const events = await getNewEvents(params.cursor); for (const event of events) { yield event; } await sleep(1000); } }, }); export default ws.wrap(router); ``` ### Response Messages are yielded by the handler and sent to the client as CBOR frames. ``` ```APIDOC ## XRPCSubscriptionError ### Description Used to throw specific errors from subscription handlers, such as when a cursor is too old. ### Method `throw new XRPCSubscriptionError({ error, message })` ### Parameters - **error**: A string identifying the type of error (e.g., 'FutureCursor'). - **message**: A descriptive message for the error. ``` -------------------------------- ### Install atcute Client and Bluesky Packages Source: https://github.com/mary-ext/atcute/blob/trunk/README.md Install the necessary packages for the atcute client and Bluesky integration using npm. ```sh npm install @atcute/client @atcute/bluesky ``` -------------------------------- ### Install @atcute/oauth-types Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/types/README.md Install the package using npm. ```sh npm install @atcute/oauth-types ``` -------------------------------- ### CLI Usage Example Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/node-client-public-example/README.md Run the CLI to authenticate and display user profile information. Supports both handle and DID inputs. ```bash bun run start alice.bsky.social ``` ```bash bun run start did:plc:z72i7hdynmk6r22z27h6tvur ``` -------------------------------- ### Install @atcute/varint Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/varint/README.md Install the package using npm. ```sh npm install @atcute/varint ``` -------------------------------- ### Install @atcute/car Source: https://github.com/mary-ext/atcute/blob/trunk/packages/utilities/car/README.md Install the package using npm. ```sh npm install @atcute/car ``` -------------------------------- ### Install @atcute/bluesky-moderation Source: https://github.com/mary-ext/atcute/blob/trunk/packages/bluesky/moderation/README.md Install the package using npm. ```sh npm install @atcute/bluesky-moderation ``` -------------------------------- ### Initialize ClientAssertionBackend Source: https://github.com/mary-ext/atcute/blob/trunk/packages/oauth/cab/README.md Set up the ClientAssertionBackend with your client ID, endpoint URL, and a signing keyset. The keyset is generated using `generateClientAssertionKey`. ```ts import { ClientAssertionBackend, generateClientAssertionKey, Keyset } from '@atcute/oauth-cab'; const keyset = new Keyset([await generateClientAssertionKey('key-1')]); const backend = new ClientAssertionBackend({ clientId: 'https://my.client.com/oauth-client-metadata.json', endpoint: 'https://my.client.com/oauth/client-assertion', keyset, }); ```