@atproto/oauth-provider 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +21 -0
- package/dist/account/account-store.js +3 -3
- package/dist/account/account-store.js.map +1 -1
- package/dist/assets/app/bundle-manifest.json +2 -2
- package/dist/assets/app/main.js +3 -3
- package/dist/assets/app/main.js.map +1 -1
- package/dist/assets/asset.d.ts +0 -1
- package/dist/assets/asset.d.ts.map +1 -1
- package/dist/assets/assets-middleware.js +2 -3
- package/dist/assets/assets-middleware.js.map +1 -1
- package/dist/assets/index.js +2 -2
- package/dist/assets/index.js.map +1 -1
- package/dist/client/client-auth.js +2 -3
- package/dist/client/client-auth.js.map +1 -1
- package/dist/client/client-manager.d.ts +1 -1
- package/dist/client/client-manager.d.ts.map +1 -1
- package/dist/client/client-manager.js +3 -4
- package/dist/client/client-manager.js.map +1 -1
- package/dist/client/client-store.js +3 -4
- package/dist/client/client-store.js.map +1 -1
- package/dist/client/client-utils.d.ts +0 -1
- package/dist/client/client-utils.d.ts.map +1 -1
- package/dist/client/client-utils.js +2 -3
- package/dist/client/client-utils.js.map +1 -1
- package/dist/device/device-details.d.ts +0 -1
- package/dist/device/device-details.d.ts.map +1 -1
- package/dist/device/device-details.js +3 -3
- package/dist/device/device-details.js.map +1 -1
- package/dist/device/device-id.d.ts.map +1 -1
- package/dist/device/device-manager.d.ts +1 -2
- package/dist/device/device-manager.d.ts.map +1 -1
- package/dist/device/device-store.js +2 -3
- package/dist/device/device-store.js.map +1 -1
- package/dist/device/session-id.d.ts.map +1 -1
- package/dist/dpop/dpop-manager.d.ts +0 -1
- package/dist/dpop/dpop-manager.d.ts.map +1 -1
- package/dist/lib/html/build-document.d.ts +0 -1
- package/dist/lib/html/build-document.d.ts.map +1 -1
- package/dist/lib/html/escapers.js +4 -5
- package/dist/lib/html/escapers.js.map +1 -1
- package/dist/lib/html/util.js +2 -3
- package/dist/lib/html/util.js.map +1 -1
- package/dist/lib/http/accept.d.ts +1 -1
- package/dist/lib/http/accept.d.ts.map +1 -1
- package/dist/lib/http/accept.js +2 -2
- package/dist/lib/http/accept.js.map +1 -1
- package/dist/lib/http/context.js +1 -2
- package/dist/lib/http/context.js.map +1 -1
- package/dist/lib/http/method.d.ts +0 -1
- package/dist/lib/http/method.d.ts.map +1 -1
- package/dist/lib/http/method.js +1 -2
- package/dist/lib/http/method.js.map +1 -1
- package/dist/lib/http/middleware.d.ts +0 -1
- package/dist/lib/http/middleware.d.ts.map +1 -1
- package/dist/lib/http/middleware.js +5 -6
- package/dist/lib/http/middleware.js.map +1 -1
- package/dist/lib/http/parser.d.ts +2 -5
- package/dist/lib/http/parser.d.ts.map +1 -1
- package/dist/lib/http/parser.js +2 -2
- package/dist/lib/http/parser.js.map +1 -1
- package/dist/lib/http/path.js +1 -2
- package/dist/lib/http/path.js.map +1 -1
- package/dist/lib/http/request.d.ts +0 -1
- package/dist/lib/http/request.d.ts.map +1 -1
- package/dist/lib/http/request.js +9 -10
- package/dist/lib/http/request.js.map +1 -1
- package/dist/lib/http/response.d.ts +9 -8
- package/dist/lib/http/response.d.ts.map +1 -1
- package/dist/lib/http/response.js +24 -66
- package/dist/lib/http/response.js.map +1 -1
- package/dist/lib/http/route.d.ts +0 -1
- package/dist/lib/http/route.d.ts.map +1 -1
- package/dist/lib/http/route.js +1 -2
- package/dist/lib/http/route.js.map +1 -1
- package/dist/lib/http/router.d.ts +2 -4
- package/dist/lib/http/router.d.ts.map +1 -1
- package/dist/lib/http/stream.d.ts +2 -7
- package/dist/lib/http/stream.d.ts.map +1 -1
- package/dist/lib/http/stream.js +5 -5
- package/dist/lib/http/stream.js.map +1 -1
- package/dist/lib/http/types.d.ts +0 -1
- package/dist/lib/http/types.d.ts.map +1 -1
- package/dist/lib/http/url.d.ts +0 -1
- package/dist/lib/http/url.d.ts.map +1 -1
- package/dist/lib/http/url.js +1 -2
- package/dist/lib/http/url.js.map +1 -1
- package/dist/lib/redis.d.ts.map +1 -1
- package/dist/lib/redis.js +7 -6
- package/dist/lib/redis.js.map +1 -1
- package/dist/lib/util/cast.js +1 -2
- package/dist/lib/util/cast.js.map +1 -1
- package/dist/lib/util/crypto.js +2 -2
- package/dist/lib/util/crypto.js.map +1 -1
- package/dist/lib/util/date.js +2 -3
- package/dist/lib/util/date.js.map +1 -1
- package/dist/lib/util/hostname.d.ts +0 -1
- package/dist/lib/util/hostname.d.ts.map +1 -1
- package/dist/lib/util/hostname.js +4 -5
- package/dist/lib/util/hostname.js.map +1 -1
- package/dist/lib/util/redirect-uri.js +1 -2
- package/dist/lib/util/redirect-uri.js.map +1 -1
- package/dist/lib/util/time.js +1 -2
- package/dist/lib/util/time.js.map +1 -1
- package/dist/lib/util/well-known.d.ts +0 -1
- package/dist/lib/util/well-known.d.ts.map +1 -1
- package/dist/lib/util/well-known.js +1 -2
- package/dist/lib/util/well-known.js.map +1 -1
- package/dist/metadata/build-metadata.d.ts.map +1 -1
- package/dist/metadata/build-metadata.js +4 -4
- package/dist/metadata/build-metadata.js.map +1 -1
- package/dist/oauth-provider.d.ts +1 -2
- package/dist/oauth-provider.d.ts.map +1 -1
- package/dist/oauth-provider.js +19 -9
- package/dist/oauth-provider.js.map +1 -1
- package/dist/oauth-verifier.d.ts +1 -2
- package/dist/oauth-verifier.d.ts.map +1 -1
- package/dist/output/build-authorize-data.js +1 -2
- package/dist/output/build-authorize-data.js.map +1 -1
- package/dist/output/build-error-payload.js +2 -3
- package/dist/output/build-error-payload.js.map +1 -1
- package/dist/output/customization.d.ts +1 -1
- package/dist/output/customization.d.ts.map +1 -1
- package/dist/output/customization.js +3 -4
- package/dist/output/customization.js.map +1 -1
- package/dist/output/output-manager.d.ts +0 -1
- package/dist/output/output-manager.d.ts.map +1 -1
- package/dist/output/send-authorize-redirect.d.ts +0 -1
- package/dist/output/send-authorize-redirect.d.ts.map +1 -1
- package/dist/output/send-authorize-redirect.js +1 -2
- package/dist/output/send-authorize-redirect.js.map +1 -1
- package/dist/output/send-web-page.d.ts +3 -4
- package/dist/output/send-web-page.d.ts.map +1 -1
- package/dist/output/send-web-page.js +4 -5
- package/dist/output/send-web-page.js.map +1 -1
- package/dist/replay/replay-store-redis.d.ts +1 -1
- package/dist/replay/replay-store-redis.d.ts.map +1 -1
- package/dist/replay/replay-store.js +3 -4
- package/dist/replay/replay-store.js.map +1 -1
- package/dist/request/code.d.ts +1 -1
- package/dist/request/code.d.ts.map +1 -1
- package/dist/request/request-data.d.ts.map +1 -1
- package/dist/request/request-id.d.ts.map +1 -1
- package/dist/request/request-manager.d.ts.map +1 -1
- package/dist/request/request-manager.js +2 -1
- package/dist/request/request-manager.js.map +1 -1
- package/dist/request/request-store-redis.d.ts +1 -1
- package/dist/request/request-store-redis.d.ts.map +1 -1
- package/dist/request/request-store-redis.js.map +1 -1
- package/dist/request/request-store.js +2 -3
- package/dist/request/request-store.js.map +1 -1
- package/dist/request/request-uri.js +3 -3
- package/dist/request/request-uri.js.map +1 -1
- package/dist/signer/signed-token-payload.d.ts +90 -90
- package/dist/signer/signed-token-payload.d.ts.map +1 -1
- package/dist/signer/signer.d.ts +6 -6
- package/dist/signer/signer.d.ts.map +1 -1
- package/dist/token/refresh-token.d.ts +1 -1
- package/dist/token/refresh-token.d.ts.map +1 -1
- package/dist/token/token-claims.d.ts +90 -90
- package/dist/token/token-claims.d.ts.map +1 -1
- package/dist/token/token-id.d.ts +1 -1
- package/dist/token/token-id.d.ts.map +1 -1
- package/dist/token/token-store.js +2 -3
- package/dist/token/token-store.js.map +1 -1
- package/dist/token/verify-token-claims.js +1 -2
- package/dist/token/verify-token-claims.js.map +1 -1
- package/package.json +3 -7
- package/src/assets/assets-middleware.ts +1 -1
- package/src/client/client-manager.ts +3 -3
- package/src/lib/http/accept.ts +1 -0
- package/src/lib/http/middleware.ts +1 -1
- package/src/lib/http/response.ts +37 -78
- package/src/lib/http/stream.ts +4 -2
- package/src/lib/redis.ts +5 -3
- package/src/metadata/build-metadata.ts +6 -3
- package/src/oauth-provider.ts +19 -11
- package/src/oauth-verifier.ts +1 -1
- package/src/output/send-web-page.ts +5 -3
- package/src/replay/replay-store-redis.ts +1 -1
- package/src/request/request-manager.ts +4 -1
- package/src/request/request-store-redis.ts +2 -1
- package/tsconfig.backend.tsbuildinfo +1 -0
- package/tsconfig.frontend.tsbuildinfo +1 -0
- package/tsconfig.tools.tsbuildinfo +1 -0
package/dist/lib/http/stream.js
CHANGED
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
6
|
+
exports.decodeHttpRequest = decodeHttpRequest;
|
7
|
+
exports.parseHttpRequest = parseHttpRequest;
|
7
8
|
const common_1 = require("@atproto/common");
|
8
9
|
const http_errors_1 = __importDefault(require("http-errors"));
|
9
10
|
const parser_js_1 = require("./parser.js");
|
@@ -11,11 +12,11 @@ function decodeHttpRequest(req) {
|
|
11
12
|
try {
|
12
13
|
return (0, common_1.decodeStream)(req, req.headers['content-encoding']);
|
13
14
|
}
|
14
|
-
catch (
|
15
|
-
|
15
|
+
catch (cause) {
|
16
|
+
const message = cause instanceof TypeError ? cause.message : `Invalid content-encoding`;
|
17
|
+
throw (0, http_errors_1.default)(415, message, { cause });
|
16
18
|
}
|
17
19
|
}
|
18
|
-
exports.decodeHttpRequest = decodeHttpRequest;
|
19
20
|
/**
|
20
21
|
* Generic method that parses a stream of unknown nature (HTTP request/response,
|
21
22
|
* socket, file, etc.), but of known mime type, into a parsed object.
|
@@ -32,5 +33,4 @@ async function parseHttpRequest(req, allow) {
|
|
32
33
|
const buffer = await (0, common_1.streamToNodeBuffer)(stream);
|
33
34
|
return parser.parse(buffer, type);
|
34
35
|
}
|
35
|
-
exports.parseHttpRequest = parseHttpRequest;
|
36
36
|
//# sourceMappingURL=stream.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../src/lib/http/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CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAE/B,CAAA;AACH,CAAC"}
|
package/dist/lib/http/types.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/http/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/http/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA;AAE1C,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;AAElD,MAAM,MAAM,UAAU,CACpB,CAAC,GAAG,IAAI,EACR,GAAG,GAAG,eAAe,EACrB,GAAG,GAAG,cAAc,IAClB,CACF,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,YAAY,KACf,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;AAE7B,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,eAAe,EAAE,GAAG,GAAG,cAAc,IAAI,CAC3E,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,CAAC,EAAE,YAAY,KAChB,IAAI,CAAA"}
|
package/dist/lib/http/url.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnD,CAAA;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,WAgBzD"}
|
package/dist/lib/http/url.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.urlMatch =
|
3
|
+
exports.urlMatch = urlMatch;
|
4
4
|
function urlMatch(url, reference) {
|
5
5
|
if (reference.origin !== undefined) {
|
6
6
|
if (url.origin !== reference.origin)
|
@@ -18,5 +18,4 @@ function urlMatch(url, reference) {
|
|
18
18
|
}
|
19
19
|
return true;
|
20
20
|
}
|
21
|
-
exports.urlMatch = urlMatch;
|
22
21
|
//# sourceMappingURL=url.js.map
|
package/dist/lib/http/url.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/lib/http/url.ts"],"names":[],"mappings":";;AAMA,4BAgBC;AAhBD,SAAgB,QAAQ,CAAC,GAAQ,EAAE,SAAuB;IACxD,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM;YAAE,OAAO,KAAK,CAAA;IACnD,CAAC;IAED,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;IACvD,CAAC;IAED,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;YAClD,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK;gBAAE,OAAO,KAAK,CAAA;QACvD,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/lib/redis.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAEnC,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,CAAA;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,KAAK,
|
1
|
+
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAEnC,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,CAAA;AAE9D,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,KAAK,CAkB9D"}
|
package/dist/lib/redis.js
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.createRedis =
|
3
|
+
exports.createRedis = createRedis;
|
4
4
|
const ioredis_1 = require("ioredis");
|
5
5
|
function createRedis(options) {
|
6
|
-
if (options
|
7
|
-
return options;
|
8
|
-
}
|
9
|
-
else if (typeof options === 'string') {
|
6
|
+
if (typeof options === 'string') {
|
10
7
|
const url = new URL(options.startsWith('redis://') ? options : `redis://${options}`);
|
11
8
|
return new ioredis_1.Redis({
|
12
9
|
host: url.hostname,
|
@@ -14,9 +11,13 @@ function createRedis(options) {
|
|
14
11
|
password: url.password,
|
15
12
|
});
|
16
13
|
}
|
14
|
+
else if ('on' in options && 'call' in options && 'acl' in options) {
|
15
|
+
// Not using "instanceof" here in case the options is an instance of another
|
16
|
+
// version of ioredis (Redis is both a class and an interface).
|
17
|
+
return options;
|
18
|
+
}
|
17
19
|
else {
|
18
20
|
return new ioredis_1.Redis(options);
|
19
21
|
}
|
20
22
|
}
|
21
|
-
exports.createRedis = createRedis;
|
22
23
|
//# sourceMappingURL=redis.js.map
|
package/dist/lib/redis.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"redis.js","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"redis.js","sourceRoot":"","sources":["../../src/lib/redis.ts"],"names":[],"mappings":";;AAMA,kCAkBC;AAxBD,qCAAkD;AAMlD,SAAgB,WAAW,CAAC,OAA2B;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAChE,CAAA;QAED,OAAO,IAAI,eAAK,CAAC;YACf,IAAI,EAAE,GAAG,CAAC,QAAQ;YAClB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5B,QAAQ,EAAE,GAAG,CAAC,QAAQ;SACvB,CAAC,CAAA;IACJ,CAAC;SAAM,IAAI,IAAI,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;QACpE,4EAA4E;QAC5E,+DAA+D;QAC/D,OAAO,OAAO,CAAA;IAChB,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,eAAK,CAAC,OAAO,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC"}
|
package/dist/lib/util/cast.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.asArray =
|
3
|
+
exports.asArray = asArray;
|
4
4
|
function asArray(value) {
|
5
5
|
if (value == null)
|
6
6
|
return [];
|
7
7
|
return Array.isArray(value) ? value : [value];
|
8
8
|
}
|
9
|
-
exports.asArray = asArray;
|
10
9
|
//# sourceMappingURL=cast.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cast.js","sourceRoot":"","sources":["../../../src/lib/util/cast.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"cast.js","sourceRoot":"","sources":["../../../src/lib/util/cast.ts"],"names":[],"mappings":";;AAAA,0BAGC;AAHD,SAAgB,OAAO,CAAI,KAAc;IACvC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,EAAE,CAAA;IAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC"}
|
package/dist/lib/util/crypto.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.VERIFY_ALGOS =
|
3
|
+
exports.VERIFY_ALGOS = void 0;
|
4
|
+
exports.randomHexId = randomHexId;
|
4
5
|
const node_crypto_1 = require("node:crypto");
|
5
6
|
async function randomHexId(bytesLength = 16) {
|
6
7
|
return new Promise((resolve, reject) => {
|
@@ -11,7 +12,6 @@ async function randomHexId(bytesLength = 16) {
|
|
11
12
|
});
|
12
13
|
});
|
13
14
|
}
|
14
|
-
exports.randomHexId = randomHexId;
|
15
15
|
// Basically all algorithms supported by "jose"'s jwtVerify().
|
16
16
|
// @TODO: Is there a way to get this list from the runtime instead of hardcoding it?
|
17
17
|
exports.VERIFY_ALGOS = [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/lib/util/crypto.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/lib/util/crypto.ts"],"names":[],"mappings":";;;AAEA,kCAOC;AATD,6CAAyC;AAElC,KAAK,UAAU,WAAW,CAAC,WAAW,GAAG,EAAE;IAChD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,IAAA,yBAAW,EAAC,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACpC,IAAI,GAAG;gBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;YAC3B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,8DAA8D;AAC9D,oFAAoF;AACvE,QAAA,YAAY,GAAG;IAC1B,OAAO;IACP,OAAO;IACP,OAAO;IAEP,OAAO;IACP,OAAO;IACP,OAAO;IAEP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;CACC,CAAA"}
|
package/dist/lib/util/date.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.dateToEpoch = dateToEpoch;
|
4
|
+
exports.dateToRelativeSeconds = dateToRelativeSeconds;
|
4
5
|
function dateToEpoch(date = new Date()) {
|
5
6
|
return Math.floor(date.getTime() / 1000);
|
6
7
|
}
|
7
|
-
exports.dateToEpoch = dateToEpoch;
|
8
8
|
function dateToRelativeSeconds(date) {
|
9
9
|
return Math.floor((date.getTime() - Date.now()) / 1000);
|
10
10
|
}
|
11
|
-
exports.dateToRelativeSeconds = dateToRelativeSeconds;
|
12
11
|
//# sourceMappingURL=date.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/lib/util/date.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/lib/util/date.ts"],"names":[],"mappings":";;AAAA,kCAEC;AAED,sDAEC;AAND,SAAgB,WAAW,CAAC,OAAa,IAAI,IAAI,EAAE;IACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAA;AAC1C,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAU;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;AACzD,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hostname.d.ts","sourceRoot":"","sources":["../../../src/lib/util/hostname.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"hostname.d.ts","sourceRoot":"","sources":["../../../src/lib/util/hostname.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAE,MAAM,KAAK,CAAA;AAEzC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,YAAY,GAAG,IAAI,CAG7E;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAO3E"}
|
@@ -1,20 +1,20 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.isInternetUrl = isInternetUrl;
|
4
|
+
exports.isInternetHost = isInternetHost;
|
5
|
+
exports.parseUrlPublicSuffix = parseUrlPublicSuffix;
|
6
|
+
exports.parseDomainPublicSuffix = parseDomainPublicSuffix;
|
4
7
|
const psl_1 = require("psl");
|
5
8
|
function isInternetUrl(url) {
|
6
9
|
return parseUrlPublicSuffix(url) !== null;
|
7
10
|
}
|
8
|
-
exports.isInternetUrl = isInternetUrl;
|
9
11
|
function isInternetHost(host) {
|
10
12
|
return parseDomainPublicSuffix(host) !== null;
|
11
13
|
}
|
12
|
-
exports.isInternetHost = isInternetHost;
|
13
14
|
function parseUrlPublicSuffix(input) {
|
14
15
|
const { hostname } = new URL(input);
|
15
16
|
return parseDomainPublicSuffix(hostname);
|
16
17
|
}
|
17
|
-
exports.parseUrlPublicSuffix = parseUrlPublicSuffix;
|
18
18
|
function parseDomainPublicSuffix(domain) {
|
19
19
|
const parsed = (0, psl_1.parse)(domain);
|
20
20
|
if ('listed' in parsed && parsed.listed && parsed.domain) {
|
@@ -24,5 +24,4 @@ function parseDomainPublicSuffix(domain) {
|
|
24
24
|
return null;
|
25
25
|
}
|
26
26
|
}
|
27
|
-
exports.parseDomainPublicSuffix = parseDomainPublicSuffix;
|
28
27
|
//# sourceMappingURL=hostname.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hostname.js","sourceRoot":"","sources":["../../../src/lib/util/hostname.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"hostname.js","sourceRoot":"","sources":["../../../src/lib/util/hostname.ts"],"names":[],"mappings":";;AAEA,sCAEC;AAED,wCAEC;AAED,oDAGC;AAED,0DAOC;AAtBD,6BAAyC;AAEzC,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,oBAAoB,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;AAC3C,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,uBAAuB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;AAC/C,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAmB;IACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IACnC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAED,SAAgB,uBAAuB,CAAC,MAAc;IACpD,MAAM,MAAM,GAAG,IAAA,WAAK,EAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QACzD,OAAO,MAAM,CAAA;IACf,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.compareRedirectUri =
|
3
|
+
exports.compareRedirectUri = compareRedirectUri;
|
4
4
|
const oauth_types_1 = require("@atproto/oauth-types");
|
5
5
|
/**
|
6
6
|
*
|
@@ -40,5 +40,4 @@ function compareRedirectUri(allowed_uri, request_uri) {
|
|
40
40
|
}
|
41
41
|
return false;
|
42
42
|
}
|
43
|
-
exports.compareRedirectUri = compareRedirectUri;
|
44
43
|
//# sourceMappingURL=redirect-uri.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"redirect-uri.js","sourceRoot":"","sources":["../../../src/lib/util/redirect-uri.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"redirect-uri.js","sourceRoot":"","sources":["../../../src/lib/util/redirect-uri.ts"],"names":[],"mappings":";;AAOA,gDAsCC;AA7CD,sDAAqD;AAErD;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,WAAmB,EACnB,WAAmB;IAEnB,4DAA4D;IAC5D,EAAE;IACF,0EAA0E;IAC1E,yEAAyE;IACzE,wEAAwE;IACxE,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,WAAW,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAE5C,4DAA4D;IAC5D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAA;IACvC,IAAI,IAAA,4BAAc,EAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAA;QAEvC,OAAO;QACL,wEAAwE;QACxE,sEAAsE;QACtE,uEAAuE;QACvE,sCAAsC;QACtC,EAAE;QACF,wEAAwE;QACxE,aAAa;QACb,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;YACzD,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ;YAC3C,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ;YAC3C,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ;YAC3C,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM;YACvC,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI;YACnC,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ;YAC3C,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ,CAC5C,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/lib/util/time.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.constantTime =
|
3
|
+
exports.constantTime = constantTime;
|
4
4
|
/**
|
5
5
|
* Utility function to protect against timing attacks.
|
6
6
|
*/
|
@@ -24,5 +24,4 @@ async function constantTime(delay, fn) {
|
|
24
24
|
await new Promise((resolve) => setTimeout(resolve, n * delay));
|
25
25
|
}
|
26
26
|
}
|
27
|
-
exports.constantTime = constantTime;
|
28
27
|
//# sourceMappingURL=time.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/lib/util/time.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/lib/util/time.ts"],"names":[],"mappings":";;AAKA,oCA2BC;AA9BD;;GAEG;AACI,KAAK,UAAU,YAAY,CAChC,KAAa,EACb,EAAsB;IAEtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACxB,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAA;IACnB,CAAC;YAAS,CAAC;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAA;QAEhC,yEAAyE;QACzE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAA;QAE/C,0EAA0E;QAC1E,sDAAsD;QACtD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CACV,oCAAoC,KAAK,wCAAwC,KAAK,8EAA8E,CACrK,CAAA;QACH,CAAC;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAA;IAChE,CAAC;AACH,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"well-known.d.ts","sourceRoot":"","sources":["../../../src/lib/util/well-known.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"well-known.d.ts","sourceRoot":"","sources":["../../../src/lib/util/well-known.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAO7D"}
|
@@ -1,11 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.buildWellknownUrl =
|
3
|
+
exports.buildWellknownUrl = buildWellknownUrl;
|
4
4
|
function buildWellknownUrl(url, name) {
|
5
5
|
const path = url.pathname === '/'
|
6
6
|
? `/.well-known/${name}`
|
7
7
|
: `${url.pathname.replace(/\/+$/, '')}/${name}`;
|
8
8
|
return new URL(path, url);
|
9
9
|
}
|
10
|
-
exports.buildWellknownUrl = buildWellknownUrl;
|
11
10
|
//# sourceMappingURL=well-known.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"well-known.js","sourceRoot":"","sources":["../../../src/lib/util/well-known.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"well-known.js","sourceRoot":"","sources":["../../../src/lib/util/well-known.ts"],"names":[],"mappings":";;AAAA,8CAOC;AAPD,SAAgB,iBAAiB,CAAC,GAAQ,EAAE,IAAY;IACtD,MAAM,IAAI,GACR,GAAG,CAAC,QAAQ,KAAK,GAAG;QAClB,CAAC,CAAC,gBAAgB,IAAI,EAAE;QACxB,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAA;IAEnD,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC3B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,
|
1
|
+
{"version":3,"file":"build-metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EACL,gCAAgC,EAEjC,MAAM,sBAAsB,CAAA;AAK7B,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,qCAAqC,CAAC,EAAE,MAAM,EAAE,CAAA;IAChD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,cAAc,GAC9B,gCAAgC,CAsGlC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.buildMetadata =
|
3
|
+
exports.buildMetadata = buildMetadata;
|
4
|
+
const oauth_types_1 = require("@atproto/oauth-types");
|
4
5
|
const client_js_1 = require("../client/client.js");
|
5
6
|
const crypto_js_1 = require("../lib/util/crypto.js");
|
6
7
|
/**
|
@@ -8,7 +9,7 @@ const crypto_js_1 = require("../lib/util/crypto.js");
|
|
8
9
|
* @see {@link https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata}
|
9
10
|
*/
|
10
11
|
function buildMetadata(issuer, keyset, customMetadata) {
|
11
|
-
return {
|
12
|
+
return oauth_types_1.oauthAuthorizationServerMetadataSchema.parse({
|
12
13
|
issuer,
|
13
14
|
scopes_supported: [
|
14
15
|
'atproto',
|
@@ -89,7 +90,6 @@ function buildMetadata(issuer, keyset, customMetadata) {
|
|
89
90
|
protected_resources: customMetadata?.protected_resources,
|
90
91
|
// https://drafts.aaronpk.com/draft-parecki-oauth-client-id-metadata-document/draft-parecki-oauth-client-id-metadata-document.html
|
91
92
|
client_id_metadata_document_supported: true,
|
92
|
-
};
|
93
|
+
});
|
93
94
|
}
|
94
|
-
exports.buildMetadata = buildMetadata;
|
95
95
|
//# sourceMappingURL=build-metadata.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-metadata.js","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"build-metadata.js","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":";;AAmBA,sCA0GC;AA5HD,sDAG6B;AAE7B,mDAA4C;AAC5C,qDAAoD;AAQpD;;;GAGG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,MAAc,EACd,cAA+B;IAE/B,OAAO,oDAAsC,CAAC,KAAK,CAAC;QAClD,MAAM;QAEN,gBAAgB,EAAE;YAChB,SAAS;YACT,EAAE;YACF,GAAG,CAAC,cAAc,EAAE,gBAAgB,IAAI,EAAE,CAAC;SAC5C;QACD,uBAAuB,EAAE;YACvB,EAAE;YACF,QAAQ,EAAE,6CAA6C;YACvD,+DAA+D;SAChE;QACD,wBAAwB,EAAE;YACxB,QAAQ;YACR,MAAM;YACN,WAAW;YAEX,SAAS;YACT,UAAU;YACV,yBAAyB;YACzB,mBAAmB;YACnB,gBAAgB;YAChB,oBAAoB;YACpB,cAAc;SACf;QACD,wBAAwB,EAAE;YACxB,mFAAmF;YACnF,OAAO;YACP,UAAU;YACV,0FAA0F;YAC1F,WAAW;SACZ;QACD,qBAAqB,EAAE;YACrB,EAAE;YACF,oBAAoB;YACpB,eAAe;SAChB;QACD,gCAAgC,EAAE;YAChC,sGAAsG;YACtG,MAAM;YAEN,iCAAiC;YACjC,WAAW;SACZ;QACD,oBAAoB,EAAE;YACpB,EAAE;YACF,OAAO;SACR;QACD,wBAAwB,EAAE;YACxB,EAAE;YACF,MAAM;YACN,OAAO;YACP,OAAO;YACP,aAAa;SACd;QAED,gDAAgD;QAChD,8CAA8C,EAAE,IAAI;QAEpD,0DAA0D;QAC1D,2CAA2C,EAAE,CAAC,GAAG,wBAAY,EAAE,MAAM,CAAC;QACtE,8CAA8C,EAAE,EAAE,EAAE,OAAO;QAC3D,8CAA8C,EAAE,EAAE,EAAE,OAAO;QAE3D,2BAA2B,EAAE,IAAI;QACjC,+BAA+B,EAAE,IAAI;QACrC,gCAAgC,EAAE,IAAI;QAEtC,QAAQ,EAAE,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,IAAI;QAE7C,sBAAsB,EAAE,IAAI,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,IAAI;QAEhE,cAAc,EAAE,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,IAAI;QACpD,qCAAqC,EAAE,CAAC,GAAG,kBAAM,CAAC,sBAAsB,CAAC;QACzE,gDAAgD,EAAE,CAAC,GAAG,wBAAY,CAAC;QAEnE,mBAAmB,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,IAAI;QAE1D,sBAAsB,EAAE,IAAI,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,IAAI;QAEjE,+DAA+D;QAE/D,0DAA0D;QAC1D,qCAAqC,EAAE,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI;QAEzE,qCAAqC,EAAE,IAAI;QAE3C,4DAA4D;QAC5D,iCAAiC,EAAE,CAAC,GAAG,wBAAY,CAAC;QAEpD,6DAA6D;QAC7D,qCAAqC,EACnC,cAAc,EAAE,qCAAqC;QAEvD,wFAAwF;QACxF,mBAAmB,EAAE,cAAc,EAAE,mBAAmB;QAExD,kIAAkI;QAClI,qCAAqC,EAAE,IAAI;KAC5C,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/oauth-provider.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { SimpleStore } from '@atproto-labs/simple-store';
|
3
2
|
import { Jwks, Keyset } from '@atproto/jwk';
|
4
3
|
import { OAuthAccessToken, OAuthAuthorizationCodeGrantTokenRequest, OAuthAuthorizationRequestJar, OAuthAuthorizationRequestPar, OAuthAuthorizationRequestParameters, OAuthAuthorizationRequestQuery, OAuthAuthorizationServerMetadata, OAuthClientCredentials, OAuthClientCredentialsNone, OAuthClientMetadata, OAuthIntrospectionResponse, OAuthParResponse, OAuthRefreshTokenGrantTokenRequest, OAuthTokenIdentification, OAuthTokenRequest, OAuthTokenResponse, OAuthTokenType } from '@atproto/oauth-types';
|
5
|
-
import { Redis,
|
4
|
+
import type { Redis, RedisOptions } from 'ioredis';
|
6
5
|
import { AccountManager } from './account/account-manager.js';
|
7
6
|
import { AccountStore, DeviceAccountInfo, SignInCredentials } from './account/account-store.js';
|
8
7
|
import { Account } from './account/account.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../src/oauth-provider.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"oauth-provider.d.ts","sourceRoot":"","sources":["../src/oauth-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAEL,gBAAgB,EAChB,uCAAuC,EACvC,4BAA4B,EAC5B,4BAA4B,EAC5B,mCAAmC,EACnC,8BAA8B,EAC9B,gCAAgC,EAChC,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAChB,kCAAkC,EAClC,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EAQf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAqB,MAAM,yBAAyB,CAAA;AACv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E,GAAG,CAAC;CAsfpC"}
|
package/dist/oauth-provider.js
CHANGED
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
29
|
exports.OAuthProvider = exports.Keyset = void 0;
|
27
30
|
const fetch_node_1 = require("@atproto-labs/fetch-node");
|
@@ -29,6 +32,8 @@ const simple_store_memory_1 = require("@atproto-labs/simple-store-memory");
|
|
29
32
|
const jwk_1 = require("@atproto/jwk");
|
30
33
|
Object.defineProperty(exports, "Keyset", { enumerable: true, get: function () { return jwk_1.Keyset; } });
|
31
34
|
const oauth_types_1 = require("@atproto/oauth-types");
|
35
|
+
const accept_1 = require("@hapi/accept");
|
36
|
+
const http_errors_1 = __importDefault(require("http-errors"));
|
32
37
|
const zod_1 = __importStar(require("zod"));
|
33
38
|
const access_token_type_js_1 = require("./access-token/access-token-type.js");
|
34
39
|
const account_manager_js_1 = require("./account/account-manager.js");
|
@@ -519,7 +524,7 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
519
524
|
res.setHeader('Cache-Control', 'max-age=300');
|
520
525
|
next();
|
521
526
|
},
|
522
|
-
(0, index_js_1.
|
527
|
+
(0, index_js_1.staticJsonMiddleware)(json),
|
523
528
|
]);
|
524
529
|
/**
|
525
530
|
* Wrap an OAuth endpoint in a middleware that will set the appropriate
|
@@ -539,11 +544,18 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
539
544
|
res.appendHeader('Access-Control-Expose-Headers', name);
|
540
545
|
}
|
541
546
|
try {
|
547
|
+
// Ensure we can agree on a content encoding & type before starting to
|
548
|
+
// build the JSON response.
|
549
|
+
if (!(0, accept_1.mediaType)(req.headers['accept'], ['application/json'])) {
|
550
|
+
throw (0, http_errors_1.default)(406, 'Unsupported media type');
|
551
|
+
}
|
542
552
|
const result = await buildJson.call(this, req, res);
|
543
|
-
if (result !== undefined)
|
544
|
-
(0, index_js_1.writeJson)(res, result, status);
|
545
|
-
|
553
|
+
if (result !== undefined) {
|
554
|
+
(0, index_js_1.writeJson)(res, result, { status });
|
555
|
+
}
|
556
|
+
else if (!res.headersSent) {
|
546
557
|
res.writeHead(status ?? 204).end();
|
558
|
+
}
|
547
559
|
}
|
548
560
|
catch (err) {
|
549
561
|
if (!res.headersSent) {
|
@@ -552,7 +564,9 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
552
564
|
res.setHeader(name, err.wwwAuthenticateHeader);
|
553
565
|
res.appendHeader('Access-Control-Expose-Headers', name);
|
554
566
|
}
|
555
|
-
|
567
|
+
const payload = (0, build_error_payload_js_1.buildErrorPayload)(err);
|
568
|
+
const status = (0, build_error_payload_js_1.buildErrorStatus)(err);
|
569
|
+
(0, index_js_1.writeJson)(res, payload, { status });
|
556
570
|
}
|
557
571
|
else {
|
558
572
|
res.destroy();
|
@@ -574,10 +588,6 @@ class OAuthProvider extends oauth_verifier_js_1.OAuthVerifier {
|
|
574
588
|
(0, index_js_1.validateFetchDest)(req, res, ['document']);
|
575
589
|
(0, index_js_1.validateSameOrigin)(req, res, issuerOrigin);
|
576
590
|
await handler.call(this, req, res);
|
577
|
-
// Should never happen (fool proofing)
|
578
|
-
if (!res.headersSent) {
|
579
|
-
throw new Error('Navigation handler did not send a response');
|
580
|
-
}
|
581
591
|
}
|
582
592
|
catch (err) {
|
583
593
|
onError?.(req, res, err, `Failed to handle navigation request to "${req.url}"`);
|