@atproto/oauth-client-node 0.0.1 → 0.0.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -1
- package/package.json +9 -9
package/README.md
CHANGED
@@ -39,7 +39,7 @@ const client = new NodeOAuthClientOptions({
|
|
39
39
|
grant_types: ['authorization_code', 'refresh_token'],
|
40
40
|
response_types: ['code'],
|
41
41
|
application_type: 'web',
|
42
|
-
token_endpoint_auth_method: '
|
42
|
+
token_endpoint_auth_method: 'private_key_jwt',
|
43
43
|
dpop_bound_access_tokens: true,
|
44
44
|
jwks_uri: 'https://my-app.com/jwks.json',
|
45
45
|
},
|
@@ -280,6 +280,69 @@ const requestLock: RuntimeLock = async (key, fn) => {
|
|
280
280
|
}
|
281
281
|
```
|
282
282
|
|
283
|
+
## Usage with `@atproto/api`
|
284
|
+
|
285
|
+
`@atproto/oauth-client-*` packages all return an `ApiClient` instance upon
|
286
|
+
successful authentication. This instance can be used to make authenticated
|
287
|
+
requests using all the `ApiClient` methods defined in [[API]] (non exhaustive
|
288
|
+
list of examples below). Any refresh of the credentials will happen under the
|
289
|
+
hood, and the new tokens will be saved in the session store.
|
290
|
+
|
291
|
+
```ts
|
292
|
+
const agent = await client.restore('did:plc:123')
|
293
|
+
|
294
|
+
// Feeds and content
|
295
|
+
await agent.getTimeline(params, opts)
|
296
|
+
await agent.getAuthorFeed(params, opts)
|
297
|
+
await agent.getPostThread(params, opts)
|
298
|
+
await agent.getPost(params)
|
299
|
+
await agent.getPosts(params, opts)
|
300
|
+
await agent.getLikes(params, opts)
|
301
|
+
await agent.getRepostedBy(params, opts)
|
302
|
+
await agent.post(record)
|
303
|
+
await agent.deletePost(postUri)
|
304
|
+
await agent.like(uri, cid)
|
305
|
+
await agent.deleteLike(likeUri)
|
306
|
+
await agent.repost(uri, cid)
|
307
|
+
await agent.deleteRepost(repostUri)
|
308
|
+
await agent.uploadBlob(data, opts)
|
309
|
+
|
310
|
+
// Social graph
|
311
|
+
await agent.getFollows(params, opts)
|
312
|
+
await agent.getFollowers(params, opts)
|
313
|
+
await agent.follow(did)
|
314
|
+
await agent.deleteFollow(followUri)
|
315
|
+
|
316
|
+
// Actors
|
317
|
+
await agent.getProfile(params, opts)
|
318
|
+
await agent.upsertProfile(updateFn)
|
319
|
+
await agent.getProfiles(params, opts)
|
320
|
+
await agent.getSuggestions(params, opts)
|
321
|
+
await agent.searchActors(params, opts)
|
322
|
+
await agent.searchActorsTypeahead(params, opts)
|
323
|
+
await agent.mute(did)
|
324
|
+
await agent.unmute(did)
|
325
|
+
await agent.muteModList(listUri)
|
326
|
+
await agent.unmuteModList(listUri)
|
327
|
+
await agent.blockModList(listUri)
|
328
|
+
await agent.unblockModList(listUri)
|
329
|
+
|
330
|
+
// Notifications
|
331
|
+
await agent.listNotifications(params, opts)
|
332
|
+
await agent.countUnreadNotifications(params, opts)
|
333
|
+
await agent.updateSeenNotifications()
|
334
|
+
|
335
|
+
// Identity
|
336
|
+
await agent.resolveHandle(params, opts)
|
337
|
+
await agent.updateHandle(params, opts)
|
338
|
+
|
339
|
+
// etc.
|
340
|
+
|
341
|
+
if (agent instanceof OAuthAtpAgent) {
|
342
|
+
agent.signOut()
|
343
|
+
}
|
344
|
+
```
|
345
|
+
|
283
346
|
## Advances use-cases
|
284
347
|
|
285
348
|
### Listening for session updates and deletion
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/oauth-client-node",
|
3
|
-
"version": "0.0.1",
|
3
|
+
"version": "0.0.2-rc.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ATPROTO OAuth client for the NodeJS",
|
6
6
|
"keywords": [
|
@@ -28,19 +28,19 @@
|
|
28
28
|
"dist"
|
29
29
|
],
|
30
30
|
"dependencies": {
|
31
|
-
"@atproto-labs/did-resolver": "0.1.1",
|
32
31
|
"@atproto-labs/handle-resolver-node": "0.1.1",
|
33
|
-
"@atproto
|
34
|
-
"@atproto/did": "0.1.0",
|
32
|
+
"@atproto/jwk-webcrypto": "0.1.2-rc.0",
|
35
33
|
"@atproto/jwk": "0.1.1",
|
36
|
-
"@atproto/
|
37
|
-
"@atproto/
|
38
|
-
"@atproto/
|
39
|
-
"@atproto/
|
34
|
+
"@atproto-labs/did-resolver": "0.1.1",
|
35
|
+
"@atproto/oauth-client": "0.1.2-rc.1",
|
36
|
+
"@atproto-labs/simple-store": "0.1.1",
|
37
|
+
"@atproto/jwk-jose": "0.1.2-rc.0",
|
38
|
+
"@atproto/oauth-types": "0.1.1",
|
39
|
+
"@atproto/did": "0.1.0"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"typescript": "^5.3.3",
|
43
|
-
"@atproto/api": "0.
|
43
|
+
"@atproto/api": "0.13.0-rc.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"build": "tsc --build tsconfig.build.json"
|