@atproto/oauth-provider 0.5.2 → 0.6.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 +31 -0
- package/dist/account/account-manager.d.ts +7 -5
- package/dist/account/account-manager.d.ts.map +1 -1
- package/dist/account/account-manager.js +34 -25
- package/dist/account/account-manager.js.map +1 -1
- package/dist/account/account-store.d.ts +7 -0
- package/dist/account/account-store.d.ts.map +1 -1
- package/dist/account/account-store.js.map +1 -1
- package/dist/account/account.d.ts +1 -11
- package/dist/account/account.d.ts.map +1 -1
- package/dist/account/{sign-up-data.d.ts → sign-up-input.d.ts} +3 -3
- package/dist/account/sign-up-input.d.ts.map +1 -0
- package/dist/account/{sign-up-data.js → sign-up-input.js} +3 -3
- package/dist/account/sign-up-input.js.map +1 -0
- package/dist/assets/assets-middleware.d.ts +2 -0
- package/dist/assets/assets-middleware.d.ts.map +1 -1
- package/dist/assets/assets-middleware.js +12 -14
- package/dist/assets/assets-middleware.js.map +1 -1
- package/dist/lib/csp/index.d.ts +5 -6
- package/dist/lib/csp/index.d.ts.map +1 -1
- package/dist/lib/csp/index.js +14 -11
- package/dist/lib/csp/index.js.map +1 -1
- package/dist/lib/hcaptcha.d.ts +5 -3
- package/dist/lib/hcaptcha.d.ts.map +1 -1
- package/dist/lib/hcaptcha.js +7 -4
- package/dist/lib/hcaptcha.js.map +1 -1
- package/dist/lib/html/build-document.d.ts +2 -2
- package/dist/lib/html/build-document.d.ts.map +1 -1
- package/dist/lib/html/build-document.js +11 -7
- package/dist/lib/html/build-document.js.map +1 -1
- package/dist/lib/html/html.d.ts.map +1 -1
- package/dist/lib/html/html.js +10 -13
- package/dist/lib/html/html.js.map +1 -1
- package/dist/lib/html/util.d.ts +0 -1
- package/dist/lib/html/util.d.ts.map +1 -1
- package/dist/lib/html/util.js +0 -4
- package/dist/lib/html/util.js.map +1 -1
- package/dist/lib/http/response.d.ts +3 -1
- package/dist/lib/http/response.d.ts.map +1 -1
- package/dist/lib/http/response.js +3 -0
- package/dist/lib/http/response.js.map +1 -1
- package/dist/lib/http/security-headers.d.ts +48 -0
- package/dist/lib/http/security-headers.d.ts.map +1 -0
- package/dist/lib/http/security-headers.js +62 -0
- package/dist/lib/http/security-headers.js.map +1 -0
- package/dist/lib/util/type.d.ts +8 -0
- package/dist/lib/util/type.d.ts.map +1 -1
- package/dist/lib/util/type.js.map +1 -1
- package/dist/oauth-hooks.d.ts +4 -25
- package/dist/oauth-hooks.d.ts.map +1 -1
- package/dist/oauth-provider.js +2 -2
- package/dist/oauth-provider.js.map +1 -1
- package/dist/output/backend-data.d.ts +4 -0
- package/dist/output/backend-data.d.ts.map +1 -0
- package/dist/output/backend-data.js +19 -0
- package/dist/output/backend-data.js.map +1 -0
- package/dist/output/build-authorize-data.d.ts +3 -19
- package/dist/output/build-authorize-data.d.ts.map +1 -1
- package/dist/output/build-authorize-data.js.map +1 -1
- package/dist/output/build-customization-data.d.ts +11 -18
- package/dist/output/build-customization-data.d.ts.map +1 -1
- package/dist/output/build-customization-data.js +1 -1
- package/dist/output/build-customization-data.js.map +1 -1
- package/dist/output/build-error-data.d.ts +3 -0
- package/dist/output/build-error-data.d.ts.map +1 -0
- package/dist/output/build-error-data.js +10 -0
- package/dist/output/build-error-data.js.map +1 -0
- package/dist/output/build-error-payload.d.ts +2 -1
- package/dist/output/build-error-payload.d.ts.map +1 -1
- package/dist/output/build-error-payload.js.map +1 -1
- package/dist/output/output-manager.d.ts +10 -4
- package/dist/output/output-manager.d.ts.map +1 -1
- package/dist/output/output-manager.js +68 -39
- package/dist/output/output-manager.js.map +1 -1
- package/dist/output/send-web-page.d.ts +6 -10
- package/dist/output/send-web-page.d.ts.map +1 -1
- package/dist/output/send-web-page.js +27 -47
- package/dist/output/send-web-page.js.map +1 -1
- package/dist/signer/signed-token-payload.d.ts +3 -3
- package/dist/signer/signer.d.ts +2 -2
- package/package.json +7 -40
- package/src/account/account-manager.ts +55 -34
- package/src/account/account-store.ts +8 -0
- package/src/account/account.ts +1 -14
- package/src/account/{sign-up-data.ts → sign-up-input.ts} +2 -2
- package/src/assets/assets-middleware.ts +11 -17
- package/src/lib/csp/index.ts +16 -13
- package/src/lib/hcaptcha.ts +10 -7
- package/src/lib/html/build-document.ts +15 -8
- package/src/lib/html/html.ts +11 -18
- package/src/lib/html/util.ts +0 -4
- package/src/lib/http/response.ts +9 -1
- package/src/lib/http/security-headers.ts +91 -0
- package/src/lib/util/type.ts +18 -0
- package/src/oauth-hooks.ts +4 -25
- package/src/oauth-provider.ts +2 -2
- package/src/output/backend-data.ts +18 -0
- package/src/output/build-authorize-data.ts +3 -26
- package/src/output/build-customization-data.ts +2 -13
- package/src/output/build-error-data.ts +8 -0
- package/src/output/build-error-payload.ts +4 -2
- package/src/output/output-manager.ts +86 -47
- package/src/output/send-web-page.ts +29 -58
- package/tsconfig.backend.json +1 -2
- package/tsconfig.backend.tsbuildinfo +1 -1
- package/tsconfig.json +1 -5
- package/.linguirc +0 -57
- package/dist/account/sign-up-data.d.ts.map +0 -1
- package/dist/account/sign-up-data.js.map +0 -1
- package/dist/assets/app/bundle-manifest.json +0 -614
- package/dist/assets/app/index-DZHZ9kCP.js +0 -36
- package/dist/assets/app/index-DZHZ9kCP.js.map +0 -1
- package/dist/assets/app/main-B_dNxQo_.js +0 -4
- package/dist/assets/app/main-B_dNxQo_.js.map +0 -1
- package/dist/assets/app/main-Dr6y26KY.css +0 -3
- package/dist/assets/app/main-Dr6y26KY.js +0 -306
- package/dist/assets/app/main-Dr6y26KY.js.map +0 -1
- package/dist/assets/app/messages-6_mYuGzB.js +0 -4
- package/dist/assets/app/messages-6_mYuGzB.js.map +0 -1
- package/dist/assets/app/messages-7wdeBTpD.js +0 -4
- package/dist/assets/app/messages-7wdeBTpD.js.map +0 -1
- package/dist/assets/app/messages-B-YFoWKc.js +0 -4
- package/dist/assets/app/messages-B-YFoWKc.js.map +0 -1
- package/dist/assets/app/messages-B10DUOE-.js +0 -4
- package/dist/assets/app/messages-B10DUOE-.js.map +0 -1
- package/dist/assets/app/messages-B4AwFEeZ.js +0 -4
- package/dist/assets/app/messages-B4AwFEeZ.js.map +0 -1
- package/dist/assets/app/messages-BDP8MyEC.js +0 -4
- package/dist/assets/app/messages-BDP8MyEC.js.map +0 -1
- package/dist/assets/app/messages-BIS87lxQ.js +0 -4
- package/dist/assets/app/messages-BIS87lxQ.js.map +0 -1
- package/dist/assets/app/messages-BI_Wbjdt.js +0 -4
- package/dist/assets/app/messages-BI_Wbjdt.js.map +0 -1
- package/dist/assets/app/messages-BMAouhRx.js +0 -4
- package/dist/assets/app/messages-BMAouhRx.js.map +0 -1
- package/dist/assets/app/messages-BdckMnJj.js +0 -4
- package/dist/assets/app/messages-BdckMnJj.js.map +0 -1
- package/dist/assets/app/messages-BgBLzc46.js +0 -4
- package/dist/assets/app/messages-BgBLzc46.js.map +0 -1
- package/dist/assets/app/messages-BobD78yK.js +0 -4
- package/dist/assets/app/messages-BobD78yK.js.map +0 -1
- package/dist/assets/app/messages-BtThT9UZ.js +0 -4
- package/dist/assets/app/messages-BtThT9UZ.js.map +0 -1
- package/dist/assets/app/messages-BwKHkbeh.js +0 -4
- package/dist/assets/app/messages-BwKHkbeh.js.map +0 -1
- package/dist/assets/app/messages-C417YUvA.js +0 -4
- package/dist/assets/app/messages-C417YUvA.js.map +0 -1
- package/dist/assets/app/messages-C4CxO4bO.js +0 -4
- package/dist/assets/app/messages-C4CxO4bO.js.map +0 -1
- package/dist/assets/app/messages-C5vd04e6.js +0 -4
- package/dist/assets/app/messages-C5vd04e6.js.map +0 -1
- package/dist/assets/app/messages-CAri2Wnz.js +0 -4
- package/dist/assets/app/messages-CAri2Wnz.js.map +0 -1
- package/dist/assets/app/messages-CPtWTZeG.js +0 -4
- package/dist/assets/app/messages-CPtWTZeG.js.map +0 -1
- package/dist/assets/app/messages-CiaM5zm8.js +0 -4
- package/dist/assets/app/messages-CiaM5zm8.js.map +0 -1
- package/dist/assets/app/messages-CkL-L2R6.js +0 -4
- package/dist/assets/app/messages-CkL-L2R6.js.map +0 -1
- package/dist/assets/app/messages-Cy_4XLNe.js +0 -4
- package/dist/assets/app/messages-Cy_4XLNe.js.map +0 -1
- package/dist/assets/app/messages-D5_ad-Eo.js +0 -4
- package/dist/assets/app/messages-D5_ad-Eo.js.map +0 -1
- package/dist/assets/app/messages-DChMl9mT.js +0 -4
- package/dist/assets/app/messages-DChMl9mT.js.map +0 -1
- package/dist/assets/app/messages-DWX-DIfv.js +0 -4
- package/dist/assets/app/messages-DWX-DIfv.js.map +0 -1
- package/dist/assets/app/messages-DgfsOphe.js +0 -4
- package/dist/assets/app/messages-DgfsOphe.js.map +0 -1
- package/dist/assets/app/messages-Dj5B_DR6.js +0 -4
- package/dist/assets/app/messages-Dj5B_DR6.js.map +0 -1
- package/dist/assets/app/messages-Dwzqo4eA.js +0 -4
- package/dist/assets/app/messages-Dwzqo4eA.js.map +0 -1
- package/dist/assets/app/messages-ESCIXJR7.js +0 -4
- package/dist/assets/app/messages-ESCIXJR7.js.map +0 -1
- package/dist/assets/app/messages-dglB2edb.js +0 -4
- package/dist/assets/app/messages-dglB2edb.js.map +0 -1
- package/dist/assets/app/messages-e_ClRrWc.js +0 -4
- package/dist/assets/app/messages-e_ClRrWc.js.map +0 -1
- package/dist/assets/app/messages-evvDxmrP.js +0 -4
- package/dist/assets/app/messages-evvDxmrP.js.map +0 -1
- package/dist/assets/app/messages-pPbdLb5B.js +0 -4
- package/dist/assets/app/messages-pPbdLb5B.js.map +0 -1
- package/dist/assets/app/messages-tJv8gHL2.js +0 -4
- package/dist/assets/app/messages-tJv8gHL2.js.map +0 -1
- package/dist/assets/app/messages-vLRVEw96.js +0 -4
- package/dist/assets/app/messages-vLRVEw96.js.map +0 -1
- package/dist/assets/asset.d.ts +0 -9
- package/dist/assets/asset.d.ts.map +0 -1
- package/dist/assets/asset.js +0 -3
- package/dist/assets/asset.js.map +0 -1
- package/dist/assets/index.d.ts +0 -5
- package/dist/assets/index.d.ts.map +0 -1
- package/dist/assets/index.js +0 -78
- package/dist/assets/index.js.map +0 -1
- package/rollup.config.js +0 -98
- package/src/assets/app/app.tsx +0 -43
- package/src/assets/app/backend-data.ts +0 -27
- package/src/assets/app/backend-types.ts +0 -66
- package/src/assets/app/components/forms/button-toggle-visibility.tsx +0 -43
- package/src/assets/app/components/forms/button.tsx +0 -60
- package/src/assets/app/components/forms/fieldset.tsx +0 -55
- package/src/assets/app/components/forms/form-card-async.tsx +0 -103
- package/src/assets/app/components/forms/form-card.tsx +0 -49
- package/src/assets/app/components/forms/input-checkbox.tsx +0 -78
- package/src/assets/app/components/forms/input-container.tsx +0 -107
- package/src/assets/app/components/forms/input-email-address.tsx +0 -65
- package/src/assets/app/components/forms/input-new-password.tsx +0 -62
- package/src/assets/app/components/forms/input-password.tsx +0 -87
- package/src/assets/app/components/forms/input-text.tsx +0 -82
- package/src/assets/app/components/forms/input-token.tsx +0 -94
- package/src/assets/app/components/forms/wizard-card.tsx +0 -116
- package/src/assets/app/components/layouts/layout-title-page.tsx +0 -77
- package/src/assets/app/components/layouts/layout-welcome.tsx +0 -73
- package/src/assets/app/components/utils/account-identifier.tsx +0 -23
- package/src/assets/app/components/utils/account-image.tsx +0 -33
- package/src/assets/app/components/utils/admonition.tsx +0 -52
- package/src/assets/app/components/utils/client-name.tsx +0 -45
- package/src/assets/app/components/utils/error-card.tsx +0 -93
- package/src/assets/app/components/utils/error-message.tsx +0 -88
- package/src/assets/app/components/utils/help-card.tsx +0 -46
- package/src/assets/app/components/utils/icons.tsx +0 -88
- package/src/assets/app/components/utils/link-anchor.tsx +0 -28
- package/src/assets/app/components/utils/link-title.tsx +0 -26
- package/src/assets/app/components/utils/multi-lang-string.tsx +0 -56
- package/src/assets/app/components/utils/password-strength-label.tsx +0 -37
- package/src/assets/app/components/utils/password-strength-meter.tsx +0 -58
- package/src/assets/app/components/utils/url-viewer.tsx +0 -73
- package/src/assets/app/cookies.ts +0 -11
- package/src/assets/app/hooks/use-api.ts +0 -178
- package/src/assets/app/hooks/use-async-action.ts +0 -120
- package/src/assets/app/hooks/use-bound-dispatch.ts +0 -5
- package/src/assets/app/hooks/use-browser-color-scheme.ts +0 -31
- package/src/assets/app/hooks/use-csrf-token.ts +0 -5
- package/src/assets/app/hooks/use-random-string.ts +0 -37
- package/src/assets/app/hooks/use-stepper.ts +0 -87
- package/src/assets/app/index.html +0 -182
- package/src/assets/app/lib/api.ts +0 -289
- package/src/assets/app/lib/clsx.ts +0 -6
- package/src/assets/app/lib/json-client.ts +0 -94
- package/src/assets/app/lib/password.ts +0 -98
- package/src/assets/app/lib/ref.ts +0 -17
- package/src/assets/app/lib/util.ts +0 -13
- package/src/assets/app/locales/an/messages.po +0 -490
- package/src/assets/app/locales/ast/messages.po +0 -490
- package/src/assets/app/locales/ca/messages.po +0 -490
- package/src/assets/app/locales/da/messages.po +0 -490
- package/src/assets/app/locales/de/messages.po +0 -490
- package/src/assets/app/locales/el/messages.po +0 -490
- package/src/assets/app/locales/en/messages.po +0 -490
- package/src/assets/app/locales/en-GB/messages.po +0 -490
- package/src/assets/app/locales/es/messages.po +0 -490
- package/src/assets/app/locales/eu/messages.po +0 -490
- package/src/assets/app/locales/fi/messages.po +0 -490
- package/src/assets/app/locales/fr/messages.po +0 -490
- package/src/assets/app/locales/ga/messages.po +0 -490
- package/src/assets/app/locales/gl/messages.po +0 -490
- package/src/assets/app/locales/hi/messages.po +0 -490
- package/src/assets/app/locales/hu/messages.po +0 -490
- package/src/assets/app/locales/ia/messages.po +0 -490
- package/src/assets/app/locales/id/messages.po +0 -490
- package/src/assets/app/locales/it/messages.po +0 -490
- package/src/assets/app/locales/ja/messages.po +0 -490
- package/src/assets/app/locales/km/messages.po +0 -490
- package/src/assets/app/locales/ko/messages.po +0 -490
- package/src/assets/app/locales/load.ts +0 -8
- package/src/assets/app/locales/locale-context.ts +0 -19
- package/src/assets/app/locales/locale-provider.tsx +0 -112
- package/src/assets/app/locales/locale-selector.tsx +0 -58
- package/src/assets/app/locales/locales.ts +0 -168
- package/src/assets/app/locales/ne/messages.po +0 -490
- package/src/assets/app/locales/nl/messages.po +0 -490
- package/src/assets/app/locales/pl/messages.po +0 -490
- package/src/assets/app/locales/pt-BR/messages.po +0 -490
- package/src/assets/app/locales/ro/messages.po +0 -490
- package/src/assets/app/locales/ru/messages.po +0 -490
- package/src/assets/app/locales/sv/messages.po +0 -490
- package/src/assets/app/locales/th/messages.po +0 -490
- package/src/assets/app/locales/tr/messages.po +0 -490
- package/src/assets/app/locales/uk/messages.po +0 -490
- package/src/assets/app/locales/vi/messages.po +0 -490
- package/src/assets/app/locales/zh-CN/messages.po +0 -490
- package/src/assets/app/locales/zh-HK/messages.po +0 -490
- package/src/assets/app/locales/zh-TW/messages.po +0 -490
- package/src/assets/app/main.css +0 -33
- package/src/assets/app/main.tsx +0 -44
- package/src/assets/app/views/authorize/accept/accept-form.tsx +0 -150
- package/src/assets/app/views/authorize/accept/accept-view.tsx +0 -70
- package/src/assets/app/views/authorize/authorize-view.tsx +0 -180
- package/src/assets/app/views/authorize/reset-password/reset-password-confirm-form.tsx +0 -88
- package/src/assets/app/views/authorize/reset-password/reset-password-request-form.tsx +0 -80
- package/src/assets/app/views/authorize/reset-password/reset-password-view.tsx +0 -127
- package/src/assets/app/views/authorize/sign-in/sign-in-form.tsx +0 -242
- package/src/assets/app/views/authorize/sign-in/sign-in-picker.tsx +0 -116
- package/src/assets/app/views/authorize/sign-in/sign-in-view.tsx +0 -145
- package/src/assets/app/views/authorize/sign-up/sign-up-account-form.tsx +0 -142
- package/src/assets/app/views/authorize/sign-up/sign-up-disclaimer.tsx +0 -51
- package/src/assets/app/views/authorize/sign-up/sign-up-handle-form.tsx +0 -287
- package/src/assets/app/views/authorize/sign-up/sign-up-hcaptcha-form.tsx +0 -108
- package/src/assets/app/views/authorize/sign-up/sign-up-view.tsx +0 -158
- package/src/assets/app/views/authorize/welcome/welcome-view.tsx +0 -56
- package/src/assets/app/views/error/error-view.tsx +0 -31
- package/src/assets/asset.ts +0 -9
- package/src/assets/index.ts +0 -86
- package/tailwind.config.js +0 -31
- package/tsconfig.frontend.json +0 -11
- package/tsconfig.frontend.tsbuildinfo +0 -1
- package/tsconfig.tools.json +0 -8
- package/tsconfig.tools.tsbuildinfo +0 -1
- package/vite.config.mjs +0 -16
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# @atproto/oauth-provider
|
2
2
|
|
3
|
+
## 0.6.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#3645](https://github.com/bluesky-social/atproto/pull/3645) [`49528e83d`](https://github.com/bluesky-social/atproto/commit/49528e83daee8d91c1956b13cc73e9c2b79b6b10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Remove onSignupHcaptchaResult hook
|
8
|
+
|
9
|
+
- [#3645](https://github.com/bluesky-social/atproto/pull/3645) [`49528e83d`](https://github.com/bluesky-social/atproto/commit/49528e83daee8d91c1956b13cc73e9c2b79b6b10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow `onSignedUp` hook to access hcaptcha result data.
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [#3645](https://github.com/bluesky-social/atproto/pull/3645) [`49528e83d`](https://github.com/bluesky-social/atproto/commit/49528e83daee8d91c1956b13cc73e9c2b79b6b10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Fix hcaptcha verification based on score
|
14
|
+
|
15
|
+
- [#3627](https://github.com/bluesky-social/atproto/pull/3627) [`9332c0f31`](https://github.com/bluesky-social/atproto/commit/9332c0f315bb7270bf346f69ecb178481ed07764) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Fix CSP directives for assets loaded through an `src`.
|
16
|
+
|
17
|
+
- [#3627](https://github.com/bluesky-social/atproto/pull/3627) [`9332c0f31`](https://github.com/bluesky-social/atproto/commit/9332c0f315bb7270bf346f69ecb178481ed07764) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Make CSP header shorter (by combining <script> tags in the backend, when possible)
|
18
|
+
|
19
|
+
- [#3627](https://github.com/bluesky-social/atproto/pull/3627) [`9332c0f31`](https://github.com/bluesky-social/atproto/commit/9332c0f315bb7270bf346f69ecb178481ed07764) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Disable un-necessary pre-loading of assets
|
20
|
+
|
21
|
+
- [#3640](https://github.com/bluesky-social/atproto/pull/3640) [`cc4122652`](https://github.com/bluesky-social/atproto/commit/cc4122652ed42ba55826c019d0ec57bf25df1ecd) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Split OAuth Provider's ui into its own package
|
22
|
+
|
23
|
+
- [#3627](https://github.com/bluesky-social/atproto/pull/3627) [`9332c0f31`](https://github.com/bluesky-social/atproto/commit/9332c0f315bb7270bf346f69ecb178481ed07764) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Fixes issue in internal HTML generation class
|
24
|
+
|
25
|
+
- [#3627](https://github.com/bluesky-social/atproto/pull/3627) [`9332c0f31`](https://github.com/bluesky-social/atproto/commit/9332c0f315bb7270bf346f69ecb178481ed07764) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Set `Cross-Origin-Embedder-Policy` to `unsafe-none` when HCaptcha is enabled
|
26
|
+
|
27
|
+
- [#3645](https://github.com/bluesky-social/atproto/pull/3645) [`49528e83d`](https://github.com/bluesky-social/atproto/commit/49528e83daee8d91c1956b13cc73e9c2b79b6b10) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Improve HCaptcha error reporting
|
28
|
+
|
29
|
+
- Updated dependencies [[`cc4122652`](https://github.com/bluesky-social/atproto/commit/cc4122652ed42ba55826c019d0ec57bf25df1ecd), [`cc4122652`](https://github.com/bluesky-social/atproto/commit/cc4122652ed42ba55826c019d0ec57bf25df1ecd), [`670b6b5de`](https://github.com/bluesky-social/atproto/commit/670b6b5de2bf91e6944761c98eb1126fb6a681ee)]:
|
30
|
+
- @atproto/oauth-provider-ui@0.0.2
|
31
|
+
- @atproto/oauth-provider-api@0.0.1
|
32
|
+
- @atproto/syntax@0.4.0
|
33
|
+
|
3
34
|
## 0.5.2
|
4
35
|
|
5
36
|
### Patch Changes
|
@@ -1,22 +1,24 @@
|
|
1
1
|
import { OAuthIssuerIdentifier } from '@atproto/oauth-types';
|
2
2
|
import { Client } from '../client/client.js';
|
3
3
|
import { DeviceId } from '../device/device-id.js';
|
4
|
-
import { HCaptchaClient } from '../lib/hcaptcha.js';
|
4
|
+
import { HCaptchaClient, HcaptchaVerifyResult } from '../lib/hcaptcha.js';
|
5
5
|
import { OAuthHooks, RequestMetadata } from '../oauth-hooks.js';
|
6
6
|
import { Customization } from '../oauth-provider.js';
|
7
7
|
import { Sub } from '../oidc/sub.js';
|
8
8
|
import { ClientAuth } from '../token/token-store.js';
|
9
|
-
import { Account, AccountInfo, AccountStore, ResetPasswordConfirmData, ResetPasswordRequestData } from './account-store.js';
|
9
|
+
import { Account, AccountInfo, AccountStore, ResetPasswordConfirmData, ResetPasswordRequestData, SignUpData } from './account-store.js';
|
10
10
|
import { SignInData } from './sign-in-data.js';
|
11
|
-
import {
|
11
|
+
import { SignUpInput } from './sign-up-input.js';
|
12
12
|
export declare class AccountManager {
|
13
13
|
protected readonly store: AccountStore;
|
14
14
|
protected readonly hooks: OAuthHooks;
|
15
15
|
protected readonly inviteCodeRequired: boolean;
|
16
16
|
protected readonly hcaptchaClient?: HCaptchaClient;
|
17
17
|
constructor(issuer: OAuthIssuerIdentifier, store: AccountStore, hooks: OAuthHooks, customization: Customization);
|
18
|
-
protected
|
19
|
-
|
18
|
+
protected processHcaptchaToken(input: SignUpInput, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<HcaptchaVerifyResult | undefined>;
|
19
|
+
protected enforceInviteCode(input: SignUpInput, _deviceId: DeviceId, _deviceMetadata: RequestMetadata): Promise<string | undefined>;
|
20
|
+
protected buildSignupData(input: SignUpInput, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<SignUpData>;
|
21
|
+
signUp(input: SignUpInput, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<AccountInfo>;
|
20
22
|
signIn(data: SignInData, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<AccountInfo>;
|
21
23
|
get(deviceId: DeviceId, sub: Sub): Promise<AccountInfo>;
|
22
24
|
addAuthorizedClient(deviceId: DeviceId, account: Account, client: Client, _clientAuth: ClientAuth): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,cAAc,
|
1
|
+
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAEtB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAGzE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EACxB,UAAU,EACX,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO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AAI,CAAC;IAOH,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAKhD,oBAAoB,CAAC,IAAI,EAAE,wBAAwB;IAMnD,oBAAoB,CAAC,IAAI,EAAE,wBAAwB;IAMnD,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrE"}
|
@@ -21,37 +21,46 @@ class AccountManager {
|
|
21
21
|
? new hcaptcha_js_1.HCaptchaClient(new URL(issuer).hostname, customization.hcaptcha)
|
22
22
|
: undefined;
|
23
23
|
}
|
24
|
-
async
|
25
|
-
|
26
|
-
|
27
|
-
throw new invalid_request_error_js_1.InvalidRequestError('Invite code is required');
|
24
|
+
async processHcaptchaToken(input, deviceId, deviceMetadata) {
|
25
|
+
if (!this.hcaptchaClient) {
|
26
|
+
return undefined;
|
28
27
|
}
|
29
|
-
if (
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
28
|
+
if (!input.hcaptchaToken) {
|
29
|
+
throw new invalid_request_error_js_1.InvalidRequestError('hCaptcha token is required');
|
30
|
+
}
|
31
|
+
const { allowed, result } = await this.hcaptchaClient
|
32
|
+
.verify('signup', input.hcaptchaToken, deviceMetadata.ipAddress, input.handle, deviceMetadata.userAgent)
|
33
|
+
.catch((err) => {
|
34
|
+
throw invalid_request_error_js_1.InvalidRequestError.from(err, 'hCaptcha verification failed');
|
35
|
+
});
|
36
|
+
if (!allowed) {
|
37
|
+
throw new invalid_request_error_js_1.InvalidRequestError('hCaptcha verification failed');
|
38
|
+
}
|
39
|
+
return result;
|
40
|
+
}
|
41
|
+
async enforceInviteCode(input, _deviceId, _deviceMetadata) {
|
42
|
+
if (!this.inviteCodeRequired) {
|
43
|
+
return undefined;
|
44
|
+
}
|
45
|
+
if (!input.inviteCode) {
|
46
|
+
throw new invalid_request_error_js_1.InvalidRequestError('Invite code is required');
|
45
47
|
}
|
48
|
+
return input.inviteCode;
|
49
|
+
}
|
50
|
+
async buildSignupData(input, deviceId, deviceMetadata) {
|
51
|
+
const [hcaptchaResult, inviteCode] = await Promise.all([
|
52
|
+
this.processHcaptchaToken(input, deviceId, deviceMetadata),
|
53
|
+
this.enforceInviteCode(input, deviceId, deviceMetadata),
|
54
|
+
]);
|
55
|
+
return { ...input, hcaptchaResult, inviteCode };
|
56
|
+
}
|
57
|
+
async signUp(input, deviceId, deviceMetadata) {
|
46
58
|
await (0, function_js_1.callAsync)(this.hooks.onSignupAttempt, {
|
47
|
-
|
59
|
+
input,
|
48
60
|
deviceId,
|
49
61
|
deviceMetadata,
|
50
|
-
hcaptchaResult,
|
51
62
|
});
|
52
|
-
|
53
|
-
async signUp(data, deviceId, deviceMetadata) {
|
54
|
-
await this.verifySignupData(data, deviceId, deviceMetadata);
|
63
|
+
const data = await this.buildSignupData(input, deviceId, deviceMetadata);
|
55
64
|
// Mitigation against brute forcing email of users.
|
56
65
|
// @TODO Add rate limit to all the OAuth routes.
|
57
66
|
return (0, time_js_1.constantTime)(BRUTE_FORCE_MITIGATION_DELAY, async () => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":";;;AAAA,sDAG6B;AAG7B,iFAAwE;AACxE,oDAAyE;AACzE,yDAAmD;AACnD,iDAAkD;
|
1
|
+
{"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":";;;AAAA,sDAG6B;AAG7B,iFAAwE;AACxE,oDAAyE;AACzE,yDAAmD;AACnD,iDAAkD;AAgBlD,MAAM,8BAA8B,GAAG,GAAG,CAAA;AAC1C,MAAM,4BAA4B,GAAG,GAAG,CAAA;AAExC,MAAa,cAAc;IAMJ;IACA;IANF,kBAAkB,CAAS;IAC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AAC,wBAAwB,CAAC,MAAc;QAClD,OAAO,IAAA,sBAAY,EAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;YAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAtMD,wCAsMC"}
|
@@ -1,16 +1,19 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { ClientId } from '../client/client-id.js';
|
3
3
|
import { DeviceId } from '../device/device-id.js';
|
4
|
+
import { HcaptchaVerifyResult } from '../lib/hcaptcha.js';
|
4
5
|
import { Awaitable } from '../lib/util/type.js';
|
5
6
|
import { HandleUnavailableError, InvalidRequestError, SecondAuthenticationFactorRequiredError } from '../oauth-errors.js';
|
6
7
|
import { Sub } from '../oidc/sub.js';
|
7
8
|
import { Account } from './account.js';
|
9
|
+
import { SignUpInput } from './sign-up-input.js';
|
8
10
|
export declare const oldPasswordSchema: z.ZodString;
|
9
11
|
export declare const newPasswordSchema: z.ZodString;
|
10
12
|
export declare const tokenSchema: z.ZodString;
|
11
13
|
export declare const handleSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
12
14
|
export declare const emailSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
13
15
|
export declare const inviteCodeSchema: z.ZodString;
|
16
|
+
export type InviteCode = z.infer<typeof inviteCodeSchema>;
|
14
17
|
export declare const authenticateAccountDataSchema: z.ZodObject<{
|
15
18
|
locale: z.ZodString;
|
16
19
|
username: z.ZodString;
|
@@ -80,6 +83,10 @@ export type AccountInfo = {
|
|
80
83
|
account: Account;
|
81
84
|
info: DeviceAccountInfo;
|
82
85
|
};
|
86
|
+
export type SignUpData = SignUpInput & {
|
87
|
+
hcaptchaResult?: HcaptchaVerifyResult;
|
88
|
+
inviteCode?: InviteCode;
|
89
|
+
};
|
83
90
|
export interface AccountStore {
|
84
91
|
/**
|
85
92
|
* @throws {HandleUnavailableError} - To indicate that the handle is already taken
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-store.d.ts","sourceRoot":"","sources":["../../src/account/account-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;
|
1
|
+
{"version":3,"file":"account-store.d.ts","sourceRoot":"","sources":["../../src/account/account-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAyB,MAAM,qBAAqB,CAAA;AACtE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,uCAAuC,EACxC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,eAAO,MAAM,iBAAiB,aAAoB,CAAA;AAClD,eAAO,MAAM,iBAAiB,aAAoB,CAAA;AAClD,eAAO,MAAM,WAAW,aAEqC,CAAA;AAC7D,eAAO,MAAM,YAAY,yEAcI,CAAA;AAC7B,eAAO,MAAM,WAAW,uGAYoB,CAAA;AAC5C,eAAO,MAAM,gBAAgB,aAAoB,CAAA;AACjD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;EAO/B,CAA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,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,GACjB,SAAS,CAAC,IAAI,CAAC,CAAA;IAElB;;;OAGG;IACH,gBAAgB,CACd,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,OAAO,GAChB,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAE/B;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC7E,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAElE;;;OAGG;IACH,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;IAEhE,oBAAoB,CAAC,IAAI,EAAE,wBAAwB,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IACrE,oBAAoB,CAAC,IAAI,EAAE,wBAAwB,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAErE;;OAEG;IACH,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;CAC1D;AAED,eAAO,MAAM,cAAc,yHAWzB,CAAA;AAEF,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,CAAC,GAAG,YAAY,CAKrE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-store.js","sourceRoot":"","sources":["../../src/account/account-store.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"account-store.js","sourceRoot":"","sources":["../../src/account/account-store.ts"],"names":[],"mappings":";;;AA+LA,wCAKC;AApMD,2CAA4C;AAC5C,6EAA+D;AAC/D,6BAAuB;AACvB,4CAAoE;AAIpE,gDAA+C;AAC/C,iDAAsE;AACtE,wDAI2B;AA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BAAc,EAAC,cAAc,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
@@ -1,12 +1,2 @@
|
|
1
|
-
|
2
|
-
import { Sub } from '../oidc/sub.js';
|
3
|
-
export type Account = Simplify<{
|
4
|
-
sub: Sub;
|
5
|
-
aud: string | [string, ...string[]];
|
6
|
-
preferred_username?: string;
|
7
|
-
email?: string;
|
8
|
-
email_verified?: boolean;
|
9
|
-
picture?: string;
|
10
|
-
name?: string;
|
11
|
-
}>;
|
1
|
+
export type { Account } from '@atproto/oauth-provider-api';
|
12
2
|
//# sourceMappingURL=account.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { z } from 'zod';
|
2
|
-
export declare const
|
2
|
+
export declare const signUpInputSchema: z.ZodObject<z.objectUtil.extendShape<{
|
3
3
|
locale: z.ZodString;
|
4
4
|
handle: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
5
5
|
email: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
@@ -22,5 +22,5 @@ export declare const signUpDataSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
22
22
|
inviteCode?: string | undefined;
|
23
23
|
hcaptchaToken?: string | undefined;
|
24
24
|
}>;
|
25
|
-
export type
|
26
|
-
//# sourceMappingURL=sign-up-
|
25
|
+
export type SignUpInput = z.TypeOf<typeof signUpInputSchema>;
|
26
|
+
//# sourceMappingURL=sign-up-input.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign-up-input.d.ts","sourceRoot":"","sources":["../../src/account/sign-up-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAInB,CAAA;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.signUpInputSchema = void 0;
|
4
4
|
const hcaptcha_js_1 = require("../lib/hcaptcha.js");
|
5
5
|
const account_store_js_1 = require("./account-store.js");
|
6
|
-
exports.
|
6
|
+
exports.signUpInputSchema = account_store_js_1.createAccountDataSchema
|
7
7
|
.extend({
|
8
8
|
hcaptchaToken: hcaptcha_js_1.hcaptchaTokenSchema.optional(),
|
9
9
|
})
|
10
10
|
.strict();
|
11
|
-
//# sourceMappingURL=sign-up-
|
11
|
+
//# sourceMappingURL=sign-up-input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign-up-input.js","sourceRoot":"","sources":["../../src/account/sign-up-input.ts"],"names":[],"mappings":";;;AACA,oDAAwD;AACxD,yDAA4D;AAE/C,QAAA,iBAAiB,GAAG,0CAAuB;KACrD,MAAM,CAAC;IACN,aAAa,EAAE,iCAAmB,CAAC,QAAQ,EAAE;CAC9C,CAAC;KACD,MAAM,EAAE,CAAA"}
|
@@ -1,3 +1,5 @@
|
|
1
1
|
import { Middleware } from '../lib/http/index.js';
|
2
|
+
export declare const ASSETS_URL_PREFIX = "/@atproto/oauth-provider/~assets/";
|
3
|
+
export declare function buildAssetUrl(filename: string): string;
|
2
4
|
export declare function authorizeAssetsMiddleware(): Middleware;
|
3
5
|
//# sourceMappingURL=assets-middleware.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"assets-middleware.d.ts","sourceRoot":"","sources":["../../src/assets/assets-middleware.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"assets-middleware.d.ts","sourceRoot":"","sources":["../../src/assets/assets-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAIX,MAAM,sBAAsB,CAAA;AAE7B,eAAO,MAAM,iBAAiB,sCAAsC,CAAA;AAEpE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,yBAAyB,IAAI,UAAU,CA6BtD"}
|
@@ -1,28 +1,26 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ASSETS_URL_PREFIX = void 0;
|
4
|
+
exports.buildAssetUrl = buildAssetUrl;
|
3
5
|
exports.authorizeAssetsMiddleware = authorizeAssetsMiddleware;
|
6
|
+
const oauth_provider_ui_1 = require("@atproto/oauth-provider-ui");
|
4
7
|
const index_js_1 = require("../lib/http/index.js");
|
5
|
-
|
8
|
+
exports.ASSETS_URL_PREFIX = '/@atproto/oauth-provider/~assets/';
|
9
|
+
function buildAssetUrl(filename) {
|
10
|
+
return `${exports.ASSETS_URL_PREFIX}${encodeURIComponent(filename)}`;
|
11
|
+
}
|
6
12
|
function authorizeAssetsMiddleware() {
|
7
13
|
return async function assetsMiddleware(req, res, next) {
|
8
14
|
if (req.method !== 'GET' && req.method !== 'HEAD')
|
9
15
|
return next();
|
10
|
-
if (!req.url?.startsWith(
|
11
|
-
return next();
|
12
|
-
const [pathname, query] = req.url.split('?', 2);
|
13
|
-
if (query)
|
16
|
+
if (!req.url?.startsWith(exports.ASSETS_URL_PREFIX))
|
14
17
|
return next();
|
15
|
-
const filename =
|
18
|
+
const filename = req.url.slice(exports.ASSETS_URL_PREFIX.length);
|
16
19
|
if (!filename)
|
17
20
|
return next();
|
18
|
-
|
19
|
-
|
20
|
-
asset = (0, index_js_2.getAsset)(filename);
|
21
|
-
}
|
22
|
-
catch {
|
23
|
-
// Filename not found or not valid
|
21
|
+
const asset = oauth_provider_ui_1.assets.get(filename);
|
22
|
+
if (!asset)
|
24
23
|
return next();
|
25
|
-
}
|
26
24
|
try {
|
27
25
|
// Allow "null" (ie. no header) to allow loading assets outside of a
|
28
26
|
// fetch context (not from a web page).
|
@@ -37,7 +35,7 @@ function authorizeAssetsMiddleware() {
|
|
37
35
|
}
|
38
36
|
res.setHeader('ETag', asset.sha256);
|
39
37
|
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
|
40
|
-
(0, index_js_1.writeStream)(res, asset.
|
38
|
+
(0, index_js_1.writeStream)(res, asset.stream(), { contentType: asset.mime });
|
41
39
|
};
|
42
40
|
}
|
43
41
|
//# sourceMappingURL=assets-middleware.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"assets-middleware.js","sourceRoot":"","sources":["../../src/assets/assets-middleware.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"assets-middleware.js","sourceRoot":"","sources":["../../src/assets/assets-middleware.ts"],"names":[],"mappings":";;;AAUA,sCAEC;AAED,8DA6BC;AA3CD,kEAAmD;AACnD,mDAK6B;AAEhB,QAAA,iBAAiB,GAAG,mCAAmC,CAAA;AAEpE,SAAgB,aAAa,CAAC,QAAgB;IAC5C,OAAO,GAAG,yBAAiB,GAAG,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC9D,CAAC;AAED,SAAgB,yBAAyB;IACvC,OAAO,KAAK,UAAU,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI;QACnD,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,IAAI,EAAE,CAAA;QAChE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,yBAAiB,CAAC;YAAE,OAAO,IAAI,EAAE,CAAA;QAE1D,MAAM,QAAQ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${string}'` | `'nonce-${string}'` | `'unsafe-inline'` | `'unsafe-eval'` | `'strict-dynamic'` | `'report-sample'` | `'unsafe-hashes'`;
|
1
|
+
import { CombinedTuple, Simplify } from '../util/type.js';
|
2
|
+
export type CspValue = `data:` | `http:${string}` | `https:${string}` | `'none'` | `'self'` | `'sha256-${string}'` | `'nonce-${string}'` | `'unsafe-inline'` | `'unsafe-eval'` | `'strict-dynamic'` | `'report-sample'` | `'unsafe-hashes'`;
|
3
3
|
declare const STRING_DIRECTIVES: readonly ["base-uri"];
|
4
4
|
declare const BOOLEAN_DIRECTIVES: readonly ["upgrade-insecure-requests", "block-all-mixed-content"];
|
5
5
|
declare const ARRAY_DIRECTIVES: readonly ["connect-src", "default-src", "form-action", "frame-ancestors", "frame-src", "img-src", "script-src", "style-src"];
|
@@ -8,11 +8,10 @@ export type CspConfig = Simplify<{
|
|
8
8
|
} & {
|
9
9
|
[K in (typeof STRING_DIRECTIVES)[number]]?: CspValue;
|
10
10
|
} & {
|
11
|
-
[K in (typeof ARRAY_DIRECTIVES)[number]]?:
|
11
|
+
[K in (typeof ARRAY_DIRECTIVES)[number]]?: Iterable<CspValue>;
|
12
12
|
}>;
|
13
13
|
export declare function buildCsp(config: CspConfig): string;
|
14
|
-
export declare function mergeCsp(
|
15
|
-
export declare function
|
16
|
-
export declare function mergeCsp(a?: CspConfig, b?: CspConfig): CspConfig | undefined;
|
14
|
+
export declare function mergeCsp<C extends (CspConfig | null | undefined)[]>(...configs: C): CombinedTuple<C>;
|
15
|
+
export declare function combineCsp(a: CspConfig, b: CspConfig): CspConfig;
|
17
16
|
export {};
|
18
17
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/csp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../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ildCsp;
|
4
4
|
exports.mergeCsp = mergeCsp;
|
5
|
+
exports.combineCsp = combineCsp;
|
5
6
|
const STRING_DIRECTIVES = ['base-uri'];
|
6
7
|
const BOOLEAN_DIRECTIVES = [
|
7
8
|
'upgrade-insecure-requests',
|
@@ -29,21 +30,23 @@ function buildCsp(config) {
|
|
29
30
|
values.push(`${name} ${config[name]}`);
|
30
31
|
}
|
31
32
|
for (const name of ARRAY_DIRECTIVES) {
|
32
|
-
|
33
|
-
|
33
|
+
// Remove duplicate values by using a Set
|
34
|
+
const val = config[name] ? new Set(config[name]) : undefined;
|
35
|
+
if (val?.size)
|
36
|
+
values.push(`${name} ${Array.from(val).join(' ')}`);
|
34
37
|
}
|
35
38
|
return values.join('; ');
|
36
39
|
}
|
37
|
-
function mergeCsp(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return a;
|
40
|
+
function mergeCsp(...configs) {
|
41
|
+
return configs.filter((v) => v != null).reduce(combineCsp);
|
42
|
+
}
|
43
|
+
function combineCsp(a, b) {
|
42
44
|
const result = {};
|
43
45
|
for (const name of BOOLEAN_DIRECTIVES) {
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
// @NOTE b (if defined) takes precedence
|
47
|
+
const value = b[name] ?? a[name];
|
48
|
+
if (value != null)
|
49
|
+
result[name] = value;
|
47
50
|
}
|
48
51
|
for (const name of STRING_DIRECTIVES) {
|
49
52
|
if (a[name] || b[name]) {
|
@@ -64,7 +67,7 @@ function mergeCsp(a, b) {
|
|
64
67
|
result[name] = [...set];
|
65
68
|
}
|
66
69
|
else if (a[name] || b[name]) {
|
67
|
-
result[name] =
|
70
|
+
result[name] = a[name] || b[name];
|
68
71
|
}
|
69
72
|
}
|
70
73
|
return result;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/csp/index.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/csp/index.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gBAAE,KAAK,MAAM,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC;oBAAE,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YACxD,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACnD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA;QACzB,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/lib/hcaptcha.d.ts
CHANGED
@@ -16,9 +16,11 @@ export declare const hcaptchaConfigSchema: z.ZodObject<{
|
|
16
16
|
*/
|
17
17
|
tokenSalt: z.ZodString;
|
18
18
|
/**
|
19
|
-
* The risk score
|
19
|
+
* The risk score above which the user is considered a threat and will be
|
20
20
|
* denied access. This will be ignored if the enterprise features are not
|
21
21
|
* available.
|
22
|
+
*
|
23
|
+
* Note: Score values ranges from 0.0 (no risk) to 1.0 (confirmed threat).
|
22
24
|
*/
|
23
25
|
scoreThreshold: z.ZodOptional<z.ZodNumber>;
|
24
26
|
}, "strip", z.ZodTypeAny, {
|
@@ -171,7 +173,7 @@ export declare class HCaptchaClient {
|
|
171
173
|
tags?: string[] | undefined;
|
172
174
|
};
|
173
175
|
}>;
|
174
|
-
isAllowed({ success, hostname, score }: HcaptchaVerifyResult): boolean;
|
175
|
-
hashToken(value: string): string;
|
176
|
+
protected isAllowed({ success, hostname, score }: HcaptchaVerifyResult): boolean;
|
177
|
+
protected hashToken(value: string): string;
|
176
178
|
}
|
177
179
|
//# sourceMappingURL=hcaptcha.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hcaptcha.d.ts","sourceRoot":"","sources":["../../src/lib/hcaptcha.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,KAAK,EACL,UAAU,EAKX,MAAM,qBAAqB,CAAA;AAG5B,eAAO,MAAM,mBAAmB,aAAoB,CAAA;AACpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;IAC/B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH
|
1
|
+
{"version":3,"file":"hcaptcha.d.ts","sourceRoot":"","sources":["../../src/lib/hcaptcha.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,KAAK,EACL,UAAU,EAKX,MAAM,qBAAqB,CAAA;AAG5B,eAAO,MAAM,mBAAmB,aAAoB,CAAA;AACpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;IAC/B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;;;;OAMG;;;;;;;;;;;;EAEH,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,0BAA0B;IACrC;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAQ7E,qBAAa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;gBAEjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,cAAc,EACvC,KAAK,GAAE,KAAwB;IAKpB,MAAM,CACjB,YAAY,EAAE,OAAO,GAAG,QAAQ,EAChC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;IA2BpB,SAAS,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,oBAAoB;IActE,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM;CAMlC"}
|
package/dist/lib/hcaptcha.js
CHANGED
@@ -20,9 +20,11 @@ exports.hcaptchaConfigSchema = zod_1.z.object({
|
|
20
20
|
*/
|
21
21
|
tokenSalt: zod_1.z.string().min(1),
|
22
22
|
/**
|
23
|
-
* The risk score
|
23
|
+
* The risk score above which the user is considered a threat and will be
|
24
24
|
* denied access. This will be ignored if the enterprise features are not
|
25
25
|
* available.
|
26
|
+
*
|
27
|
+
* Note: Score values ranges from 0.0 (no risk) to 1.0 (confirmed threat).
|
26
28
|
*/
|
27
29
|
scoreThreshold: zod_1.z.number().optional(),
|
28
30
|
});
|
@@ -140,9 +142,10 @@ class HCaptchaClient {
|
|
140
142
|
// generated for the same siteKey, but on another domain.
|
141
143
|
hostname === this.hostname &&
|
142
144
|
// Ignore if enterprise feature is not enabled
|
143
|
-
score
|
144
|
-
|
145
|
-
|
145
|
+
(score == null ||
|
146
|
+
// Ignore if disabled through config
|
147
|
+
this.config.scoreThreshold == null ||
|
148
|
+
score < this.config.scoreThreshold));
|
146
149
|
}
|
147
150
|
hashToken(value) {
|
148
151
|
const hash = (0, node_crypto_1.createHash)('sha256');
|
package/dist/lib/hcaptcha.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hcaptcha.js","sourceRoot":"","sources":["../../src/lib/hcaptcha.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,6BAAuB;AACvB,+CAO4B;AAC5B,6CAAyC;AAE5B,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAGvC,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C;;OAEG;IACH,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B;;OAEG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B
|
1
|
+
{"version":3,"file":"hcaptcha.js","sourceRoot":"","sources":["../../src/lib/hcaptcha.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,6BAAuB;AACvB,+CAO4B;AAC5B,6CAAyC;AAE5B,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAGvC,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C;;OAEG;IACH,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B;;OAEG;IACH,SAAS,EAAE,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
7
6
|
export type Attrs = Record<string, boolean | string | undefined>;
|
8
7
|
/**
|
@@ -27,6 +26,7 @@ export type BuildDocumentOptions = {
|
|
27
26
|
base?: URL;
|
28
27
|
meta?: readonly MetaAttrs[];
|
29
28
|
links?: readonly LinkAttrs[];
|
29
|
+
preloads?: readonly AssetRef[];
|
30
30
|
head?: HtmlValue;
|
31
31
|
title?: HtmlValue;
|
32
32
|
scripts?: readonly (Html | AssetRef)[];
|
@@ -34,6 +34,6 @@ export type BuildDocumentOptions = {
|
|
34
34
|
body?: HtmlValue;
|
35
35
|
bodyAttrs?: Attrs;
|
36
36
|
};
|
37
|
-
export declare const buildDocument: ({ htmlAttrs, head, title, body, bodyAttrs, base, meta, links, scripts, styles, }: BuildDocumentOptions) => Html;
|
37
|
+
export declare const buildDocument: ({ htmlAttrs, head, title, body, bodyAttrs, base, meta, links, preloads, scripts, styles, }: BuildDocumentOptions) => Html;
|
38
38
|
export {};
|
39
39
|
//# sourceMappingURL=build-document.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-document.d.ts","sourceRoot":"","sources":["../../../src/lib/html/build-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"build-document.d.ts","sourceRoot":"","sources":["../../../src/lib/html/build-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,CAAA;A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