@atproto/oauth-client-node 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +17 -16
- package/package.json +5 -5
package/README.md
CHANGED
@@ -22,9 +22,10 @@ needs of your application, and must respect the [ATPROTO].
|
|
22
22
|
The `client_metadata` object will typically be built by the backend at startup.
|
23
23
|
|
24
24
|
```ts
|
25
|
-
import {
|
25
|
+
import { NodeOAuthClient } from '@atproto/oauth-client-node'
|
26
|
+
import { JoseKey } from '@atproto/jwk-jose'
|
26
27
|
|
27
|
-
const client = new
|
28
|
+
const client = new NodeOAuthClient({
|
28
29
|
// This object will be used to build the payload of the /client-metadata.json
|
29
30
|
// endpoint metadata, exposing the client metadata to the OAuth server.
|
30
31
|
clientMetadata: {
|
@@ -54,16 +55,16 @@ const client = new NodeOAuthClientOptions({
|
|
54
55
|
|
55
56
|
// Interface to store authorization state data (during authorization flows)
|
56
57
|
stateStore: {
|
57
|
-
set(key: string, internalState: NodeSavedState): Promise<void> {},
|
58
|
-
get(key: string): Promise<NodeSavedState | undefined> {},
|
59
|
-
del(key: string): Promise<void> {},
|
58
|
+
async set(key: string, internalState: NodeSavedState): Promise<void> {},
|
59
|
+
async get(key: string): Promise<NodeSavedState | undefined> {},
|
60
|
+
async del(key: string): Promise<void> {},
|
60
61
|
},
|
61
62
|
|
62
63
|
// Interface to store authenticated session data
|
63
64
|
sessionStore: {
|
64
|
-
set(sub: string, session: Session): Promise<void> {},
|
65
|
-
get(sub: string): Promise<Session | undefined> {},
|
66
|
-
del(sub: string): Promise<void> {},
|
65
|
+
async set(sub: string, session: Session): Promise<void> {},
|
66
|
+
async get(sub: string): Promise<Session | undefined> {},
|
67
|
+
async del(sub: string): Promise<void> {},
|
67
68
|
},
|
68
69
|
|
69
70
|
// A lock to prevent concurrent access to the session store. Optional if only one instance is running.
|
@@ -170,21 +171,21 @@ Instead of hard-coding the client metadata in your app, you can fetch it when
|
|
170
171
|
the app starts:
|
171
172
|
|
172
173
|
```ts
|
173
|
-
import {
|
174
|
+
import { NodeOAuthClient } from '@atproto/oauth-client-node'
|
174
175
|
|
175
|
-
const client = await
|
176
|
+
const client = await NodeOAuthClient.fromClientId({
|
176
177
|
clientId: 'https://my-app.com/client-metadata.json',
|
177
178
|
|
178
179
|
stateStore: {
|
179
|
-
set(key: string, internalState: NodeSavedState): Promise<void> {},
|
180
|
-
get(key: string): Promise<NodeSavedState | undefined> {},
|
181
|
-
del(key: string): Promise<void> {},
|
180
|
+
async set(key: string, internalState: NodeSavedState): Promise<void> {},
|
181
|
+
async get(key: string): Promise<NodeSavedState | undefined> {},
|
182
|
+
async del(key: string): Promise<void> {},
|
182
183
|
},
|
183
184
|
|
184
185
|
sessionStore: {
|
185
|
-
set(sub: string, session: Session): Promise<void> {},
|
186
|
-
get(sub: string): Promise<Session | undefined> {},
|
187
|
-
del(sub: string): Promise<void> {},
|
186
|
+
async set(sub: string, session: Session): Promise<void> {},
|
187
|
+
async get(sub: string): Promise<Session | undefined> {},
|
188
|
+
async del(sub: string): Promise<void> {},
|
188
189
|
},
|
189
190
|
|
190
191
|
// A lock to prevent concurrent access to the session store. Optional if only one instance is running.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/oauth-client-node",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ATPROTO OAuth client for the NodeJS",
|
6
6
|
"keywords": [
|
@@ -29,14 +29,14 @@
|
|
29
29
|
],
|
30
30
|
"dependencies": {
|
31
31
|
"@atproto-labs/did-resolver": "0.1.4",
|
32
|
-
"@atproto-labs/handle-resolver-node": "0.1.
|
32
|
+
"@atproto-labs/handle-resolver-node": "0.1.6",
|
33
|
+
"@atproto-labs/simple-store": "0.1.1",
|
33
34
|
"@atproto/did": "0.1.2",
|
34
|
-
"@atproto/jwk-jose": "0.1.2",
|
35
35
|
"@atproto/jwk": "0.1.1",
|
36
|
+
"@atproto/jwk-jose": "0.1.2",
|
36
37
|
"@atproto/jwk-webcrypto": "0.1.2",
|
37
|
-
"@atproto/oauth-types": "0.1.5",
|
38
38
|
"@atproto/oauth-client": "0.2.2",
|
39
|
-
"@atproto
|
39
|
+
"@atproto/oauth-types": "0.1.5"
|
40
40
|
},
|
41
41
|
"devDependencies": {
|
42
42
|
"typescript": "^5.3.3"
|