@atproto/oauth-provider 0.5.1 → 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 +39 -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 +13 -5
- package/dist/account/account-store.d.ts.map +1 -1
- package/dist/account/account-store.js +24 -8
- 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} +5 -5
- 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/errors/invalid-invite-code-error.d.ts +5 -0
- package/dist/errors/invalid-invite-code-error.d.ts.map +1 -0
- package/dist/errors/invalid-invite-code-error.js +11 -0
- package/dist/errors/invalid-invite-code-error.js.map +1 -0
- package/dist/errors/oauth-error.d.ts +2 -2
- package/dist/errors/oauth-error.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-errors.d.ts +1 -0
- package/dist/oauth-errors.d.ts.map +1 -1
- package/dist/oauth-errors.js +3 -1
- package/dist/oauth-errors.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.d.ts.map +1 -1
- package/dist/oauth-provider.js +26 -25
- 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 -39
- package/src/account/account-manager.ts +55 -34
- package/src/account/account-store.ts +29 -6
- 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/errors/invalid-invite-code-error.ts +10 -0
- package/src/errors/oauth-error.ts +1 -1
- 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-errors.ts +1 -0
- package/src/oauth-hooks.ts +4 -25
- package/src/oauth-provider.ts +40 -34
- 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-ItwwtJ8r.js +0 -36
- package/dist/assets/app/index-ItwwtJ8r.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-CSatvmRR.css +0 -3
- package/dist/assets/app/main-CSatvmRR.js +0 -306
- package/dist/assets/app/main-CSatvmRR.js.map +0 -1
- package/dist/assets/app/messages-BQeltXSF.js +0 -4
- package/dist/assets/app/messages-BQeltXSF.js.map +0 -1
- package/dist/assets/app/messages-BQkEhfjg.js +0 -4
- package/dist/assets/app/messages-BQkEhfjg.js.map +0 -1
- package/dist/assets/app/messages-BUjKj_UJ.js +0 -4
- package/dist/assets/app/messages-BUjKj_UJ.js.map +0 -1
- package/dist/assets/app/messages-BWIQa8fO.js +0 -4
- package/dist/assets/app/messages-BWIQa8fO.js.map +0 -1
- package/dist/assets/app/messages-BaNVb0bp.js +0 -4
- package/dist/assets/app/messages-BaNVb0bp.js.map +0 -1
- package/dist/assets/app/messages-BaizVXcF.js +0 -4
- package/dist/assets/app/messages-BaizVXcF.js.map +0 -1
- package/dist/assets/app/messages-BfoClA1Y.js +0 -4
- package/dist/assets/app/messages-BfoClA1Y.js.map +0 -1
- package/dist/assets/app/messages-BsKGDZnC.js +0 -4
- package/dist/assets/app/messages-BsKGDZnC.js.map +0 -1
- package/dist/assets/app/messages-Bu-TJhml.js +0 -4
- package/dist/assets/app/messages-Bu-TJhml.js.map +0 -1
- package/dist/assets/app/messages-BvOKnBQk.js +0 -4
- package/dist/assets/app/messages-BvOKnBQk.js.map +0 -1
- package/dist/assets/app/messages-BxDzCiWz.js +0 -4
- package/dist/assets/app/messages-BxDzCiWz.js.map +0 -1
- package/dist/assets/app/messages-CDgFOy4S.js +0 -4
- package/dist/assets/app/messages-CDgFOy4S.js.map +0 -1
- package/dist/assets/app/messages-CLbTz0o9.js +0 -4
- package/dist/assets/app/messages-CLbTz0o9.js.map +0 -1
- package/dist/assets/app/messages-CNwSh0t7.js +0 -4
- package/dist/assets/app/messages-CNwSh0t7.js.map +0 -1
- package/dist/assets/app/messages-CSMNJ6P8.js +0 -4
- package/dist/assets/app/messages-CSMNJ6P8.js.map +0 -1
- package/dist/assets/app/messages-CZQUw3mp.js +0 -4
- package/dist/assets/app/messages-CZQUw3mp.js.map +0 -1
- package/dist/assets/app/messages-CZT41oVp.js +0 -4
- package/dist/assets/app/messages-CZT41oVp.js.map +0 -1
- package/dist/assets/app/messages-C_b-d3t8.js +0 -4
- package/dist/assets/app/messages-C_b-d3t8.js.map +0 -1
- package/dist/assets/app/messages-C_u3MTc2.js +0 -4
- package/dist/assets/app/messages-C_u3MTc2.js.map +0 -1
- package/dist/assets/app/messages-Cn8nHZic.js +0 -4
- package/dist/assets/app/messages-Cn8nHZic.js.map +0 -1
- package/dist/assets/app/messages-CtDywJUm.js +0 -4
- package/dist/assets/app/messages-CtDywJUm.js.map +0 -1
- package/dist/assets/app/messages-CurtIjBF.js +0 -4
- package/dist/assets/app/messages-CurtIjBF.js.map +0 -1
- package/dist/assets/app/messages-Cv6zIbaP.js +0 -4
- package/dist/assets/app/messages-Cv6zIbaP.js.map +0 -1
- package/dist/assets/app/messages-D1eLQuPE.js +0 -4
- package/dist/assets/app/messages-D1eLQuPE.js.map +0 -1
- package/dist/assets/app/messages-D8vHEaYW.js +0 -4
- package/dist/assets/app/messages-D8vHEaYW.js.map +0 -1
- package/dist/assets/app/messages-DJ1Q4GeC.js +0 -4
- package/dist/assets/app/messages-DJ1Q4GeC.js.map +0 -1
- package/dist/assets/app/messages-DRL3exqd.js +0 -4
- package/dist/assets/app/messages-DRL3exqd.js.map +0 -1
- package/dist/assets/app/messages-DWLPQRTp.js +0 -4
- package/dist/assets/app/messages-DWLPQRTp.js.map +0 -1
- package/dist/assets/app/messages-DjVaE9YE.js +0 -4
- package/dist/assets/app/messages-DjVaE9YE.js.map +0 -1
- package/dist/assets/app/messages-DqpMfFJR.js +0 -4
- package/dist/assets/app/messages-DqpMfFJR.js.map +0 -1
- package/dist/assets/app/messages-ETjhJBEN.js +0 -4
- package/dist/assets/app/messages-ETjhJBEN.js.map +0 -1
- package/dist/assets/app/messages-EUKrgrGn.js +0 -4
- package/dist/assets/app/messages-EUKrgrGn.js.map +0 -1
- package/dist/assets/app/messages-QQrOUcPW.js +0 -4
- package/dist/assets/app/messages-QQrOUcPW.js.map +0 -1
- package/dist/assets/app/messages-e2QGqFL6.js +0 -4
- package/dist/assets/app/messages-e2QGqFL6.js.map +0 -1
- package/dist/assets/app/messages-p61py7gD.js +0 -4
- package/dist/assets/app/messages-p61py7gD.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 -73
- package/src/assets/app/components/forms/input-container.tsx +0 -107
- package/src/assets/app/components/forms/input-email-address.tsx +0 -66
- package/src/assets/app/components/forms/input-new-password.tsx +0 -62
- package/src/assets/app/components/forms/input-password.tsx +0 -88
- package/src/assets/app/components/forms/input-text.tsx +0 -76
- 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 -62
- 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 -267
- 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 -492
- package/src/assets/app/locales/ast/messages.po +0 -492
- package/src/assets/app/locales/ca/messages.po +0 -492
- package/src/assets/app/locales/da/messages.po +0 -492
- package/src/assets/app/locales/de/messages.po +0 -492
- package/src/assets/app/locales/el/messages.po +0 -492
- package/src/assets/app/locales/en/messages.po +0 -492
- package/src/assets/app/locales/en-GB/messages.po +0 -492
- package/src/assets/app/locales/es/messages.po +0 -492
- package/src/assets/app/locales/eu/messages.po +0 -492
- package/src/assets/app/locales/fi/messages.po +0 -492
- package/src/assets/app/locales/fr/messages.po +0 -492
- package/src/assets/app/locales/ga/messages.po +0 -492
- package/src/assets/app/locales/gl/messages.po +0 -492
- package/src/assets/app/locales/hi/messages.po +0 -492
- package/src/assets/app/locales/hu/messages.po +0 -492
- package/src/assets/app/locales/ia/messages.po +0 -492
- package/src/assets/app/locales/id/messages.po +0 -492
- package/src/assets/app/locales/it/messages.po +0 -492
- package/src/assets/app/locales/ja/messages.po +0 -492
- package/src/assets/app/locales/km/messages.po +0 -492
- package/src/assets/app/locales/ko/messages.po +0 -492
- 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 -492
- package/src/assets/app/locales/nl/messages.po +0 -492
- package/src/assets/app/locales/pl/messages.po +0 -492
- package/src/assets/app/locales/pt-BR/messages.po +0 -492
- package/src/assets/app/locales/ro/messages.po +0 -492
- package/src/assets/app/locales/ru/messages.po +0 -492
- package/src/assets/app/locales/sv/messages.po +0 -492
- package/src/assets/app/locales/th/messages.po +0 -492
- package/src/assets/app/locales/tr/messages.po +0 -492
- package/src/assets/app/locales/uk/messages.po +0 -492
- package/src/assets/app/locales/vi/messages.po +0 -492
- package/src/assets/app/locales/zh-CN/messages.po +0 -492
- package/src/assets/app/locales/zh-HK/messages.po +0 -492
- package/src/assets/app/locales/zh-TW/messages.po +0 -492
- 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 -244
- 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 -140
- 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 -289
- 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,44 @@
|
|
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
|
+
|
34
|
+
## 0.5.2
|
35
|
+
|
36
|
+
### Patch Changes
|
37
|
+
|
38
|
+
- [#3622](https://github.com/bluesky-social/atproto/pull/3622) [`9e3eace8f`](https://github.com/bluesky-social/atproto/commit/9e3eace8f9c22141e6da80b7696cd3b3e7c38779) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Properly validate handle syntax during sign-up
|
39
|
+
|
40
|
+
- [#3621](https://github.com/bluesky-social/atproto/pull/3621) [`5ada66ceb`](https://github.com/bluesky-social/atproto/commit/5ada66ceb9d5b2c64f112bb62da0edc421c765bf) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow invite codes in any format
|
41
|
+
|
3
42
|
## 0.5.1
|
4
43
|
|
5
44
|
### 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,E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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;IAC3B,cAAc,CAAiB;IAElD,YACE,MAA6B,EACV,KAAmB,EACnB,KAAiB,EACpC,aAA4B;QAFT,UAAK,GAAL,KAAK,CAAc;QACnB,UAAK,GAAL,KAAK,CAAY;QAGpC,IAAI,CAAC,kBAAkB,GAAG,aAAa,CAAC,kBAAkB,KAAK,KAAK,CAAA;QACpE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,QAAQ;YAC1C,CAAC,CAAC,IAAI,4BAAc,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAA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qCAAuB,EAAC,MAAM,CAAC,EAAE,CAAC;YAAE,OAAM;QAE9C,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACxE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,QAAkB;QAClC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA;QAC7D,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,IAA8B;QAC9D,OAAO,IAAA,sBAAY,EAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;YAC7D,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,IAA8B;QAC9D,OAAO,IAAA,sBAAY,EAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;YAC7D,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,KAAK,CAAC,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,15 +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
|
-
export declare const handleSchema: z.ZodString
|
12
|
-
export declare const emailSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
13
|
+
export declare const handleSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
14
|
+
export declare const emailSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
15
|
+
export declare const inviteCodeSchema: z.ZodString;
|
16
|
+
export type InviteCode = z.infer<typeof inviteCodeSchema>;
|
13
17
|
export declare const authenticateAccountDataSchema: z.ZodObject<{
|
14
18
|
locale: z.ZodString;
|
15
19
|
username: z.ZodString;
|
@@ -29,8 +33,8 @@ export declare const authenticateAccountDataSchema: z.ZodObject<{
|
|
29
33
|
export type AuthenticateAccountData = z.TypeOf<typeof authenticateAccountDataSchema>;
|
30
34
|
export declare const createAccountDataSchema: z.ZodObject<{
|
31
35
|
locale: z.ZodString;
|
32
|
-
handle: z.ZodString
|
33
|
-
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
36
|
+
handle: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
37
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
34
38
|
password: z.ZodIntersection<z.ZodString, z.ZodString>;
|
35
39
|
inviteCode: z.ZodOptional<z.ZodString>;
|
36
40
|
}, "strict", z.ZodTypeAny, {
|
@@ -49,7 +53,7 @@ export declare const createAccountDataSchema: z.ZodObject<{
|
|
49
53
|
export type CreateAccountData = z.TypeOf<typeof createAccountDataSchema>;
|
50
54
|
export declare const resetPasswordRequestDataSchema: z.ZodObject<{
|
51
55
|
locale: z.ZodString;
|
52
|
-
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
56
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
53
57
|
}, "strict", z.ZodTypeAny, {
|
54
58
|
email: string;
|
55
59
|
locale: string;
|
@@ -79,6 +83,10 @@ export type AccountInfo = {
|
|
79
83
|
account: Account;
|
80
84
|
info: DeviceAccountInfo;
|
81
85
|
};
|
86
|
+
export type SignUpData = SignUpInput & {
|
87
|
+
hcaptchaResult?: HcaptchaVerifyResult;
|
88
|
+
inviteCode?: InviteCode;
|
89
|
+
};
|
82
90
|
export interface AccountStore {
|
83
91
|
/**
|
84
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;
|
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,gBAA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,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,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isAccountStore = exports.SecondAuthenticationFactorRequiredError = exports.InvalidRequestError = exports.HandleUnavailableError = exports.resetPasswordConfirmDataSchema = exports.resetPasswordRequestDataSchema = exports.createAccountDataSchema = exports.authenticateAccountDataSchema = exports.emailSchema = exports.handleSchema = exports.tokenSchema = exports.newPasswordSchema = exports.oldPasswordSchema = void 0;
|
3
|
+
exports.isAccountStore = exports.SecondAuthenticationFactorRequiredError = exports.InvalidRequestError = exports.HandleUnavailableError = exports.resetPasswordConfirmDataSchema = exports.resetPasswordRequestDataSchema = exports.createAccountDataSchema = exports.authenticateAccountDataSchema = exports.inviteCodeSchema = exports.emailSchema = exports.handleSchema = exports.tokenSchema = exports.newPasswordSchema = exports.oldPasswordSchema = void 0;
|
4
4
|
exports.asAccountStore = asAccountStore;
|
5
5
|
const address_1 = require("@hapi/address");
|
6
6
|
const disposable_email_domains_js_1 = require("disposable-email-domains-js");
|
7
7
|
const zod_1 = require("zod");
|
8
|
+
const syntax_1 = require("@atproto/syntax");
|
8
9
|
const locale_js_1 = require("../lib/locale.js");
|
9
10
|
const type_js_1 = require("../lib/util/type.js");
|
10
11
|
const oauth_errors_js_1 = require("../oauth-errors.js");
|
@@ -14,12 +15,25 @@ Object.defineProperty(exports, "SecondAuthenticationFactorRequiredError", { enum
|
|
14
15
|
// @NOTE Change the length here to force stronger passwords (through a reset)
|
15
16
|
exports.oldPasswordSchema = zod_1.z.string().min(1);
|
16
17
|
exports.newPasswordSchema = zod_1.z.string().min(8);
|
17
|
-
exports.tokenSchema = zod_1.z
|
18
|
+
exports.tokenSchema = zod_1.z
|
19
|
+
.string()
|
20
|
+
.regex(/^[A-Z2-7]{5}-[A-Z2-7]{5}$/, 'Invalid token format');
|
18
21
|
exports.handleSchema = zod_1.z
|
19
22
|
.string()
|
20
|
-
.
|
21
|
-
.
|
22
|
-
.
|
23
|
+
// @NOTE: We only check against validity towards ATProto's syntax. Additional
|
24
|
+
// rules may be imposed by the store implementation.
|
25
|
+
.superRefine((value, ctx) => {
|
26
|
+
try {
|
27
|
+
(0, syntax_1.ensureValidHandle)(value);
|
28
|
+
}
|
29
|
+
catch (err) {
|
30
|
+
ctx.addIssue({
|
31
|
+
code: zod_1.z.ZodIssueCode.custom,
|
32
|
+
message: err instanceof Error ? err.message : 'Invalid handle',
|
33
|
+
});
|
34
|
+
}
|
35
|
+
})
|
36
|
+
.transform(syntax_1.normalizeHandle);
|
23
37
|
exports.emailSchema = zod_1.z
|
24
38
|
.string()
|
25
39
|
.email()
|
@@ -31,13 +45,15 @@ exports.emailSchema = zod_1.z
|
|
31
45
|
})
|
32
46
|
.refine((email) => !(0, disposable_email_domains_js_1.isDisposableEmail)(email), {
|
33
47
|
message: 'Disposable email addresses are not allowed',
|
34
|
-
})
|
48
|
+
})
|
49
|
+
.transform((value) => value.toLowerCase());
|
50
|
+
exports.inviteCodeSchema = zod_1.z.string().min(1);
|
35
51
|
exports.authenticateAccountDataSchema = zod_1.z
|
36
52
|
.object({
|
37
53
|
locale: locale_js_1.localeSchema,
|
38
54
|
username: zod_1.z.string(),
|
39
55
|
password: exports.oldPasswordSchema,
|
40
|
-
emailOtp:
|
56
|
+
emailOtp: exports.tokenSchema.optional(),
|
41
57
|
})
|
42
58
|
.strict();
|
43
59
|
exports.createAccountDataSchema = zod_1.z
|
@@ -46,7 +62,7 @@ exports.createAccountDataSchema = zod_1.z
|
|
46
62
|
handle: exports.handleSchema,
|
47
63
|
email: exports.emailSchema,
|
48
64
|
password: zod_1.z.intersection(exports.oldPasswordSchema, exports.newPasswordSchema),
|
49
|
-
inviteCode: exports.
|
65
|
+
inviteCode: exports.inviteCodeSchema.optional(),
|
50
66
|
})
|
51
67
|
.strict();
|
52
68
|
exports.resetPasswordRequestDataSchema = zod_1.z
|
@@ -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;AAmGzB,uGAtGA,wCAAsB,OAsGA;AACtB,oGAtGA,qCAAmB,OAsGA;AACnB,wHAtGA,yDAAuC,OAsGA;AAhGzC,6EAA6E;AAChE,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACrC,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACrC,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,EAAE;KACR,KAAK,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAA;AAChD,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,EAAE;IACT,6EAA6E;IAC7E,oDAAoD;KACnD,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC1B,IAAI,CAAC;QACH,IAAA,0BAAiB,EAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB;SAC/D,CAAC,CAA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CAAC;IACN,KAAK,EAAE,mBAAW;IAClB,QAAQ,EAAE,OAAC,CAAC,YAAY,CAAC,yBAAiB,EAAE,yBAAiB,CAAC;CAC/D,CAAC;KACD,MAAM,EAAE,CAAA;AAkFE,QAAA,cAAc,GAAG,IAAA,+BAAqB,EAAe;IAChE,eAAe;IACf,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB,sBAAsB;IACtB,0BAA0B;CAC3B,CAAC,CAAA;AAEF,SAAgB,cAAc,CAAI,cAAiB;IACjD,IAAI,CAAC,cAAc,IAAI,CAAC,IAAA,sBAAc,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,8 +1,8 @@
|
|
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
|
-
handle: z.ZodString
|
5
|
-
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
4
|
+
handle: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
5
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
6
6
|
password: z.ZodIntersection<z.ZodString, z.ZodString>;
|
7
7
|
inviteCode: z.ZodOptional<z.ZodString>;
|
8
8
|
}, {
|
@@ -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-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AAI,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAClD,OAAO,KAAK,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAA;QACtC,CAAC;QAED,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;QACnC,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,qCAAqC,CAAC,CAAA;QAErE,IAAA,sBAAW,EAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"invalid-invite-code-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-invite-code-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAE7D,qBAAa,sBAAuB,SAAQ,mBAAmB;gBACjD,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM9C"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InvalidInviteCodeError = void 0;
|
4
|
+
const invalid_request_error_1 = require("./invalid-request-error");
|
5
|
+
class InvalidInviteCodeError extends invalid_request_error_1.InvalidRequestError {
|
6
|
+
constructor(details, cause) {
|
7
|
+
super('This invite code is invalid.' + (details ? ` ${details}` : ''), cause);
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.InvalidInviteCodeError = InvalidInviteCodeError;
|
11
|
+
//# sourceMappingURL=invalid-invite-code-error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"invalid-invite-code-error.js","sourceRoot":"","sources":["../../src/errors/invalid-invite-code-error.ts"],"names":[],"mappings":";;;AAAA,mEAA6D;AAE7D,MAAa,sBAAuB,SAAQ,2CAAmB;IAC7D,YAAY,OAAgB,EAAE,KAAe;QAC3C,KAAK,CACH,8BAA8B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/D,KAAK,CACN,CAAA;IACH,CAAC;CACF;AAPD,wDAOC"}
|
@@ -6,8 +6,8 @@ export declare class OAuthError extends Error {
|
|
6
6
|
constructor(error: string, error_description: string, status?: number, cause?: unknown);
|
7
7
|
get statusCode(): number;
|
8
8
|
toJSON(): {
|
9
|
-
|
10
|
-
|
9
|
+
error: string;
|
10
|
+
error_description: string;
|
11
11
|
};
|
12
12
|
}
|
13
13
|
//# sourceMappingURL=oauth-error.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-error.js","sourceRoot":"","sources":["../../src/errors/oauth-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAW,SAAQ,KAAK;IAIjB;IACA;IACA;IALX,MAAM,CAAS;IAEtB,YACkB,KAAa,EACb,iBAAyB,EACzB,SAAS,GAAG,EAC5B,KAAe;QAEf,KAAK,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QALnB,UAAK,GAAL,KAAK,CAAQ;QACb,sBAAiB,GAAjB,iBAAiB,CAAQ;QACzB,WAAM,GAAN,MAAM,CAAM;QAK5B,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QAEjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,GAAG,CAAA;IAC5B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;
|
1
|
+
{"version":3,"file":"oauth-error.js","sourceRoot":"","sources":["../../src/errors/oauth-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAW,SAAQ,KAAK;IAIjB;IACA;IACA;IALX,MAAM,CAAS;IAEtB,YACkB,KAAa,EACb,iBAAyB,EACzB,SAAS,GAAG,EAC5B,KAAe;QAEf,KAAK,CAAC,iBAAiB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QALnB,UAAK,GAAL,KAAK,CAAQ;QACb,sBAAiB,GAAjB,iBAAiB,CAAQ;QACzB,WAAM,GAAN,MAAM,CAAM;QAK5B,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QAEjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,GAAG,CAAA;IAC5B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAA;IACH,CAAC;CACF;AA3BD,gCA2BC"}
|
package/dist/lib/csp/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Simplify } from '../util/type.js';
|
2
|
-
export type CspValue = `data:` | `https:${string}` | `'none'` | `'self'` | `'sha256-${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":["../../../src/lib/csp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAEzD,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,QAAQ,MAAM,EAAE,GAChB,SAAS,MAAM,EAAE,GACjB,QAAQ,GACR,QAAQ,GACR,WAAW,MAAM,GAAG,GACpB,UAAU,MAAM,GAAG,GACnB,iB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