a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs(bluesky-richtext-builder): update examples to point to password-session

Mary 44d00711 9d5833a1

+16 -6
+16 -6
packages/bluesky/richtext-builder/README.md
··· 50 50 51 51 use with `@atcute/client` to create a post: 52 52 53 + ```sh 54 + npm install @atcute/client @atcute/password-session @atcute/bluesky 55 + ``` 56 + 53 57 ```ts 54 - import { Client, CredentialManager, ok } from '@atcute/client'; 58 + import { Client, ok } from '@atcute/client'; 59 + import { PasswordSession } from '@atcute/password-session'; 55 60 import RichtextBuilder from '@atcute/bluesky-richtext-builder'; 56 61 57 62 import type {} from '@atcute/bluesky'; 58 63 59 - const manager = new CredentialManager({ service: 'https://bsky.social' }); 60 - const rpc = new Client({ handler: manager }); 64 + const session = await PasswordSession.login({ 65 + service: 'https://bsky.social', 66 + identifier: 'you.bsky.social', 67 + password: 'your-app-password', 68 + }); 61 69 62 - await manager.login({ identifier: 'you.bsky.social', password: 'your-app-password' }); 70 + const rpc = new Client({ handler: session }); 63 71 64 72 const rt = new RichtextBuilder() 65 73 .addText('hello ') ··· 70 78 await ok( 71 79 rpc.post('com.atproto.repo.createRecord', { 72 80 input: { 73 - repo: manager.session!.did, 81 + repo: session.did, 74 82 collection: 'app.bsky.feed.post', 75 83 record: { 76 84 $type: 'app.bsky.feed.post', ··· 117 125 118 126 const handleResolver = new CompositeHandleResolver({ 119 127 methods: { 120 - dns: new DohJsonHandleResolver({ dohUrl: 'https://mozilla.cloudflare-dns.com/dns-query' }), 128 + dns: new DohJsonHandleResolver({ 129 + dohUrl: 'https://mozilla.cloudflare-dns.com/dns-query', 130 + }), 121 131 http: new WellKnownHandleResolver(), 122 132 }, 123 133 });