@atproto/oauth-provider 0.13.4 → 0.14.0
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/CHANGELOG.md +41 -0
- package/dist/lexicon/lexicon-data.d.ts +3 -2
- package/dist/lexicon/lexicon-data.d.ts.map +1 -1
- package/dist/lexicon/lexicon-data.js.map +1 -1
- package/dist/lexicon/lexicon-getter.d.ts +2 -2
- package/dist/lexicon/lexicon-getter.d.ts.map +1 -1
- package/dist/lexicon/lexicon-getter.js +4 -7
- package/dist/lexicon/lexicon-getter.js.map +1 -1
- package/dist/lexicon/lexicon-manager.d.ts +36 -21
- package/dist/lexicon/lexicon-manager.d.ts.map +1 -1
- package/dist/lexicon/lexicon-manager.js +9 -6
- package/dist/lexicon/lexicon-manager.js.map +1 -1
- package/dist/lexicon/lexicon-store.d.ts +2 -3
- package/dist/lexicon/lexicon-store.d.ts.map +1 -1
- package/dist/lexicon/lexicon-store.js.map +1 -1
- package/dist/oauth-provider.d.ts +10 -23
- package/dist/oauth-provider.d.ts.map +1 -1
- package/dist/oauth-provider.js +6 -3
- package/dist/oauth-provider.js.map +1 -1
- package/dist/request/request-manager.d.ts.map +1 -1
- package/dist/request/request-manager.js +2 -2
- package/dist/request/request-manager.js.map +1 -1
- package/dist/result/authorization-result-authorize-page.d.ts +2 -2
- package/dist/result/authorization-result-authorize-page.d.ts.map +1 -1
- package/dist/result/authorization-result-authorize-page.js.map +1 -1
- package/dist/token/token-manager.js +2 -2
- package/dist/token/token-manager.js.map +1 -1
- package/package.json +11 -11
- package/src/lexicon/lexicon-data.ts +4 -2
- package/src/lexicon/lexicon-getter.ts +4 -11
- package/src/lexicon/lexicon-manager.ts +15 -15
- package/src/lexicon/lexicon-store.ts +2 -3
- package/src/oauth-provider.ts +9 -10
- package/src/request/request-manager.ts +2 -2
- package/src/result/authorization-result-authorize-page.ts +2 -2
- package/src/token/token-manager.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @atproto/oauth-provider
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4383](https://github.com/bluesky-social/atproto/pull/4383) [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace `@atproto/lexicon` with `@atproto/lex-document`
|
|
8
|
+
|
|
9
|
+
- [#4353](https://github.com/bluesky-social/atproto/pull/4353) [`0adc852`](https://github.com/bluesky-social/atproto/commit/0adc852c31ffa154c1b93e38182c35880ecdb4ba) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use arrays to represent "account" permission's `action` attribute, allowing multiple actions to be specified for that resource.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#4382](https://github.com/bluesky-social/atproto/pull/4382) [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add `toScopes()` utility on `IncludeScope`
|
|
14
|
+
|
|
15
|
+
- [#4383](https://github.com/bluesky-social/atproto/pull/4383) [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Replace `@atproto/lexicon-resolver` with `@atproto/lex-resolver`
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`d396de0`](https://github.com/bluesky-social/atproto/commit/d396de016d1d55d08cfad1dabd3ffd9eaeea76ea), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`bcae2b7`](https://github.com/bluesky-social/atproto/commit/bcae2b77b68da6dc2ec202651c8bf41fd5769f69), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`bcae2b7`](https://github.com/bluesky-social/atproto/commit/bcae2b77b68da6dc2ec202651c8bf41fd5769f69), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`03a2a4b`](https://github.com/bluesky-social/atproto/commit/03a2a4bb3814ced7ad1d4fe6c94b5348a3bbc097), [`0adc852`](https://github.com/bluesky-social/atproto/commit/0adc852c31ffa154c1b93e38182c35880ecdb4ba), [`bcae2b7`](https://github.com/bluesky-social/atproto/commit/bcae2b77b68da6dc2ec202651c8bf41fd5769f69), [`8012627`](https://github.com/bluesky-social/atproto/commit/8012627a1226cb2f1c753385ad2497b6b43ffd2e), [`d396de0`](https://github.com/bluesky-social/atproto/commit/d396de016d1d55d08cfad1dabd3ffd9eaeea76ea), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`688f9d6`](https://github.com/bluesky-social/atproto/commit/688f9d67597ba96d6e9c4a4aec4d394d42f4cbf4), [`0adc852`](https://github.com/bluesky-social/atproto/commit/0adc852c31ffa154c1b93e38182c35880ecdb4ba), [`1d445af`](https://github.com/bluesky-social/atproto/commit/1d445af2a7fc27eca5a45869b29266e6a2a7f3ba), [`be8e6c1`](https://github.com/bluesky-social/atproto/commit/be8e6c1f25814202b98e2616a217599a6c46e0db)]:
|
|
18
|
+
- @atproto/oauth-provider-ui@0.3.6
|
|
19
|
+
- @atproto/oauth-scopes@0.3.0
|
|
20
|
+
- @atproto/lex-document@0.0.4
|
|
21
|
+
- @atproto/lex-resolver@0.0.4
|
|
22
|
+
- @atproto/did@0.2.3
|
|
23
|
+
- @atproto/syntax@0.4.2
|
|
24
|
+
- @atproto/oauth-types@0.5.2
|
|
25
|
+
- @atproto/common@0.5.2
|
|
26
|
+
- @atproto/oauth-provider-frontend@0.2.5
|
|
27
|
+
- @atproto/oauth-provider-api@0.3.4
|
|
28
|
+
|
|
29
|
+
## 0.13.5
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7), [`261968fd6`](https://github.com/bluesky-social/atproto/commit/261968fd65014ded613e2bf085d61a7864b8fba7)]:
|
|
34
|
+
- @atproto/common@0.5.0
|
|
35
|
+
- @atproto/did@0.2.2
|
|
36
|
+
- @atproto/lexicon@0.5.2
|
|
37
|
+
- @atproto/lexicon-resolver@0.2.4
|
|
38
|
+
- @atproto/oauth-scopes@0.2.2
|
|
39
|
+
- @atproto/oauth-types@0.5.1
|
|
40
|
+
- @atproto/oauth-provider-ui@0.3.5
|
|
41
|
+
- @atproto/oauth-provider-api@0.3.3
|
|
42
|
+
- @atproto/oauth-provider-frontend@0.2.4
|
|
43
|
+
|
|
3
44
|
## 0.13.4
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LexiconDocument } from '@atproto/lex-document';
|
|
2
|
+
export type { LexiconDocument };
|
|
2
3
|
export type LexiconData = {
|
|
3
4
|
createdAt: Date;
|
|
4
5
|
updatedAt: Date;
|
|
5
6
|
lastSucceededAt: null | Date;
|
|
6
7
|
uri: null | string;
|
|
7
|
-
lexicon: null |
|
|
8
|
+
lexicon: null | LexiconDocument;
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=lexicon-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-data.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lexicon-data.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,YAAY,EAAE,eAAe,EAAE,CAAA;AAE/B,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,eAAe,EAAE,IAAI,GAAG,IAAI,CAAA;IAC5B,GAAG,EAAE,IAAI,GAAG,MAAM,CAAA;IAClB,OAAO,EAAE,IAAI,GAAG,eAAe,CAAA;CAChC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-data.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-data.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"lexicon-data.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-data.ts"],"names":[],"mappings":"","sourcesContent":["import { LexiconDocument } from '@atproto/lex-document'\n\nexport type { LexiconDocument }\n\nexport type LexiconData = {\n createdAt: Date\n updatedAt: Date\n lastSucceededAt: null | Date\n uri: null | string\n lexicon: null | LexiconDocument\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LexResolver } from '@atproto/lex-resolver';
|
|
2
2
|
import { Nsid } from '@atproto/oauth-scopes';
|
|
3
3
|
import { CachedGetter } from '@atproto-labs/simple-store';
|
|
4
4
|
import { LexiconData, LexiconStore } from './lexicon-store.js';
|
|
@@ -10,6 +10,6 @@ import { LexiconData, LexiconStore } from './lexicon-store.js';
|
|
|
10
10
|
* @private
|
|
11
11
|
*/
|
|
12
12
|
export declare class LexiconGetter extends CachedGetter<Nsid, LexiconData> {
|
|
13
|
-
constructor(store: LexiconStore,
|
|
13
|
+
constructor(store: LexiconStore, lexResolver: LexResolver);
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=lexicon-getter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-getter.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-getter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lexicon-getter.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-getter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAE9D;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC;gBACpD,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW;CAwC1D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LexiconGetter = void 0;
|
|
4
|
-
const
|
|
4
|
+
const lex_resolver_1 = require("@atproto/lex-resolver");
|
|
5
5
|
const simple_store_1 = require("@atproto-labs/simple-store");
|
|
6
6
|
const constants_js_1 = require("../constants.js");
|
|
7
7
|
/**
|
|
@@ -12,18 +12,15 @@ const constants_js_1 = require("../constants.js");
|
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
14
|
class LexiconGetter extends simple_store_1.CachedGetter {
|
|
15
|
-
constructor(store,
|
|
15
|
+
constructor(store, lexResolver) {
|
|
16
16
|
super(async (input, options, storedData) => {
|
|
17
17
|
const now = new Date();
|
|
18
|
-
|
|
19
|
-
// to be fresh, which is not possible yet with the current interface
|
|
20
|
-
// of LexiconResolver.
|
|
21
|
-
const result = await resolver(input).catch((err) => {
|
|
18
|
+
const result = await lexResolver.get(input, options).catch((err) => {
|
|
22
19
|
// We swallow LexiconResolutionError errors, returning potentially
|
|
23
20
|
// "null" values here to avoid hammering the resolver with requests
|
|
24
21
|
// for the same lexicon that is known to be unavailable. The getter
|
|
25
22
|
// should be called again based on the isStale() function below.
|
|
26
|
-
if (err instanceof
|
|
23
|
+
if (err instanceof lex_resolver_1.LexResolverError)
|
|
27
24
|
return undefined;
|
|
28
25
|
// Unexpected error are propagated
|
|
29
26
|
throw err;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-getter.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-getter.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"lexicon-getter.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-getter.ts"],"names":[],"mappings":";;;AAAA,wDAAqE;AAErE,6DAAyD;AACzD,kDAA2D;AAG3D;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,2BAA+B;IAChE,YAAY,KAAmB,EAAE,WAAwB;QACvD,KAAK,CACH,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE;YACnC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;YACtB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,OAA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,CAAA;gBACjE,OAAO,mBAAmB,IAAI,wCAAyB,CAAA;YACzD,CAAC;SACF,CACF,CAAA;IACH,CAAC;CACF;AAzCD,sCAyCC","sourcesContent":["import { LexResolver, LexResolverError } from '@atproto/lex-resolver'\nimport { Nsid } from '@atproto/oauth-scopes'\nimport { CachedGetter } from '@atproto-labs/simple-store'\nimport { LEXICON_REFRESH_FREQUENCY } from '../constants.js'\nimport { LexiconData, LexiconStore } from './lexicon-store.js'\n\n/**\n * This utility class handles the retrieval and caching of lexicon\n * data. In particular, it handles failed retrieval attempts by returning cached\n * data.\n *\n * @private\n */\nexport class LexiconGetter extends CachedGetter<Nsid, LexiconData> {\n constructor(store: LexiconStore, lexResolver: LexResolver) {\n super(\n async (input, options, storedData) => {\n const now = new Date()\n const result = await lexResolver.get(input, options).catch((err) => {\n // We swallow LexiconResolutionError errors, returning potentially\n // \"null\" values here to avoid hammering the resolver with requests\n // for the same lexicon that is known to be unavailable. The getter\n // should be called again based on the isStale() function below.\n if (err instanceof LexResolverError) return undefined\n\n // Unexpected error are propagated\n throw err\n })\n\n return {\n // Keep original createdAt, if available\n createdAt: storedData?.createdAt ?? now,\n // Always update updatedAt\n updatedAt: now,\n // Update the data with fresh data, if available, or keep cached\n // values (if any) otherwise.\n lastSucceededAt: result ? now : storedData?.lastSucceededAt ?? null,\n uri: result ? result.uri.toString() : storedData?.uri ?? null,\n lexicon: result ? result.lexicon : storedData?.lexicon ?? null,\n }\n },\n {\n set: async (nsid, data) => store.storeLexicon(nsid, data),\n get: async (nsid) => (await store.findLexicon(nsid)) ?? undefined,\n del: async (nsid) => store.deleteLexicon(nsid),\n },\n {\n isStale: (nsid, data) => {\n const timeSinceLastUpdate = Date.now() - data.updatedAt.getTime()\n return timeSinceLastUpdate >= LEXICON_REFRESH_FREQUENCY\n },\n },\n )\n }\n}\n"]}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LexiconPermissionSet } from '@atproto/lex-document';
|
|
2
|
+
import { LexResolver } from '@atproto/lex-resolver';
|
|
3
3
|
import { IncludeScope, Nsid } from '@atproto/oauth-scopes';
|
|
4
4
|
import { LexiconGetter } from './lexicon-getter.js';
|
|
5
5
|
import { LexiconStore } from './lexicon-store.js';
|
|
6
6
|
export * from './lexicon-store.js';
|
|
7
7
|
export declare class LexiconManager {
|
|
8
8
|
protected readonly lexiconGetter: LexiconGetter;
|
|
9
|
-
constructor(store: LexiconStore,
|
|
9
|
+
constructor(store: LexiconStore, lexResolver: LexResolver);
|
|
10
10
|
getPermissionSetsFromScope(scope?: string): Promise<Map<string, {
|
|
11
11
|
type: "permission-set";
|
|
12
|
-
permissions:
|
|
12
|
+
permissions: {
|
|
13
|
+
[x: string]: string | number | boolean | (string | number | boolean)[];
|
|
13
14
|
type: "permission";
|
|
14
15
|
resource: string;
|
|
15
|
-
}
|
|
16
|
-
description?: string | undefined;
|
|
16
|
+
}[];
|
|
17
17
|
title?: string | undefined;
|
|
18
|
-
'title:lang'?:
|
|
18
|
+
'title:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
19
|
+
readonly format: "language";
|
|
20
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
19
21
|
detail?: string | undefined;
|
|
20
|
-
'detail:lang'?:
|
|
22
|
+
'detail:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
23
|
+
readonly format: "language";
|
|
24
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
25
|
+
description?: string | undefined;
|
|
21
26
|
}>>;
|
|
22
27
|
/**
|
|
23
28
|
* Transforms a scope string from an authorization request into a scope
|
|
@@ -31,30 +36,40 @@ export declare class LexiconManager {
|
|
|
31
36
|
*/
|
|
32
37
|
protected extractPermissionSets(includeScopes: IncludeScope[]): Promise<Map<string, {
|
|
33
38
|
type: "permission-set";
|
|
34
|
-
permissions:
|
|
39
|
+
permissions: {
|
|
40
|
+
[x: string]: string | number | boolean | (string | number | boolean)[];
|
|
35
41
|
type: "permission";
|
|
36
42
|
resource: string;
|
|
37
|
-
}
|
|
38
|
-
description?: string | undefined;
|
|
43
|
+
}[];
|
|
39
44
|
title?: string | undefined;
|
|
40
|
-
'title:lang'?:
|
|
45
|
+
'title:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
46
|
+
readonly format: "language";
|
|
47
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
41
48
|
detail?: string | undefined;
|
|
42
|
-
'detail:lang'?:
|
|
49
|
+
'detail:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
50
|
+
readonly format: "language";
|
|
51
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
52
|
+
description?: string | undefined;
|
|
43
53
|
}>>;
|
|
44
54
|
protected getPermissionSets(nsids: Set<Nsid>): Promise<Map<string, {
|
|
45
55
|
type: "permission-set";
|
|
46
|
-
permissions:
|
|
56
|
+
permissions: {
|
|
57
|
+
[x: string]: string | number | boolean | (string | number | boolean)[];
|
|
47
58
|
type: "permission";
|
|
48
59
|
resource: string;
|
|
49
|
-
}
|
|
50
|
-
description?: string | undefined;
|
|
60
|
+
}[];
|
|
51
61
|
title?: string | undefined;
|
|
52
|
-
'title:lang'?:
|
|
62
|
+
'title:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
63
|
+
readonly format: "language";
|
|
64
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
53
65
|
detail?: string | undefined;
|
|
54
|
-
'detail:lang'?:
|
|
66
|
+
'detail:lang'?: import("@atproto/lex-schema").DictSchemaOutput<import("@atproto/lex-schema").StringSchema<{
|
|
67
|
+
readonly format: "language";
|
|
68
|
+
}>, import("@atproto/lex-schema").StringSchema<{}>> | undefined;
|
|
69
|
+
description?: string | undefined;
|
|
55
70
|
}>>;
|
|
56
|
-
protected getPermissionSetEntry(nsid: Nsid): Promise<[nsid: Nsid, permissionSet:
|
|
57
|
-
protected getPermissionSet(nsid: Nsid): Promise<
|
|
71
|
+
protected getPermissionSetEntry(nsid: Nsid): Promise<[nsid: Nsid, permissionSet: LexiconPermissionSet]>;
|
|
72
|
+
protected getPermissionSet(nsid: Nsid): Promise<LexiconPermissionSet>;
|
|
58
73
|
}
|
|
59
|
-
export declare function nsidToPermissionScopes(this: Map<string,
|
|
74
|
+
export declare function nsidToPermissionScopes(this: Map<string, LexiconPermissionSet>, includeScope: IncludeScope): string[];
|
|
60
75
|
//# sourceMappingURL=lexicon-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-manager.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lexicon-manager.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,cAAc,oBAAoB,CAAA;AAElC,qBAAa,cAAc;IACzB,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAA;gBAEnC,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW;IAI5C,0BAA0B,CAAC,KAAK,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;IAKtD;;;;OAIG;IACU,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAc5D;;;OAGG;cACa,qBAAqB,CAAC,aAAa,EAAE,YAAY,EAAE;;;;;;;;;;;;;;;;;cAKnD,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;cAMlC,qBAAqB,CACnC,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;cAK7C,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAc5E;AA+BD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACvC,YAAY,EAAE,YAAY,GACzB,MAAM,EAAE,CAMV"}
|
|
@@ -16,14 +16,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.LexiconManager = void 0;
|
|
18
18
|
exports.nsidToPermissionScopes = nsidToPermissionScopes;
|
|
19
|
-
const
|
|
19
|
+
const lex_resolver_1 = require("@atproto/lex-resolver");
|
|
20
20
|
const oauth_scopes_1 = require("@atproto/oauth-scopes");
|
|
21
21
|
const lexicon_getter_js_1 = require("./lexicon-getter.js");
|
|
22
22
|
__exportStar(require("./lexicon-store.js"), exports);
|
|
23
23
|
class LexiconManager {
|
|
24
24
|
lexiconGetter;
|
|
25
|
-
constructor(store,
|
|
26
|
-
this.lexiconGetter = new lexicon_getter_js_1.LexiconGetter(store,
|
|
25
|
+
constructor(store, lexResolver) {
|
|
26
|
+
this.lexiconGetter = new lexicon_getter_js_1.LexiconGetter(store, lexResolver);
|
|
27
27
|
}
|
|
28
28
|
async getPermissionSetsFromScope(scope) {
|
|
29
29
|
const { includeScopes } = parseScope(scope);
|
|
@@ -63,11 +63,11 @@ class LexiconManager {
|
|
|
63
63
|
async getPermissionSet(nsid) {
|
|
64
64
|
const { lexicon } = await this.lexiconGetter.get(nsid);
|
|
65
65
|
if (!lexicon) {
|
|
66
|
-
throw
|
|
66
|
+
throw lex_resolver_1.LexResolverError.from(nsid);
|
|
67
67
|
}
|
|
68
68
|
if (lexicon.defs.main?.type !== 'permission-set') {
|
|
69
69
|
const description = 'Lexicon document is not a permission set';
|
|
70
|
-
throw
|
|
70
|
+
throw lex_resolver_1.LexResolverError.from(nsid, description);
|
|
71
71
|
}
|
|
72
72
|
return lexicon.defs.main;
|
|
73
73
|
}
|
|
@@ -100,6 +100,9 @@ function extractNsid(nsidScope) {
|
|
|
100
100
|
}
|
|
101
101
|
function nsidToPermissionScopes(includeScope) {
|
|
102
102
|
const permissionSet = this.get(includeScope.nsid);
|
|
103
|
-
|
|
103
|
+
if (permissionSet)
|
|
104
|
+
return includeScope.toScopes(permissionSet);
|
|
105
|
+
// Should never happen (mostly there for type safety & future proofing)
|
|
106
|
+
throw new Error(`Missing permission set for NSID: ${includeScope.nsid}`);
|
|
104
107
|
}
|
|
105
108
|
//# sourceMappingURL=lexicon-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-manager.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"lexicon-manager.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA0GA,wDASC;AAlHD,wDAAqE;AACrE,wDAA0D;AAC1D,2DAAmD;AAGnD,qDAAkC;AAElC,MAAa,cAAc;IACN,aAAa,CAAe;IAE/C,YAAY,KAAmB,EAAE,WAAwB;QACvD,IAAI,CAAC,aAAa,GAAG,IAAI,iCAAa,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;IAC5D,CAAC;IAEM,KAAK,CAAC,0BAA0B,CAAC,KAAc;QACpD,MAAM,EAAE,aAAa,EAAE,GAAG,U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A;IACjD,IAAI,aAAa;QAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;IAE9D,uEAAuE;IACvE,MAAM,IAAI,KAAK,CAAC,oCAAoC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["import { LexiconPermissionSet } from '@atproto/lex-document'\nimport { LexResolver, LexResolverError } from '@atproto/lex-resolver'\nimport { IncludeScope, Nsid } from '@atproto/oauth-scopes'\nimport { LexiconGetter } from './lexicon-getter.js'\nimport { LexiconStore } from './lexicon-store.js'\n\nexport * from './lexicon-store.js'\n\nexport class LexiconManager {\n protected readonly lexiconGetter: LexiconGetter\n\n constructor(store: LexiconStore, lexResolver: LexResolver) {\n this.lexiconGetter = new LexiconGetter(store, lexResolver)\n }\n\n public async getPermissionSetsFromScope(scope?: string) {\n const { includeScopes } = parseScope(scope)\n return this.extractPermissionSets(includeScopes)\n }\n\n /**\n * Transforms a scope string from an authorization request into a scope\n * composed solely of granular permission scopes, transforming any NSID\n * into its corresponding permission scopes.\n */\n public async buildTokenScope(scope: string): Promise<string> {\n const { includeScopes, otherScopes } = parseScope(scope)\n\n // If the scope does not contain any \"include:<nsid>\" scopes, return it as-is.\n if (!includeScopes.length) return scope\n\n const permissionSets = await this.extractPermissionSets(includeScopes)\n\n return Array.from(includeScopes)\n .flatMap(nsidToPermissionScopes, permissionSets)\n .concat(otherScopes)\n .join(' ')\n }\n\n /**\n * Given a list of scope values, extract those that are NSIDs and return their\n * corresponding permission sets.\n */\n protected async extractPermissionSets(includeScopes: IncludeScope[]) {\n const nsids = extractNsids(includeScopes)\n return this.getPermissionSets(nsids)\n }\n\n protected async getPermissionSets(nsids: Set<Nsid>) {\n return new Map<string, LexiconPermissionSet>(\n await Promise.all(Array.from(nsids, this.getPermissionSetEntry, this)),\n )\n }\n\n protected async getPermissionSetEntry(\n nsid: Nsid,\n ): Promise<[nsid: Nsid, permissionSet: LexiconPermissionSet]> {\n const permissionSet = await this.getPermissionSet(nsid)\n return [nsid, permissionSet]\n }\n\n protected async getPermissionSet(nsid: Nsid): Promise<LexiconPermissionSet> {\n const { lexicon } = await this.lexiconGetter.get(nsid)\n\n if (!lexicon) {\n throw LexResolverError.from(nsid)\n }\n\n if (lexicon.defs.main?.type !== 'permission-set') {\n const description = 'Lexicon document is not a permission set'\n throw LexResolverError.from(nsid, description)\n }\n\n return lexicon.defs.main\n }\n}\n\nfunction parseScope(scope?: string) {\n const includeScopes: IncludeScope[] = []\n const otherScopes: string[] = []\n\n if (scope) {\n for (const scopeValue of scope.split(' ')) {\n const parsed = IncludeScope.fromString(scopeValue)\n if (parsed) {\n includeScopes.push(parsed)\n } else {\n otherScopes.push(scopeValue)\n }\n }\n }\n\n return {\n includeScopes,\n otherScopes,\n }\n}\n\nfunction extractNsids(includeScopes: IncludeScope[]): Set<Nsid> {\n return new Set(Array.from(includeScopes, extractNsid))\n}\n\nfunction extractNsid(nsidScope: IncludeScope): Nsid {\n return nsidScope.nsid\n}\n\nexport function nsidToPermissionScopes(\n this: Map<string, LexiconPermissionSet>,\n includeScope: IncludeScope,\n): string[] {\n const permissionSet = this.get(includeScope.nsid)\n if (permissionSet) return includeScope.toScopes(permissionSet)\n\n // Should never happen (mostly there for type safety & future proofing)\n throw new Error(`Missing permission set for NSID: ${includeScope.nsid}`)\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { LexiconDoc } from '@atproto/lexicon';
|
|
2
1
|
import { Awaitable } from '../lib/util/type.js';
|
|
3
|
-
import { LexiconData } from './lexicon-data.js';
|
|
4
|
-
export type { Awaitable, LexiconData,
|
|
2
|
+
import { LexiconData, LexiconDocument } from './lexicon-data.js';
|
|
3
|
+
export type { Awaitable, LexiconData, LexiconDocument };
|
|
5
4
|
export interface LexiconStore {
|
|
6
5
|
findLexicon(nsid: string): Awaitable<LexiconData | null>;
|
|
7
6
|
storeLexicon(nsid: string, data: LexiconData): Awaitable<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-store.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"lexicon-store.d.ts","sourceRoot":"","sources":["../../src/lexicon/lexicon-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEhE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA;AAEvD,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACxD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAC9D,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;CAC7C;AAED,eAAO,MAAM,cAAc,yHAIzB,CAAA;AAEF,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,YAAY,CAAC,EAC5D,cAAc,CAAC,EAAE,CAAC,GACjB,CAAC,CAAC,GAAG,YAAY,CAAC,GAAG,SAAS,CAMhC;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,CAAC,YAAY,CAAC,EAC5D,cAAc,CAAC,EAAE,CAAC,GACjB,CAAC,GAAG,YAAY,CAKlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexicon-store.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-store.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"lexicon-store.js","sourceRoot":"","sources":["../../src/lexicon/lexicon-store.ts"],"names":[],"mappings":";;;AAiBA,wCAQC;AAED,wCAOC;AAlCD,iDAAsE;AAWzD,QAAA,cAAc,GAAG,IAAA,+BAAqB,EAAe;IAChE,aAAa;IACb,cAAc;IACd,eAAe;CAChB,CAAC,CAAA;AAEF,SAAgB,cAAc,CAC5B,cAAkB;IAElB,IAAI,cAAc,IAAI,IAAA,sBAAc,EAAC,cAAc,CAAC,EAAE,CAAC;QACrD,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAgB,cAAc,CAC5B,cAAkB;IAElB,MAAM,KAAK,GAAG,cAAc,CAAC,cAAc,CAAC,CAAA;IAC5C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAA;IAEvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;AACxD,CAAC","sourcesContent":["import { Awaitable, buildInterfaceChecker } from '../lib/util/type.js'\nimport { LexiconData, LexiconDocument } from './lexicon-data.js'\n\nexport type { Awaitable, LexiconData, LexiconDocument }\n\nexport interface LexiconStore {\n findLexicon(nsid: string): Awaitable<LexiconData | null>\n storeLexicon(nsid: string, data: LexiconData): Awaitable<void>\n deleteLexicon(nsid: string): Awaitable<void>\n}\n\nexport const isLexiconStore = buildInterfaceChecker<LexiconStore>([\n 'findLexicon',\n 'storeLexicon',\n 'deleteLexicon',\n])\n\nexport function ifLexiconStore<V extends Partial<LexiconStore>>(\n implementation?: V,\n): (V & LexiconStore) | undefined {\n if (implementation && isLexiconStore(implementation)) {\n return implementation\n }\n\n return undefined\n}\n\nexport function asLexiconStore<V extends Partial<LexiconStore>>(\n implementation?: V,\n): V & LexiconStore {\n const store = ifLexiconStore(implementation)\n if (store) return store\n\n throw new Error('Invalid LexiconStore implementation')\n}\n"]}
|
package/dist/oauth-provider.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Redis, RedisOptions } from 'ioredis';
|
|
2
2
|
import { Jwks, Keyset } from '@atproto/jwk';
|
|
3
|
-
import {
|
|
3
|
+
import { LexResolver } from '@atproto/lex-resolver';
|
|
4
4
|
import type { Account } from '@atproto/oauth-provider-api';
|
|
5
5
|
import { OAuthAccessToken, OAuthAuthorizationCodeGrantTokenRequest, OAuthAuthorizationRequestJar, OAuthAuthorizationRequestPar, OAuthAuthorizationRequestParameters, OAuthAuthorizationRequestQuery, OAuthAuthorizationServerMetadata, OAuthClientCredentials, OAuthClientCredentialsNone, OAuthClientMetadata, OAuthParResponse, OAuthRefreshTokenGrantTokenRequest, OAuthTokenIdentification, OAuthTokenRequest, OAuthTokenResponse, OAuthTokenType } from '@atproto/oauth-types';
|
|
6
6
|
import { SimpleStore } from '@atproto-labs/simple-store';
|
|
@@ -36,8 +36,8 @@ import { AccessTokenPayload } from './signer/access-token-payload.js';
|
|
|
36
36
|
import { TokenData } from './token/token-data.js';
|
|
37
37
|
import { TokenManager } from './token/token-manager.js';
|
|
38
38
|
import { TokenStore } from './token/token-store.js';
|
|
39
|
-
export { AccessTokenMode, Keyset };
|
|
40
|
-
export type { AccessTokenPayload, AuthorizationRedirectParameters, AuthorizationResultAuthorizePage as AuthorizationResultAuthorize, AuthorizationResultRedirect, Branding, BrandingInput, CustomMetadata, Customization, CustomizationInput, ErrorHandler, HcaptchaConfig,
|
|
39
|
+
export { AccessTokenMode, Keyset, LexResolver };
|
|
40
|
+
export type { AccessTokenPayload, AuthorizationRedirectParameters, AuthorizationResultAuthorizePage as AuthorizationResultAuthorize, AuthorizationResultRedirect, Branding, BrandingInput, CustomMetadata, Customization, CustomizationInput, ErrorHandler, HcaptchaConfig, MultiLangString, OAuthAuthorizationServerMetadata, VerifyTokenPayloadOptions, };
|
|
41
41
|
type OAuthProviderConfig = {
|
|
42
42
|
/**
|
|
43
43
|
* Maximum age a device/account session can be before requiring
|
|
@@ -67,6 +67,10 @@ type OAuthProviderConfig = {
|
|
|
67
67
|
* Additional metadata to be included in the discovery document.
|
|
68
68
|
*/
|
|
69
69
|
metadata?: CustomMetadata;
|
|
70
|
+
/**
|
|
71
|
+
* A Lexicon resolver instance to use for fetching lexicon schemas.
|
|
72
|
+
*/
|
|
73
|
+
lexResolver?: LexResolver;
|
|
70
74
|
/**
|
|
71
75
|
* A custom fetch function that can be used to fetch the client metadata from
|
|
72
76
|
* the internet. By default, the fetch function is a safeFetchWrap() function
|
|
@@ -75,10 +79,6 @@ type OAuthProviderConfig = {
|
|
|
75
79
|
* fetch function.
|
|
76
80
|
*/
|
|
77
81
|
safeFetch?: typeof globalThis.fetch;
|
|
78
|
-
/**
|
|
79
|
-
* A custom ATProto lexicon resolver
|
|
80
|
-
*/
|
|
81
|
-
lexiconResolver?: LexiconResolver;
|
|
82
82
|
/**
|
|
83
83
|
* A redis instance to use for replay protection. If not provided, replay
|
|
84
84
|
* protection will use memory storage.
|
|
@@ -136,8 +136,8 @@ export declare class OAuthProvider extends OAuthVerifier {
|
|
|
136
136
|
readonly lexiconManager: LexiconManager;
|
|
137
137
|
readonly requestManager: RequestManager;
|
|
138
138
|
readonly tokenManager: TokenManager;
|
|
139
|
-
constructor({ authenticationMaxAge, tokenMaxAge, accessTokenMode, metadata,
|
|
140
|
-
accountStore, deviceStore, lexiconStore, tokenStore, requestStore, clientStore, replayStore, clientJwksCache, clientMetadataCache, loopbackMetadata, ...rest }: OAuthProviderOptions);
|
|
139
|
+
constructor({ authenticationMaxAge, tokenMaxAge, accessTokenMode, metadata, safeFetch, store, // compound store implementation
|
|
140
|
+
lexResolver, accountStore, deviceStore, lexiconStore, tokenStore, requestStore, clientStore, replayStore, clientJwksCache, clientMetadataCache, loopbackMetadata, ...rest }: OAuthProviderOptions);
|
|
141
141
|
get jwks(): Readonly<{
|
|
142
142
|
keys: readonly (Readonly<{
|
|
143
143
|
kty: "RSA";
|
|
@@ -239,20 +239,7 @@ export declare class OAuthProvider extends OAuthVerifier {
|
|
|
239
239
|
"x5t#S256"?: string | undefined;
|
|
240
240
|
x5u?: string | undefined;
|
|
241
241
|
ext?: boolean | undefined;
|
|
242
|
-
iat
|
|
243
|
-
* If set to {@link AccessTokenMode.stateless}, the generated access tokens
|
|
244
|
-
* will contain all the necessary information to validate the token without
|
|
245
|
-
* needing to query the database. This is useful for cases where the Resource
|
|
246
|
-
* Server is on a different host/server than the Authorization Server.
|
|
247
|
-
*
|
|
248
|
-
* When set to {@link AccessTokenMode.light}, the access tokens will contain
|
|
249
|
-
* only the necessary information to validate the token, but the token id
|
|
250
|
-
* will need to be queried from the database to retrieve the full token
|
|
251
|
-
* information (scope, audience, etc.)
|
|
252
|
-
*
|
|
253
|
-
* @see {@link AccessTokenMode}
|
|
254
|
-
* @default {AccessTokenMode.stateless}
|
|
255
|
-
*/: number | undefined;
|
|
242
|
+
iat?: number | undefined;
|
|
256
243
|
exp?: number | undefined;
|
|
257
244
|
nbf?: number | undefined;
|
|
258
245
|
revoked?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../src/oauth-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../src/oauth-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAEL,gBAAgB,EAChB,uCAAuC,EACvC,4BAA4B,EAC5B,4BAA4B,EAC5B,mCAAmC,EACnC,8BAA8B,EAC9B,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,kCAAkC,EAClC,wBAA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C,SAAS,EAAE,IAAI,GAAG,SAAS;cAuBJ,WAAW,CAClC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,gBAAgB,EACvB,SAAS,EAAE,IAAI,GAAG,SAAS,GAC1B,OAAO,CAAC,kBAAkB,CAAC;CAmB/B"}
|
package/dist/oauth-provider.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OAuthProvider = exports.Keyset = exports.AccessTokenMode = void 0;
|
|
3
|
+
exports.OAuthProvider = exports.LexResolver = exports.Keyset = exports.AccessTokenMode = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
5
|
const jwk_1 = require("@atproto/jwk");
|
|
6
6
|
Object.defineProperty(exports, "Keyset", { enumerable: true, get: function () { return jwk_1.Keyset; } });
|
|
7
|
+
const lex_resolver_1 = require("@atproto/lex-resolver");
|
|
8
|
+
Object.defineProperty(exports, "LexResolver", { enumerable: true, get: function () { return lex_resolver_1.LexResolver; } });
|
|
7
9
|
const oauth_types_1 = require("@atproto/oauth-types");
|
|
8
10
|
const fetch_node_1 = require("@atproto-labs/fetch-node");
|
|
9
11
|
const simple_store_memory_1 = require("@atproto-labs/simple-store-memory");
|
|
@@ -53,7 +55,8 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
|
53
55
|
tokenManager;
|
|
54
56
|
constructor({
|
|
55
57
|
// OAuthProviderConfig
|
|
56
|
-
authenticationMaxAge = constants_js_1.AUTHENTICATION_MAX_AGE, tokenMaxAge = constants_js_1.TOKEN_MAX_AGE, accessTokenMode = access_token_mode_js_1.AccessTokenMode.stateless, metadata,
|
|
58
|
+
authenticationMaxAge = constants_js_1.AUTHENTICATION_MAX_AGE, tokenMaxAge = constants_js_1.TOKEN_MAX_AGE, accessTokenMode = access_token_mode_js_1.AccessTokenMode.stateless, metadata, safeFetch = (0, fetch_node_1.safeFetchWrap)(), store, // compound store implementation
|
|
59
|
+
lexResolver = new lex_resolver_1.LexResolver({ fetch: safeFetch }),
|
|
57
60
|
// Required stores
|
|
58
61
|
accountStore = (0, account_store_js_1.asAccountStore)(store), deviceStore = (0, device_store_js_1.asDeviceStore)(store), lexiconStore = (0, lexicon_store_js_1.asLexiconStore)(store), tokenStore = (0, token_store_js_1.asTokenStore)(store), requestStore = (0, request_store_js_1.asRequestStore)(store),
|
|
59
62
|
// Optional stores
|
|
@@ -84,7 +87,7 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
|
84
87
|
this.deviceManager = new device_manager_js_1.DeviceManager(deviceStore, deviceManagerOptions);
|
|
85
88
|
this.accountManager = new account_manager_js_1.AccountManager(this.issuer, accountStore, this.hooks, this.customization);
|
|
86
89
|
this.clientManager = new client_manager_js_1.ClientManager(this.metadata, this.keyset, this.hooks, clientStore || null, loopbackMetadata || null, safeFetch, clientJwksCache, clientMetadataCache);
|
|
87
|
-
this.lexiconManager = new lexicon_manager_js_1.LexiconManager(lexiconStore,
|
|
90
|
+
this.lexiconManager = new lexicon_manager_js_1.LexiconManager(lexiconStore, lexResolver);
|
|
88
91
|
this.requestManager = new request_manager_js_1.RequestManager(requestStore, this.lexiconManager, this.signer, this.metadata, this.hooks);
|
|
89
92
|
this.tokenManager = new token_manager_js_1.TokenManager(tokenStore, this.lexiconManager, this.signer, this.hooks, this.accessTokenMode, tokenMaxAge);
|
|
90
93
|
}
|