@atproto/oauth-provider 0.1.2-rc.2 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/package.json +4 -4
- package/dist/output/send-authorize-page.d.ts +0 -43
- package/dist/output/send-authorize-page.d.ts.map +0 -1
- package/dist/output/send-authorize-page.js +0 -49
- package/dist/output/send-authorize-page.js.map +0 -1
- package/dist/output/send-error-page.d.ts +0 -5
- package/dist/output/send-error-page.d.ts.map +0 -1
- package/dist/output/send-error-page.js +0 -31
- package/dist/output/send-error-page.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# @atproto/oauth-provider
|
2
2
|
|
3
|
+
## 0.1.2
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2483](https://github.com/bluesky-social/atproto/pull/2483) [`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove unused file
|
8
|
+
|
9
|
+
- Updated dependencies [[`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd), [`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd), [`b934b396b`](https://github.com/bluesky-social/atproto/commit/b934b396b13ba32bf2bf7e75ecdf6871e5f310dd)]:
|
10
|
+
- @atproto/jwk-jose@0.1.2
|
11
|
+
- @atproto/oauth-types@0.1.2
|
12
|
+
|
3
13
|
## 0.1.1
|
4
14
|
|
5
15
|
### Patch Changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atproto/oauth-provider",
|
3
|
-
"version": "0.1.2
|
3
|
+
"version": "0.1.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Generic OAuth2 and OpenID Connect provider for Node.js. Currently only supports features needed for Atproto.",
|
6
6
|
"keywords": [
|
@@ -40,12 +40,12 @@
|
|
40
40
|
"zod": "^3.23.8",
|
41
41
|
"@atproto-labs/fetch": "0.1.0",
|
42
42
|
"@atproto-labs/fetch-node": "0.1.0",
|
43
|
+
"@atproto-labs/pipe": "0.1.0",
|
43
44
|
"@atproto-labs/simple-store": "0.1.1",
|
44
45
|
"@atproto-labs/simple-store-memory": "0.1.1",
|
45
|
-
"@atproto-labs/pipe": "0.1.0",
|
46
46
|
"@atproto/jwk": "0.1.1",
|
47
|
-
"@atproto/jwk-jose": "0.1.2
|
48
|
-
"@atproto/oauth-types": "0.1.2
|
47
|
+
"@atproto/jwk-jose": "0.1.2",
|
48
|
+
"@atproto/oauth-types": "0.1.2"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
51
|
"@rollup/plugin-commonjs": "^25.0.7",
|
@@ -1,43 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { OAuthAuthenticationRequestParameters, OAuthClientMetadata } from '@atproto/oauth-types';
|
3
|
-
import { ServerResponse } from 'node:http';
|
4
|
-
import { DeviceAccountInfo } from '../account/account-store.js';
|
5
|
-
import { Account } from '../account/account.js';
|
6
|
-
import { Client } from '../client/client.js';
|
7
|
-
import { RequestUri } from '../request/request-uri.js';
|
8
|
-
import { Customization } from './customization.js';
|
9
|
-
export type AuthorizationResultAuthorize = {
|
10
|
-
issuer: string;
|
11
|
-
client: Client;
|
12
|
-
parameters: OAuthAuthenticationRequestParameters;
|
13
|
-
authorize: {
|
14
|
-
uri: RequestUri;
|
15
|
-
sessions: readonly {
|
16
|
-
account: Account;
|
17
|
-
info: DeviceAccountInfo;
|
18
|
-
selected: boolean;
|
19
|
-
loginRequired: boolean;
|
20
|
-
consentRequired: boolean;
|
21
|
-
}[];
|
22
|
-
};
|
23
|
-
};
|
24
|
-
type Session = {
|
25
|
-
account: Account;
|
26
|
-
info?: never;
|
27
|
-
selected: boolean;
|
28
|
-
loginRequired: boolean;
|
29
|
-
consentRequired: boolean;
|
30
|
-
};
|
31
|
-
export type AuthorizeData = {
|
32
|
-
clientId: string;
|
33
|
-
clientMetadata: OAuthClientMetadata;
|
34
|
-
clientTrusted: boolean;
|
35
|
-
requestUri: string;
|
36
|
-
csrfCookie: string;
|
37
|
-
loginHint?: string;
|
38
|
-
newSessionsRequireConsent: boolean;
|
39
|
-
sessions: Session[];
|
40
|
-
};
|
41
|
-
export declare function sendAuthorizePage(res: ServerResponse, data: AuthorizationResultAuthorize, customization?: Customization): Promise<void>;
|
42
|
-
export {};
|
43
|
-
//# sourceMappingURL=send-authorize-page.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"send-authorize-page.d.ts","sourceRoot":"","sources":["../../src/output/send-authorize-page.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,oCAAoC,EACpC,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EACL,aAAa,EAGd,MAAM,oBAAoB,CAAA;AAG3B,MAAM,MAAM,4BAA4B,GAAG;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,oCAAoC,CAAA;IAChD,SAAS,EAAE;QACT,GAAG,EAAE,UAAU,CAAA;QACf,QAAQ,EAAE,SAAS;YACjB,OAAO,EAAE,OAAO,CAAA;YAChB,IAAI,EAAE,iBAAiB,CAAA;YAEvB,QAAQ,EAAE,OAAO,CAAA;YACjB,aAAa,EAAE,OAAO,CAAA;YACtB,eAAe,EAAE,OAAO,CAAA;SACzB,EAAE,CAAA;KACJ,CAAA;CACF,CAAA;AAKD,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAA;IAEZ,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,mBAAmB,CAAA;IACnC,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yBAAyB,EAAE,OAAO,CAAA;IAClC,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB,CAAA;AAsBD,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,4BAA4B,EAClC,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sendAuthorizePage = void 0;
|
4
|
-
const index_js_1 = require("../assets/index.js");
|
5
|
-
const index_js_2 = require("../lib/html/index.js");
|
6
|
-
const customization_js_1 = require("./customization.js");
|
7
|
-
const send_web_page_js_1 = require("./send-web-page.js");
|
8
|
-
function buildAuthorizeData(data) {
|
9
|
-
return {
|
10
|
-
clientId: data.client.id,
|
11
|
-
clientMetadata: data.client.metadata,
|
12
|
-
clientTrusted: data.client.info.isTrusted,
|
13
|
-
requestUri: data.authorize.uri,
|
14
|
-
csrfCookie: `csrf-${data.authorize.uri}`,
|
15
|
-
loginHint: data.parameters.login_hint,
|
16
|
-
newSessionsRequireConsent: data.parameters.prompt === 'consent',
|
17
|
-
sessions: data.authorize.sessions.map((session) => ({
|
18
|
-
account: session.account,
|
19
|
-
selected: session.selected,
|
20
|
-
loginRequired: session.loginRequired,
|
21
|
-
consentRequired: session.consentRequired,
|
22
|
-
})),
|
23
|
-
};
|
24
|
-
}
|
25
|
-
async function sendAuthorizePage(res, data, customization) {
|
26
|
-
res.setHeader('Cache-Control', 'no-store');
|
27
|
-
res.setHeader('Permissions-Policy', 'otp-credentials=*, document-domain=()');
|
28
|
-
const [jsAsset, cssAsset] = await Promise.all([
|
29
|
-
(0, index_js_1.getAsset)('main.js'),
|
30
|
-
(0, index_js_1.getAsset)('main.css'),
|
31
|
-
]);
|
32
|
-
return (0, send_web_page_js_1.sendWebPage)(res, {
|
33
|
-
scripts: [
|
34
|
-
(0, send_web_page_js_1.declareBackendData)('__customizationData', (0, customization_js_1.buildCustomizationData)(customization)),
|
35
|
-
(0, send_web_page_js_1.declareBackendData)('__authorizeData', buildAuthorizeData(data)),
|
36
|
-
jsAsset, // Last (to be able to read the global variables)
|
37
|
-
],
|
38
|
-
styles: [
|
39
|
-
cssAsset, // First (to be overridden by customization)
|
40
|
-
(0, index_js_2.cssCode)((0, customization_js_1.buildCustomizationCss)(customization)),
|
41
|
-
],
|
42
|
-
links: customization?.links,
|
43
|
-
htmlAttrs: { lang: 'en' },
|
44
|
-
title: 'Authorize',
|
45
|
-
body: (0, index_js_2.html) `<div id="root"></div>`,
|
46
|
-
});
|
47
|
-
}
|
48
|
-
exports.sendAuthorizePage = sendAuthorizePage;
|
49
|
-
//# sourceMappingURL=send-authorize-page.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"send-authorize-page.js","sourceRoot":"","sources":["../../src/output/send-authorize-page.ts"],"names":[],"mappings":";;;AAQA,iDAA6C;AAE7C,mDAAoD;AAEpD,yDAI2B;AAC3B,yDAAoE;AA0CpE,SAAS,kBAAkB,CAAC,IAAkC;IAC5D,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;QACxB,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;QACpC,aAAa,EAAE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AAO,EAAC,IAAA,wCAAqB,EAAC,aAAa,CAAC,CAAC;SAC9C;QACD,KAAK,EAAE,aAAa,EAAE,KAAK;QAC3B,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACzB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,IAAA,eAAI,EAAA,uBAAuB;KAClC,CAAC,CAAA;AACJ,CAAC;AA/BD,8CA+BC"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import { ServerResponse } from 'node:http';
|
3
|
-
import { Customization } from './customization.js';
|
4
|
-
export declare function sendErrorPage(res: ServerResponse, err: unknown, customization?: Customization): Promise<void>;
|
5
|
-
//# sourceMappingURL=send-error-page.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"send-error-page.d.ts","sourceRoot":"","sources":["../../src/output/send-error-page.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAK1C,OAAO,EACL,aAAa,EAGd,MAAM,oBAAoB,CAAA;AAG3B,wBAAsB,aAAa,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sendErrorPage = void 0;
|
4
|
-
const index_js_1 = require("../assets/index.js");
|
5
|
-
const index_js_2 = require("../lib/html/index.js");
|
6
|
-
const build_error_payload_js_1 = require("./build-error-payload.js");
|
7
|
-
const customization_js_1 = require("./customization.js");
|
8
|
-
const send_web_page_js_1 = require("./send-web-page.js");
|
9
|
-
async function sendErrorPage(res, err, customization) {
|
10
|
-
const [jsAsset, cssAsset] = await Promise.all([
|
11
|
-
(0, index_js_1.getAsset)('main.js'),
|
12
|
-
(0, index_js_1.getAsset)('main.css'),
|
13
|
-
]);
|
14
|
-
return (0, send_web_page_js_1.sendWebPage)(res, {
|
15
|
-
status: (0, build_error_payload_js_1.buildErrorStatus)(err),
|
16
|
-
scripts: [
|
17
|
-
(0, send_web_page_js_1.declareBackendData)('__customizationData', (0, customization_js_1.buildCustomizationData)(customization)),
|
18
|
-
(0, send_web_page_js_1.declareBackendData)('__errorData', (0, build_error_payload_js_1.buildErrorPayload)(err)),
|
19
|
-
jsAsset, // Last (to be able to read the global variables)
|
20
|
-
],
|
21
|
-
styles: [
|
22
|
-
cssAsset, // First (to be overridden by customization)
|
23
|
-
(0, index_js_2.cssCode)((0, customization_js_1.buildCustomizationCss)(customization)),
|
24
|
-
],
|
25
|
-
htmlAttrs: { lang: 'en' },
|
26
|
-
title: 'Error',
|
27
|
-
body: (0, index_js_2.html) `<div id="root"></div>`,
|
28
|
-
});
|
29
|
-
}
|
30
|
-
exports.sendErrorPage = sendErrorPage;
|
31
|
-
//# sourceMappingURL=send-error-page.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"send-error-page.js","sourceRoot":"","sources":["../../src/output/send-error-page.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAC7C,mDAAoD;AACpD,qEAA8E;AAC9E,yDAI2B;AAC3B,yDAAoE;AAE7D,KAAK,UAAU,aAAa,CACjC,GAAmB,EACnB,GAAY,EACZ,aAA6B;IAE7B,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5C,IAAA,mBAAQ,EAAC,SAAS,CAAC;QACnB,IAAA,mBAAQ,EAAC,UAAU,CAAC;KACrB,CAAC,CAAA;IAEF,OAAO,IAAA,8BAAW,EAAC,GAAG,EAAE;QACtB,MAAM,EAAE,IAAA,yCAAgB,EAAC,GAAG,CAAC;QAC7B,OAAO,EAAE;YACP,IAAA,qCAAkB,EAChB,qBAAqB,EACrB,IAAA,yCAAsB,EAAC,aAAa,CAAC,CACtC;YACD,IAAA,qCAAkB,EAAC,aAAa,EAAE,IAAA,0CAAiB,EAAC,GAAG,CAAC,CAAC;YACzD,OAAO,EAAE,iDAAiD;SAC3D;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,4CAA4C;YACtD,IAAA,kBAAO,EAAC,IAAA,wCAAqB,EAAC,aAAa,CAAC,CAAC;SAC9C;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;QACzB,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,IAAA,eAAI,EAAA,uBAAuB;KAClC,CAAC,CAAA;AACJ,CAAC;AA5BD,sCA4BC"}
|