@atproto/oauth-provider 0.4.0 → 0.5.1
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/.linguirc +57 -0
- package/CHANGELOG.md +29 -0
- package/dist/account/account-manager.d.ts +17 -3
- package/dist/account/account-manager.d.ts.map +1 -1
- package/dist/account/account-manager.js +102 -8
- package/dist/account/account-manager.js.map +1 -1
- package/dist/account/account-store.d.ts +81 -15
- package/dist/account/account-store.d.ts.map +1 -1
- package/dist/account/account-store.js +70 -19
- package/dist/account/account-store.js.map +1 -1
- package/dist/account/sign-in-data.d.ts +28 -0
- package/dist/account/sign-in-data.d.ts.map +1 -0
- package/dist/account/sign-in-data.js +16 -0
- package/dist/account/sign-in-data.js.map +1 -0
- package/dist/account/sign-up-data.d.ts +26 -0
- package/dist/account/sign-up-data.d.ts.map +1 -0
- package/dist/account/sign-up-data.js +11 -0
- package/dist/account/sign-up-data.js.map +1 -0
- package/dist/assets/app/bundle-manifest.json +598 -6
- package/dist/assets/app/index-ItwwtJ8r.js +36 -0
- package/dist/assets/app/index-ItwwtJ8r.js.map +1 -0
- package/dist/assets/app/main-B_dNxQo_.js +4 -0
- package/dist/assets/app/main-B_dNxQo_.js.map +1 -0
- package/dist/assets/app/main-CSatvmRR.css +3 -0
- package/dist/assets/app/main-CSatvmRR.js +306 -0
- package/dist/assets/app/main-CSatvmRR.js.map +1 -0
- package/dist/assets/app/messages-BQeltXSF.js +4 -0
- package/dist/assets/app/messages-BQeltXSF.js.map +1 -0
- package/dist/assets/app/messages-BQkEhfjg.js +4 -0
- package/dist/assets/app/messages-BQkEhfjg.js.map +1 -0
- package/dist/assets/app/messages-BUjKj_UJ.js +4 -0
- package/dist/assets/app/messages-BUjKj_UJ.js.map +1 -0
- package/dist/assets/app/messages-BWIQa8fO.js +4 -0
- package/dist/assets/app/messages-BWIQa8fO.js.map +1 -0
- package/dist/assets/app/messages-BaNVb0bp.js +4 -0
- package/dist/assets/app/messages-BaNVb0bp.js.map +1 -0
- package/dist/assets/app/messages-BaizVXcF.js +4 -0
- package/dist/assets/app/messages-BaizVXcF.js.map +1 -0
- package/dist/assets/app/messages-BfoClA1Y.js +4 -0
- package/dist/assets/app/messages-BfoClA1Y.js.map +1 -0
- package/dist/assets/app/messages-BsKGDZnC.js +4 -0
- package/dist/assets/app/messages-BsKGDZnC.js.map +1 -0
- package/dist/assets/app/messages-Bu-TJhml.js +4 -0
- package/dist/assets/app/messages-Bu-TJhml.js.map +1 -0
- package/dist/assets/app/messages-BvOKnBQk.js +4 -0
- package/dist/assets/app/messages-BvOKnBQk.js.map +1 -0
- package/dist/assets/app/messages-BxDzCiWz.js +4 -0
- package/dist/assets/app/messages-BxDzCiWz.js.map +1 -0
- package/dist/assets/app/messages-CDgFOy4S.js +4 -0
- package/dist/assets/app/messages-CDgFOy4S.js.map +1 -0
- package/dist/assets/app/messages-CLbTz0o9.js +4 -0
- package/dist/assets/app/messages-CLbTz0o9.js.map +1 -0
- package/dist/assets/app/messages-CNwSh0t7.js +4 -0
- package/dist/assets/app/messages-CNwSh0t7.js.map +1 -0
- package/dist/assets/app/messages-CSMNJ6P8.js +4 -0
- package/dist/assets/app/messages-CSMNJ6P8.js.map +1 -0
- package/dist/assets/app/messages-CZQUw3mp.js +4 -0
- package/dist/assets/app/messages-CZQUw3mp.js.map +1 -0
- package/dist/assets/app/messages-CZT41oVp.js +4 -0
- package/dist/assets/app/messages-CZT41oVp.js.map +1 -0
- package/dist/assets/app/messages-C_b-d3t8.js +4 -0
- package/dist/assets/app/messages-C_b-d3t8.js.map +1 -0
- package/dist/assets/app/messages-C_u3MTc2.js +4 -0
- package/dist/assets/app/messages-C_u3MTc2.js.map +1 -0
- package/dist/assets/app/messages-Cn8nHZic.js +4 -0
- package/dist/assets/app/messages-Cn8nHZic.js.map +1 -0
- package/dist/assets/app/messages-CtDywJUm.js +4 -0
- package/dist/assets/app/messages-CtDywJUm.js.map +1 -0
- package/dist/assets/app/messages-CurtIjBF.js +4 -0
- package/dist/assets/app/messages-CurtIjBF.js.map +1 -0
- package/dist/assets/app/messages-Cv6zIbaP.js +4 -0
- package/dist/assets/app/messages-Cv6zIbaP.js.map +1 -0
- package/dist/assets/app/messages-D1eLQuPE.js +4 -0
- package/dist/assets/app/messages-D1eLQuPE.js.map +1 -0
- package/dist/assets/app/messages-D8vHEaYW.js +4 -0
- package/dist/assets/app/messages-D8vHEaYW.js.map +1 -0
- package/dist/assets/app/messages-DJ1Q4GeC.js +4 -0
- package/dist/assets/app/messages-DJ1Q4GeC.js.map +1 -0
- package/dist/assets/app/messages-DRL3exqd.js +4 -0
- package/dist/assets/app/messages-DRL3exqd.js.map +1 -0
- package/dist/assets/app/messages-DWLPQRTp.js +4 -0
- package/dist/assets/app/messages-DWLPQRTp.js.map +1 -0
- package/dist/assets/app/messages-DjVaE9YE.js +4 -0
- package/dist/assets/app/messages-DjVaE9YE.js.map +1 -0
- package/dist/assets/app/messages-DqpMfFJR.js +4 -0
- package/dist/assets/app/messages-DqpMfFJR.js.map +1 -0
- package/dist/assets/app/messages-ETjhJBEN.js +4 -0
- package/dist/assets/app/messages-ETjhJBEN.js.map +1 -0
- package/dist/assets/app/messages-EUKrgrGn.js +4 -0
- package/dist/assets/app/messages-EUKrgrGn.js.map +1 -0
- package/dist/assets/app/messages-QQrOUcPW.js +4 -0
- package/dist/assets/app/messages-QQrOUcPW.js.map +1 -0
- package/dist/assets/app/messages-e2QGqFL6.js +4 -0
- package/dist/assets/app/messages-e2QGqFL6.js.map +1 -0
- package/dist/assets/app/messages-p61py7gD.js +4 -0
- package/dist/assets/app/messages-p61py7gD.js.map +1 -0
- package/dist/assets/asset.d.ts +1 -0
- package/dist/assets/asset.d.ts.map +1 -1
- package/dist/assets/assets-middleware.d.ts.map +1 -1
- package/dist/assets/assets-middleware.js +12 -7
- package/dist/assets/assets-middleware.js.map +1 -1
- package/dist/assets/index.d.ts +3 -2
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +13 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/client/client-store.d.ts +3 -3
- package/dist/client/client-store.d.ts.map +1 -1
- package/dist/client/client-store.js +6 -5
- package/dist/client/client-store.js.map +1 -1
- package/dist/device/device-manager.d.ts +9 -8
- package/dist/device/device-manager.d.ts.map +1 -1
- package/dist/device/device-manager.js.map +1 -1
- package/dist/device/device-store.d.ts +3 -3
- package/dist/device/device-store.d.ts.map +1 -1
- package/dist/device/device-store.js +10 -9
- package/dist/device/device-store.js.map +1 -1
- package/dist/dpop/dpop-manager.d.ts +15 -7
- package/dist/dpop/dpop-manager.d.ts.map +1 -1
- package/dist/dpop/dpop-manager.js +17 -3
- package/dist/dpop/dpop-manager.js.map +1 -1
- package/dist/dpop/dpop-nonce.d.ts +11 -5
- package/dist/dpop/dpop-nonce.d.ts.map +1 -1
- package/dist/dpop/dpop-nonce.js +47 -38
- package/dist/dpop/dpop-nonce.js.map +1 -1
- package/dist/errors/handle-unavailable-error.d.ts +11 -0
- package/dist/errors/handle-unavailable-error.d.ts.map +1 -0
- package/dist/errors/handle-unavailable-error.js +19 -0
- package/dist/errors/handle-unavailable-error.js.map +1 -0
- package/dist/errors/invalid-request-error.d.ts +6 -8
- package/dist/errors/invalid-request-error.d.ts.map +1 -1
- package/dist/errors/invalid-request-error.js +10 -8
- package/dist/errors/invalid-request-error.js.map +1 -1
- package/dist/lib/csp/index.d.ts +18 -0
- package/dist/lib/csp/index.d.ts.map +1 -0
- package/dist/lib/csp/index.js +72 -0
- package/dist/lib/csp/index.js.map +1 -0
- package/dist/lib/hcaptcha.d.ts +177 -0
- package/dist/lib/hcaptcha.d.ts.map +1 -0
- package/dist/lib/hcaptcha.js +155 -0
- package/dist/lib/hcaptcha.js.map +1 -0
- package/dist/lib/html/build-document.d.ts +11 -3
- package/dist/lib/html/build-document.d.ts.map +1 -1
- package/dist/lib/html/build-document.js +51 -15
- package/dist/lib/html/build-document.js.map +1 -1
- package/dist/lib/http/middleware.d.ts.map +1 -1
- package/dist/lib/http/middleware.js +4 -1
- package/dist/lib/http/middleware.js.map +1 -1
- package/dist/lib/http/request.d.ts +5 -2
- package/dist/lib/http/request.d.ts.map +1 -1
- package/dist/lib/http/request.js +16 -1
- package/dist/lib/http/request.js.map +1 -1
- package/dist/lib/http/response.d.ts +4 -2
- package/dist/lib/http/response.d.ts.map +1 -1
- package/dist/lib/http/response.js +23 -5
- package/dist/lib/http/response.js.map +1 -1
- package/dist/lib/locale.d.ts +15 -0
- package/dist/lib/locale.d.ts.map +1 -0
- package/dist/lib/locale.js +17 -0
- package/dist/lib/locale.js.map +1 -0
- package/dist/lib/util/function.d.ts +2 -2
- package/dist/lib/util/function.d.ts.map +1 -1
- package/dist/lib/util/function.js.map +1 -1
- package/dist/lib/util/type.d.ts +88 -1
- package/dist/lib/util/type.d.ts.map +1 -1
- package/dist/lib/util/type.js +41 -0
- package/dist/lib/util/type.js.map +1 -1
- package/dist/metadata/build-metadata.d.ts +2 -2
- package/dist/metadata/build-metadata.d.ts.map +1 -1
- package/dist/metadata/build-metadata.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 +60 -3
- package/dist/oauth-hooks.d.ts.map +1 -1
- package/dist/oauth-hooks.js +3 -3
- package/dist/oauth-hooks.js.map +1 -1
- package/dist/oauth-provider.d.ts +23 -18
- package/dist/oauth-provider.d.ts.map +1 -1
- package/dist/oauth-provider.js +207 -204
- package/dist/oauth-provider.js.map +1 -1
- package/dist/oauth-verifier.d.ts +1 -1
- package/dist/oauth-verifier.d.ts.map +1 -1
- package/dist/oauth-verifier.js +2 -1
- package/dist/oauth-verifier.js.map +1 -1
- package/dist/output/build-authorize-data.d.ts +0 -1
- package/dist/output/build-authorize-data.d.ts.map +1 -1
- package/dist/output/build-authorize-data.js +0 -1
- package/dist/output/build-authorize-data.js.map +1 -1
- package/dist/output/build-customization-data.d.ts +241 -0
- package/dist/output/build-customization-data.d.ts.map +1 -0
- package/dist/output/build-customization-data.js +174 -0
- package/dist/output/build-customization-data.js.map +1 -0
- package/dist/output/output-manager.d.ts +16 -9
- package/dist/output/output-manager.d.ts.map +1 -1
- package/dist/output/output-manager.js +78 -42
- package/dist/output/output-manager.js.map +1 -1
- package/dist/output/send-authorize-redirect.d.ts +9 -6
- package/dist/output/send-authorize-redirect.d.ts.map +1 -1
- package/dist/output/send-authorize-redirect.js +20 -14
- package/dist/output/send-authorize-redirect.js.map +1 -1
- package/dist/output/send-web-page.d.ts +7 -2
- package/dist/output/send-web-page.d.ts.map +1 -1
- package/dist/output/send-web-page.js +37 -21
- package/dist/output/send-web-page.js.map +1 -1
- package/dist/request/request-manager.d.ts +1 -1
- package/dist/request/request-manager.d.ts.map +1 -1
- package/dist/request/request-manager.js +4 -4
- package/dist/request/request-manager.js.map +1 -1
- package/dist/request/request-store.d.ts +3 -3
- package/dist/request/request-store.d.ts.map +1 -1
- package/dist/request/request-store.js +11 -10
- package/dist/request/request-store.js.map +1 -1
- package/dist/token/token-store.d.ts +4 -4
- package/dist/token/token-store.d.ts.map +1 -1
- package/dist/token/token-store.js +13 -12
- package/dist/token/token-store.js.map +1 -1
- package/package.json +43 -20
- package/rollup.config.js +61 -17
- package/src/account/account-manager.ts +159 -8
- package/src/account/account-store.ts +127 -32
- package/src/account/sign-in-data.ts +15 -0
- package/src/account/sign-up-data.ts +11 -0
- package/src/assets/app/app.tsx +31 -16
- package/src/assets/app/backend-data.ts +15 -60
- package/src/assets/app/backend-types.ts +66 -0
- package/src/assets/app/components/forms/button-toggle-visibility.tsx +43 -0
- package/src/assets/app/components/forms/button.tsx +60 -0
- package/src/assets/app/components/forms/fieldset.tsx +55 -0
- package/src/assets/app/components/forms/form-card-async.tsx +103 -0
- package/src/assets/app/components/forms/form-card.tsx +49 -0
- package/src/assets/app/components/forms/input-checkbox.tsx +73 -0
- package/src/assets/app/components/forms/input-container.tsx +107 -0
- package/src/assets/app/components/forms/input-email-address.tsx +66 -0
- package/src/assets/app/components/forms/input-new-password.tsx +62 -0
- package/src/assets/app/components/forms/input-password.tsx +88 -0
- package/src/assets/app/components/forms/input-text.tsx +76 -0
- package/src/assets/app/components/forms/input-token.tsx +94 -0
- package/src/assets/app/components/forms/wizard-card.tsx +116 -0
- package/src/assets/app/components/layouts/layout-title-page.tsx +77 -0
- package/src/assets/app/components/layouts/layout-welcome.tsx +73 -0
- package/src/assets/app/components/utils/account-identifier.tsx +23 -0
- package/src/assets/app/components/utils/account-image.tsx +33 -0
- package/src/assets/app/components/utils/admonition.tsx +52 -0
- package/src/assets/app/components/utils/client-name.tsx +45 -0
- package/src/assets/app/components/utils/error-card.tsx +93 -0
- package/src/assets/app/components/utils/error-message.tsx +62 -0
- package/src/assets/app/components/utils/help-card.tsx +46 -0
- package/src/assets/app/components/utils/icons.tsx +88 -0
- package/src/assets/app/components/utils/link-anchor.tsx +28 -0
- package/src/assets/app/components/utils/link-title.tsx +26 -0
- package/src/assets/app/components/utils/multi-lang-string.tsx +56 -0
- package/src/assets/app/components/utils/password-strength-label.tsx +37 -0
- package/src/assets/app/components/utils/password-strength-meter.tsx +58 -0
- package/src/assets/app/components/{url-viewer.tsx → utils/url-viewer.tsx} +9 -6
- package/src/assets/app/hooks/use-api.ts +128 -55
- package/src/assets/app/hooks/use-async-action.ts +120 -0
- package/src/assets/app/hooks/use-browser-color-scheme.ts +31 -0
- package/src/assets/app/hooks/use-csrf-token.ts +1 -1
- package/src/assets/app/hooks/use-random-string.ts +37 -0
- package/src/assets/app/hooks/use-stepper.ts +87 -0
- package/src/assets/app/index.html +182 -0
- package/src/assets/app/lib/api.ts +248 -79
- package/src/assets/app/lib/clsx.ts +5 -8
- package/src/assets/app/lib/json-client.ts +94 -0
- package/src/assets/app/lib/password.ts +98 -0
- package/src/assets/app/lib/ref.ts +17 -0
- package/src/assets/app/locales/an/messages.po +492 -0
- package/src/assets/app/locales/ast/messages.po +492 -0
- package/src/assets/app/locales/ca/messages.po +492 -0
- package/src/assets/app/locales/da/messages.po +492 -0
- package/src/assets/app/locales/de/messages.po +492 -0
- package/src/assets/app/locales/el/messages.po +492 -0
- package/src/assets/app/locales/en/messages.po +492 -0
- package/src/assets/app/locales/en-GB/messages.po +492 -0
- package/src/assets/app/locales/es/messages.po +492 -0
- package/src/assets/app/locales/eu/messages.po +492 -0
- package/src/assets/app/locales/fi/messages.po +492 -0
- package/src/assets/app/locales/fr/messages.po +492 -0
- package/src/assets/app/locales/ga/messages.po +492 -0
- package/src/assets/app/locales/gl/messages.po +492 -0
- package/src/assets/app/locales/hi/messages.po +492 -0
- package/src/assets/app/locales/hu/messages.po +492 -0
- package/src/assets/app/locales/ia/messages.po +492 -0
- package/src/assets/app/locales/id/messages.po +492 -0
- package/src/assets/app/locales/it/messages.po +492 -0
- package/src/assets/app/locales/ja/messages.po +492 -0
- package/src/assets/app/locales/km/messages.po +492 -0
- package/src/assets/app/locales/ko/messages.po +492 -0
- package/src/assets/app/locales/load.ts +8 -0
- package/src/assets/app/locales/locale-context.ts +19 -0
- package/src/assets/app/locales/locale-provider.tsx +112 -0
- package/src/assets/app/locales/locale-selector.tsx +58 -0
- package/src/assets/app/locales/locales.ts +168 -0
- package/src/assets/app/locales/ne/messages.po +492 -0
- package/src/assets/app/locales/nl/messages.po +492 -0
- package/src/assets/app/locales/pl/messages.po +492 -0
- package/src/assets/app/locales/pt-BR/messages.po +492 -0
- package/src/assets/app/locales/ro/messages.po +492 -0
- package/src/assets/app/locales/ru/messages.po +492 -0
- package/src/assets/app/locales/sv/messages.po +492 -0
- package/src/assets/app/locales/th/messages.po +492 -0
- package/src/assets/app/locales/tr/messages.po +492 -0
- package/src/assets/app/locales/uk/messages.po +492 -0
- package/src/assets/app/locales/vi/messages.po +492 -0
- package/src/assets/app/locales/zh-CN/messages.po +492 -0
- package/src/assets/app/locales/zh-HK/messages.po +492 -0
- package/src/assets/app/locales/zh-TW/messages.po +492 -0
- package/src/assets/app/main.css +23 -2
- package/src/assets/app/main.tsx +24 -8
- package/src/assets/app/views/authorize/accept/accept-form.tsx +150 -0
- package/src/assets/app/views/authorize/accept/accept-view.tsx +70 -0
- package/src/assets/app/views/authorize/authorize-view.tsx +180 -0
- package/src/assets/app/views/authorize/reset-password/reset-password-confirm-form.tsx +88 -0
- package/src/assets/app/views/authorize/reset-password/reset-password-request-form.tsx +80 -0
- package/src/assets/app/views/authorize/reset-password/reset-password-view.tsx +127 -0
- package/src/assets/app/views/authorize/sign-in/sign-in-form.tsx +244 -0
- package/src/assets/app/views/authorize/sign-in/sign-in-picker.tsx +116 -0
- package/src/assets/app/views/authorize/sign-in/sign-in-view.tsx +145 -0
- package/src/assets/app/views/authorize/sign-up/sign-up-account-form.tsx +140 -0
- package/src/assets/app/views/authorize/sign-up/sign-up-disclaimer.tsx +51 -0
- package/src/assets/app/views/authorize/sign-up/sign-up-handle-form.tsx +289 -0
- package/src/assets/app/views/authorize/sign-up/sign-up-hcaptcha-form.tsx +108 -0
- package/src/assets/app/views/authorize/sign-up/sign-up-view.tsx +158 -0
- package/src/assets/app/views/authorize/welcome/welcome-view.tsx +56 -0
- package/src/assets/app/views/error/error-view.tsx +31 -0
- package/src/assets/asset.ts +1 -0
- package/src/assets/assets-middleware.ts +13 -8
- package/src/assets/index.ts +15 -2
- package/src/client/client-store.ts +10 -12
- package/src/device/device-manager.ts +8 -12
- package/src/device/device-store.ts +9 -15
- package/src/dpop/dpop-manager.ts +20 -8
- package/src/dpop/dpop-nonce.ts +58 -40
- package/src/errors/handle-unavailable-error.ts +18 -0
- package/src/errors/invalid-request-error.ts +10 -8
- package/src/lib/csp/index.ts +98 -0
- package/src/lib/hcaptcha.ts +182 -0
- package/src/lib/html/build-document.ts +60 -16
- package/src/lib/http/middleware.ts +4 -3
- package/src/lib/http/request.ts +31 -1
- package/src/lib/http/response.ts +22 -9
- package/src/lib/locale.ts +21 -0
- package/src/lib/util/function.ts +0 -3
- package/src/lib/util/type.ts +130 -1
- package/src/metadata/build-metadata.ts +2 -1
- package/src/oauth-errors.ts +1 -0
- package/src/oauth-hooks.ts +69 -3
- package/src/oauth-provider.ts +403 -307
- package/src/oauth-verifier.ts +3 -1
- package/src/output/build-authorize-data.ts +1 -3
- package/src/output/build-customization-data.ts +228 -0
- package/src/output/output-manager.ts +111 -48
- package/src/output/send-authorize-redirect.ts +43 -36
- package/src/output/send-web-page.ts +40 -26
- package/src/request/request-manager.ts +4 -4
- package/src/request/request-store.ts +12 -16
- package/src/token/token-store.ts +14 -18
- package/tailwind.config.js +5 -0
- package/tsconfig.backend.tsbuildinfo +1 -1
- package/tsconfig.frontend.tsbuildinfo +1 -1
- package/tsconfig.tools.tsbuildinfo +1 -1
- package/vite.config.mjs +16 -0
- package/.postcssrc.yml +0 -3
- package/dist/assets/app/main.css +0 -3
- package/dist/assets/app/main.js +0 -20
- package/dist/assets/app/main.js.map +0 -1
- package/dist/output/customization.d.ts +0 -27
- package/dist/output/customization.d.ts.map +0 -1
- package/dist/output/customization.js +0 -88
- package/dist/output/customization.js.map +0 -1
- package/src/assets/app/components/accept-form.tsx +0 -137
- package/src/assets/app/components/account-identifier.tsx +0 -18
- package/src/assets/app/components/account-picker.tsx +0 -127
- package/src/assets/app/components/button.tsx +0 -34
- package/src/assets/app/components/client-name.tsx +0 -37
- package/src/assets/app/components/fieldset.tsx +0 -26
- package/src/assets/app/components/form-card.tsx +0 -47
- package/src/assets/app/components/help-card.tsx +0 -42
- package/src/assets/app/components/icons/alert-icon.tsx +0 -5
- package/src/assets/app/components/icons/at-symbol-icon.tsx +0 -5
- package/src/assets/app/components/icons/caret-right-icon.tsx +0 -5
- package/src/assets/app/components/icons/lock-icon.tsx +0 -5
- package/src/assets/app/components/icons/token-icon.tsx +0 -5
- package/src/assets/app/components/icons/util.tsx +0 -17
- package/src/assets/app/components/info-card.tsx +0 -45
- package/src/assets/app/components/input-checkbox.tsx +0 -47
- package/src/assets/app/components/input-container.tsx +0 -37
- package/src/assets/app/components/input-layout.tsx +0 -47
- package/src/assets/app/components/input-text.tsx +0 -69
- package/src/assets/app/components/layout-title-page.tsx +0 -60
- package/src/assets/app/components/layout-welcome.tsx +0 -74
- package/src/assets/app/components/sign-in-form.tsx +0 -337
- package/src/assets/app/components/sign-up-account-form.tsx +0 -194
- package/src/assets/app/components/sign-up-disclaimer.tsx +0 -44
- package/src/assets/app/views/accept-view.tsx +0 -55
- package/src/assets/app/views/authorize-view.tsx +0 -106
- package/src/assets/app/views/error-view.tsx +0 -36
- package/src/assets/app/views/sign-in-view.tsx +0 -111
- package/src/assets/app/views/sign-up-view.tsx +0 -86
- package/src/assets/app/views/welcome-view.tsx +0 -54
- package/src/output/customization.ts +0 -118
package/.linguirc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"format": "po",
|
3
|
+
"sourceLocale": "en",
|
4
|
+
"locales": [
|
5
|
+
"en",
|
6
|
+
"an",
|
7
|
+
"ast",
|
8
|
+
"ca",
|
9
|
+
"da",
|
10
|
+
"de",
|
11
|
+
"el",
|
12
|
+
"en-GB",
|
13
|
+
"es",
|
14
|
+
"eu",
|
15
|
+
"fi",
|
16
|
+
"fr",
|
17
|
+
"ga",
|
18
|
+
"gl",
|
19
|
+
"hi",
|
20
|
+
"hu",
|
21
|
+
"ia",
|
22
|
+
"id",
|
23
|
+
"it",
|
24
|
+
"ja",
|
25
|
+
"km",
|
26
|
+
"ko",
|
27
|
+
"ne",
|
28
|
+
"nl",
|
29
|
+
"pl",
|
30
|
+
"pt-BR",
|
31
|
+
"ro",
|
32
|
+
"ru",
|
33
|
+
"sv",
|
34
|
+
"th",
|
35
|
+
"tr",
|
36
|
+
"uk",
|
37
|
+
"vi",
|
38
|
+
"zh-CN",
|
39
|
+
"zh-HK",
|
40
|
+
"zh-TW"
|
41
|
+
],
|
42
|
+
"fallbackLocales": {
|
43
|
+
"default": "en"
|
44
|
+
},
|
45
|
+
"catalogs": [
|
46
|
+
{
|
47
|
+
"path": "<rootDir>/src/assets/app/locales/{locale}/messages",
|
48
|
+
"include": [
|
49
|
+
"<rootDir>/src/assets/app"
|
50
|
+
],
|
51
|
+
"exclude": [
|
52
|
+
"**/dist/**",
|
53
|
+
"**/node_modules/**"
|
54
|
+
]
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# @atproto/oauth-provider
|
2
2
|
|
3
|
+
## 0.5.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#3611](https://github.com/bluesky-social/atproto/pull/3611) [`c01d7f5d1`](https://github.com/bluesky-social/atproto/commit/c01d7f5d155445d7741c09f91c84af64b31bdbed) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Make branding colors optional
|
8
|
+
|
9
|
+
- [#3614](https://github.com/bluesky-social/atproto/pull/3614) [`8827ff433`](https://github.com/bluesky-social/atproto/commit/8827ff433a211d2db80840cfc4ee146a7fb44849) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Improve branding parsing
|
10
|
+
|
11
|
+
## 0.5.0
|
12
|
+
|
13
|
+
### Minor Changes
|
14
|
+
|
15
|
+
- [#2945](https://github.com/bluesky-social/atproto/pull/2945) [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add support for account sign-up
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- [#2945](https://github.com/bluesky-social/atproto/pull/2945) [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add support for password reset
|
20
|
+
|
21
|
+
- [#2945](https://github.com/bluesky-social/atproto/pull/2945) [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Properly support locales with 3 chars (Asturian)
|
22
|
+
|
23
|
+
- [#2945](https://github.com/bluesky-social/atproto/pull/2945) [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add support for multiple locales
|
24
|
+
|
25
|
+
- Updated dependencies [[`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29), [`850e39843`](https://github.com/bluesky-social/atproto/commit/850e39843cb0ec9ea716675f7568c0c601f45e29)]:
|
26
|
+
- @atproto-labs/fetch@0.2.2
|
27
|
+
- @atproto/oauth-types@0.2.4
|
28
|
+
- @atproto/jwk@0.1.4
|
29
|
+
- @atproto-labs/fetch-node@0.1.8
|
30
|
+
- @atproto/jwk-jose@0.1.5
|
31
|
+
|
3
32
|
## 0.4.0
|
4
33
|
|
5
34
|
### Minor Changes
|
@@ -1,14 +1,28 @@
|
|
1
|
+
import { OAuthIssuerIdentifier } from '@atproto/oauth-types';
|
1
2
|
import { Client } from '../client/client.js';
|
2
3
|
import { DeviceId } from '../device/device-id.js';
|
4
|
+
import { HCaptchaClient } from '../lib/hcaptcha.js';
|
5
|
+
import { OAuthHooks, RequestMetadata } from '../oauth-hooks.js';
|
6
|
+
import { Customization } from '../oauth-provider.js';
|
3
7
|
import { Sub } from '../oidc/sub.js';
|
4
8
|
import { ClientAuth } from '../token/token-store.js';
|
5
|
-
import { Account, AccountInfo, AccountStore,
|
9
|
+
import { Account, AccountInfo, AccountStore, ResetPasswordConfirmData, ResetPasswordRequestData } from './account-store.js';
|
10
|
+
import { SignInData } from './sign-in-data.js';
|
11
|
+
import { SignUpData } from './sign-up-data.js';
|
6
12
|
export declare class AccountManager {
|
7
13
|
protected readonly store: AccountStore;
|
8
|
-
|
9
|
-
|
14
|
+
protected readonly hooks: OAuthHooks;
|
15
|
+
protected readonly inviteCodeRequired: boolean;
|
16
|
+
protected readonly hcaptchaClient?: HCaptchaClient;
|
17
|
+
constructor(issuer: OAuthIssuerIdentifier, store: AccountStore, hooks: OAuthHooks, customization: Customization);
|
18
|
+
protected verifySignupData(data: SignUpData, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<void>;
|
19
|
+
signUp(data: SignUpData, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<AccountInfo>;
|
20
|
+
signIn(data: SignInData, deviceId: DeviceId, deviceMetadata: RequestMetadata): Promise<AccountInfo>;
|
10
21
|
get(deviceId: DeviceId, sub: Sub): Promise<AccountInfo>;
|
11
22
|
addAuthorizedClient(deviceId: DeviceId, account: Account, client: Client, _clientAuth: ClientAuth): Promise<void>;
|
12
23
|
list(deviceId: DeviceId): Promise<AccountInfo[]>;
|
24
|
+
resetPasswordRequest(data: ResetPasswordRequestData): Promise<void>;
|
25
|
+
resetPasswordConfirm(data: ResetPasswordConfirmData): Promise<void>;
|
26
|
+
verifyHandleAvailability(handle: string): Promise<void>;
|
13
27
|
}
|
14
28
|
//# sourceMappingURL=account-manager.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":"
|
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,EAAwB,MAAM,oBAAoB,CAAA;AAGzE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAA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,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"}
|
@@ -2,27 +2,106 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.AccountManager = void 0;
|
4
4
|
const oauth_types_1 = require("@atproto/oauth-types");
|
5
|
+
const invalid_request_error_js_1 = require("../errors/invalid-request-error.js");
|
6
|
+
const hcaptcha_js_1 = require("../lib/hcaptcha.js");
|
7
|
+
const function_js_1 = require("../lib/util/function.js");
|
5
8
|
const time_js_1 = require("../lib/util/time.js");
|
6
|
-
const oauth_errors_js_1 = require("../oauth-errors.js");
|
7
9
|
const TIMING_ATTACK_MITIGATION_DELAY = 400;
|
10
|
+
const BRUTE_FORCE_MITIGATION_DELAY = 300;
|
8
11
|
class AccountManager {
|
9
12
|
store;
|
10
|
-
|
13
|
+
hooks;
|
14
|
+
inviteCodeRequired;
|
15
|
+
hcaptchaClient;
|
16
|
+
constructor(issuer, store, hooks, customization) {
|
11
17
|
this.store = store;
|
18
|
+
this.hooks = hooks;
|
19
|
+
this.inviteCodeRequired = customization.inviteCodeRequired !== false;
|
20
|
+
this.hcaptchaClient = customization.hcaptcha
|
21
|
+
? new hcaptcha_js_1.HCaptchaClient(new URL(issuer).hostname, customization.hcaptcha)
|
22
|
+
: undefined;
|
12
23
|
}
|
13
|
-
async
|
24
|
+
async verifySignupData(data, deviceId, deviceMetadata) {
|
25
|
+
let hcaptchaResult;
|
26
|
+
if (this.inviteCodeRequired && !data.inviteCode) {
|
27
|
+
throw new invalid_request_error_js_1.InvalidRequestError('Invite code is required');
|
28
|
+
}
|
29
|
+
if (this.hcaptchaClient) {
|
30
|
+
if (!data.hcaptchaToken) {
|
31
|
+
throw new invalid_request_error_js_1.InvalidRequestError('hCaptcha token is required');
|
32
|
+
}
|
33
|
+
const { allowed, result } = await this.hcaptchaClient.verify('signup', data.hcaptchaToken, deviceMetadata.ipAddress, data.handle, deviceMetadata.userAgent);
|
34
|
+
await (0, function_js_1.callAsync)(this.hooks.onSignupHcaptchaResult, {
|
35
|
+
data,
|
36
|
+
allowed,
|
37
|
+
result,
|
38
|
+
deviceId,
|
39
|
+
deviceMetadata,
|
40
|
+
});
|
41
|
+
if (!allowed) {
|
42
|
+
throw new invalid_request_error_js_1.InvalidRequestError('hCaptcha verification failed');
|
43
|
+
}
|
44
|
+
hcaptchaResult = result;
|
45
|
+
}
|
46
|
+
await (0, function_js_1.callAsync)(this.hooks.onSignupAttempt, {
|
47
|
+
data,
|
48
|
+
deviceId,
|
49
|
+
deviceMetadata,
|
50
|
+
hcaptchaResult,
|
51
|
+
});
|
52
|
+
}
|
53
|
+
async signUp(data, deviceId, deviceMetadata) {
|
54
|
+
await this.verifySignupData(data, deviceId, deviceMetadata);
|
55
|
+
// Mitigation against brute forcing email of users.
|
56
|
+
// @TODO Add rate limit to all the OAuth routes.
|
57
|
+
return (0, time_js_1.constantTime)(BRUTE_FORCE_MITIGATION_DELAY, async () => {
|
58
|
+
let account;
|
59
|
+
try {
|
60
|
+
account = await this.store.createAccount(data);
|
61
|
+
}
|
62
|
+
catch (err) {
|
63
|
+
throw invalid_request_error_js_1.InvalidRequestError.from(err, 'Account creation failed');
|
64
|
+
}
|
65
|
+
try {
|
66
|
+
const info = await this.store.addDeviceAccount(deviceId, account.sub, false);
|
67
|
+
await (0, function_js_1.callAsync)(this.hooks.onSignedUp, {
|
68
|
+
data,
|
69
|
+
info,
|
70
|
+
account,
|
71
|
+
deviceId,
|
72
|
+
deviceMetadata,
|
73
|
+
});
|
74
|
+
return { account, info };
|
75
|
+
}
|
76
|
+
catch (err) {
|
77
|
+
throw invalid_request_error_js_1.InvalidRequestError.from(err, 'Something went wrong, try singing-in');
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
async signIn(data, deviceId, deviceMetadata) {
|
14
82
|
return (0, time_js_1.constantTime)(TIMING_ATTACK_MITIGATION_DELAY, async () => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
83
|
+
try {
|
84
|
+
const account = await this.store.authenticateAccount(data);
|
85
|
+
const info = await this.store.addDeviceAccount(deviceId, account.sub, data.remember);
|
86
|
+
await (0, function_js_1.callAsync)(this.hooks.onSignedIn, {
|
87
|
+
data,
|
88
|
+
info,
|
89
|
+
account,
|
90
|
+
deviceId,
|
91
|
+
deviceMetadata,
|
92
|
+
});
|
93
|
+
return { account, info };
|
94
|
+
}
|
95
|
+
catch (err) {
|
96
|
+
throw invalid_request_error_js_1.InvalidRequestError.from(err, 'Unable to sign-in due to an unexpected server error');
|
97
|
+
}
|
19
98
|
});
|
20
99
|
}
|
21
100
|
async get(deviceId, sub) {
|
22
101
|
const result = await this.store.getDeviceAccount(deviceId, sub);
|
23
102
|
if (result)
|
24
103
|
return result;
|
25
|
-
throw new
|
104
|
+
throw new invalid_request_error_js_1.InvalidRequestError(`Account not found`);
|
26
105
|
}
|
27
106
|
async addAuthorizedClient(deviceId, account, client, _clientAuth) {
|
28
107
|
// "Loopback" clients are not distinguishable from one another.
|
@@ -34,6 +113,21 @@ class AccountManager {
|
|
34
113
|
const results = await this.store.listDeviceAccounts(deviceId);
|
35
114
|
return results.filter((result) => result.info.remembered);
|
36
115
|
}
|
116
|
+
async resetPasswordRequest(data) {
|
117
|
+
return (0, time_js_1.constantTime)(TIMING_ATTACK_MITIGATION_DELAY, async () => {
|
118
|
+
await this.store.resetPasswordRequest(data);
|
119
|
+
});
|
120
|
+
}
|
121
|
+
async resetPasswordConfirm(data) {
|
122
|
+
return (0, time_js_1.constantTime)(TIMING_ATTACK_MITIGATION_DELAY, async () => {
|
123
|
+
await this.store.resetPasswordConfirm(data);
|
124
|
+
});
|
125
|
+
}
|
126
|
+
async verifyHandleAvailability(handle) {
|
127
|
+
return (0, time_js_1.constantTime)(TIMING_ATTACK_MITIGATION_DELAY, async () => {
|
128
|
+
return this.store.verifyHandleAvailability(handle);
|
129
|
+
});
|
130
|
+
}
|
37
131
|
}
|
38
132
|
exports.AccountManager = AccountManager;
|
39
133
|
//# sourceMappingURL=account-manager.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account/account-manager.ts"],"names":[],"mappings":";;;AAAA,
|
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;AAelD,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,CAAC;YACtE,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;IAES,KAAK,CAAC,gBAAgB,CAC9B,IAAgB,EAChB,QAAkB,EAClB,cAA+B;QAE/B,IAAI,cAAgD,CAAA;QAEpD,IAAI,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChD,MAAM,IAAI,8CAAmB,CAAC,yBAAyB,CAAC,CAAA;QAC1D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I,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;AAlLD,wCAkLC"}
|
@@ -2,43 +2,103 @@ import { z } from 'zod';
|
|
2
2
|
import { ClientId } from '../client/client-id.js';
|
3
3
|
import { DeviceId } from '../device/device-id.js';
|
4
4
|
import { Awaitable } from '../lib/util/type.js';
|
5
|
+
import { HandleUnavailableError, InvalidRequestError, SecondAuthenticationFactorRequiredError } from '../oauth-errors.js';
|
5
6
|
import { Sub } from '../oidc/sub.js';
|
6
7
|
import { Account } from './account.js';
|
7
|
-
export declare const
|
8
|
+
export declare const oldPasswordSchema: z.ZodString;
|
9
|
+
export declare const newPasswordSchema: z.ZodString;
|
10
|
+
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 authenticateAccountDataSchema: z.ZodObject<{
|
14
|
+
locale: z.ZodString;
|
8
15
|
username: z.ZodString;
|
9
16
|
password: z.ZodString;
|
10
|
-
/**
|
11
|
-
* If false, the account must not be returned from
|
12
|
-
* {@link AccountStore.listDeviceAccounts}. Note that this only makes sense when
|
13
|
-
* used with a device ID.
|
14
|
-
*/
|
15
|
-
remember: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
16
17
|
emailOtp: z.ZodOptional<z.ZodString>;
|
17
|
-
}, "
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
19
|
+
locale: string;
|
18
20
|
password: string;
|
19
21
|
username: string;
|
20
|
-
remember: boolean;
|
21
22
|
emailOtp?: string | undefined;
|
22
23
|
}, {
|
24
|
+
locale: string;
|
23
25
|
password: string;
|
24
26
|
username: string;
|
25
27
|
emailOtp?: string | undefined;
|
26
|
-
remember?: boolean | undefined;
|
27
28
|
}>;
|
28
|
-
export type
|
29
|
+
export type AuthenticateAccountData = z.TypeOf<typeof authenticateAccountDataSchema>;
|
30
|
+
export declare const createAccountDataSchema: z.ZodObject<{
|
31
|
+
locale: z.ZodString;
|
32
|
+
handle: z.ZodString;
|
33
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
34
|
+
password: z.ZodIntersection<z.ZodString, z.ZodString>;
|
35
|
+
inviteCode: z.ZodOptional<z.ZodString>;
|
36
|
+
}, "strict", z.ZodTypeAny, {
|
37
|
+
email: string;
|
38
|
+
locale: string;
|
39
|
+
password: string;
|
40
|
+
handle: string;
|
41
|
+
inviteCode?: string | undefined;
|
42
|
+
}, {
|
43
|
+
email: string;
|
44
|
+
locale: string;
|
45
|
+
password: string;
|
46
|
+
handle: string;
|
47
|
+
inviteCode?: string | undefined;
|
48
|
+
}>;
|
49
|
+
export type CreateAccountData = z.TypeOf<typeof createAccountDataSchema>;
|
50
|
+
export declare const resetPasswordRequestDataSchema: z.ZodObject<{
|
51
|
+
locale: z.ZodString;
|
52
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
53
|
+
}, "strict", z.ZodTypeAny, {
|
54
|
+
email: string;
|
55
|
+
locale: string;
|
56
|
+
}, {
|
57
|
+
email: string;
|
58
|
+
locale: string;
|
59
|
+
}>;
|
60
|
+
export type ResetPasswordRequestData = z.TypeOf<typeof resetPasswordRequestDataSchema>;
|
61
|
+
export declare const resetPasswordConfirmDataSchema: z.ZodObject<{
|
62
|
+
token: z.ZodString;
|
63
|
+
password: z.ZodIntersection<z.ZodString, z.ZodString>;
|
64
|
+
}, "strict", z.ZodTypeAny, {
|
65
|
+
token: string;
|
66
|
+
password: string;
|
67
|
+
}, {
|
68
|
+
token: string;
|
69
|
+
password: string;
|
70
|
+
}>;
|
71
|
+
export type ResetPasswordConfirmData = z.TypeOf<typeof resetPasswordConfirmDataSchema>;
|
29
72
|
export type DeviceAccountInfo = {
|
30
73
|
remembered: boolean;
|
31
74
|
authenticatedAt: Date;
|
32
75
|
authorizedClients: readonly ClientId[];
|
33
76
|
};
|
34
|
-
export type
|
77
|
+
export { type Account, type DeviceId, HandleUnavailableError, InvalidRequestError, SecondAuthenticationFactorRequiredError, type Sub, };
|
35
78
|
export type AccountInfo = {
|
36
79
|
account: Account;
|
37
80
|
info: DeviceAccountInfo;
|
38
81
|
};
|
39
82
|
export interface AccountStore {
|
40
|
-
|
83
|
+
/**
|
84
|
+
* @throws {HandleUnavailableError} - To indicate that the handle is already taken
|
85
|
+
* @throws {InvalidRequestError} - To indicate that some data is invalid
|
86
|
+
*/
|
87
|
+
createAccount(data: CreateAccountData): Awaitable<Account>;
|
88
|
+
/**
|
89
|
+
* @throws {InvalidRequestError} - When the credentials are not valid
|
90
|
+
* @throws {SecondAuthenticationFactorRequiredError} - To indicate that an {@link SecondAuthenticationFactorRequiredError.type} is required in the credentials
|
91
|
+
*/
|
92
|
+
authenticateAccount(data: AuthenticateAccountData): Awaitable<Account>;
|
41
93
|
addAuthorizedClient(deviceId: DeviceId, sub: Sub, clientId: ClientId): Awaitable<void>;
|
94
|
+
/**
|
95
|
+
* @param remember If false, the account must not be returned from
|
96
|
+
* {@link AccountStore.listDeviceAccounts}.
|
97
|
+
*/
|
98
|
+
addDeviceAccount(deviceId: DeviceId, sub: Sub, remember: boolean): Awaitable<DeviceAccountInfo>;
|
99
|
+
/**
|
100
|
+
* @returns The account info, whether the account, even if remember was false.
|
101
|
+
*/
|
42
102
|
getDeviceAccount(deviceId: DeviceId, sub: Sub): Awaitable<AccountInfo | null>;
|
43
103
|
removeDeviceAccount(deviceId: DeviceId, sub: Sub): Awaitable<void>;
|
44
104
|
/**
|
@@ -46,7 +106,13 @@ export interface AccountStore {
|
|
46
106
|
* be returned. The others will be ignored.
|
47
107
|
*/
|
48
108
|
listDeviceAccounts(deviceId: DeviceId): Awaitable<AccountInfo[]>;
|
109
|
+
resetPasswordRequest(data: ResetPasswordRequestData): Awaitable<void>;
|
110
|
+
resetPasswordConfirm(data: ResetPasswordConfirmData): Awaitable<void>;
|
111
|
+
/**
|
112
|
+
* @throws {HandleUnavailableError} - To indicate that the handle is already taken
|
113
|
+
*/
|
114
|
+
verifyHandleAvailability(handle: string): Awaitable<void>;
|
49
115
|
}
|
50
|
-
export declare
|
51
|
-
export declare function asAccountStore(implementation
|
116
|
+
export declare const isAccountStore: <V extends Partial<AccountStore>>(value: V) => value is V & import("../lib/util/type.js").RequiredDefined<AccountStore>;
|
117
|
+
export declare function asAccountStore<V>(implementation: V): V & AccountStore;
|
52
118
|
//# sourceMappingURL=account-store.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account-store.d.ts","sourceRoot":"","sources":["../../src/account/account-store.ts"],"names":[],"mappings":"
|
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;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,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;AAGtC,eAAO,MAAM,iBAAiB,aAAoB,CAAA;AAClD,eAAO,MAAM,iBAAiB,aAAoB,CAAA;AAClD,eAAO,MAAM,WAAW,aAAgD,CAAA;AACxE,eAAO,MAAM,YAAY,aAIgD,CAAA;AACzE,eA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,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,29 +1,80 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.isAccountStore = isAccountStore;
|
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;
|
5
4
|
exports.asAccountStore = asAccountStore;
|
5
|
+
const address_1 = require("@hapi/address");
|
6
|
+
const disposable_email_domains_js_1 = require("disposable-email-domains-js");
|
6
7
|
const zod_1 = require("zod");
|
7
|
-
|
8
|
+
const locale_js_1 = require("../lib/locale.js");
|
9
|
+
const type_js_1 = require("../lib/util/type.js");
|
10
|
+
const oauth_errors_js_1 = require("../oauth-errors.js");
|
11
|
+
Object.defineProperty(exports, "HandleUnavailableError", { enumerable: true, get: function () { return oauth_errors_js_1.HandleUnavailableError; } });
|
12
|
+
Object.defineProperty(exports, "InvalidRequestError", { enumerable: true, get: function () { return oauth_errors_js_1.InvalidRequestError; } });
|
13
|
+
Object.defineProperty(exports, "SecondAuthenticationFactorRequiredError", { enumerable: true, get: function () { return oauth_errors_js_1.SecondAuthenticationFactorRequiredError; } });
|
14
|
+
// @NOTE Change the length here to force stronger passwords (through a reset)
|
15
|
+
exports.oldPasswordSchema = zod_1.z.string().min(1);
|
16
|
+
exports.newPasswordSchema = zod_1.z.string().min(8);
|
17
|
+
exports.tokenSchema = zod_1.z.string().regex(/^[A-Z2-7]{5}-[A-Z2-7]{5}$/);
|
18
|
+
exports.handleSchema = zod_1.z
|
19
|
+
.string()
|
20
|
+
.min(3)
|
21
|
+
.max(30)
|
22
|
+
.regex(/^[a-z0-9][a-z0-9-]+[a-z0-9](?:\.[a-z0-9][a-z0-9-]+[a-z0-9])+$/);
|
23
|
+
exports.emailSchema = zod_1.z
|
24
|
+
.string()
|
25
|
+
.email()
|
26
|
+
// @NOTE using @hapi/address here, in addition to the email() check to ensure
|
27
|
+
// compatibility with the current email validation in the PDS's account
|
28
|
+
// manager
|
29
|
+
.refine(address_1.isEmailValid, {
|
30
|
+
message: 'Invalid email address',
|
31
|
+
})
|
32
|
+
.refine((email) => !(0, disposable_email_domains_js_1.isDisposableEmail)(email), {
|
33
|
+
message: 'Disposable email addresses are not allowed',
|
34
|
+
});
|
35
|
+
exports.authenticateAccountDataSchema = zod_1.z
|
36
|
+
.object({
|
37
|
+
locale: locale_js_1.localeSchema,
|
8
38
|
username: zod_1.z.string(),
|
9
|
-
password:
|
10
|
-
/**
|
11
|
-
* If false, the account must not be returned from
|
12
|
-
* {@link AccountStore.listDeviceAccounts}. Note that this only makes sense when
|
13
|
-
* used with a device ID.
|
14
|
-
*/
|
15
|
-
remember: zod_1.z.boolean().optional().default(false),
|
39
|
+
password: exports.oldPasswordSchema,
|
16
40
|
emailOtp: zod_1.z.string().optional(),
|
17
|
-
})
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
41
|
+
})
|
42
|
+
.strict();
|
43
|
+
exports.createAccountDataSchema = zod_1.z
|
44
|
+
.object({
|
45
|
+
locale: locale_js_1.localeSchema,
|
46
|
+
handle: exports.handleSchema,
|
47
|
+
email: exports.emailSchema,
|
48
|
+
password: zod_1.z.intersection(exports.oldPasswordSchema, exports.newPasswordSchema),
|
49
|
+
inviteCode: exports.tokenSchema.optional(),
|
50
|
+
})
|
51
|
+
.strict();
|
52
|
+
exports.resetPasswordRequestDataSchema = zod_1.z
|
53
|
+
.object({
|
54
|
+
locale: locale_js_1.localeSchema,
|
55
|
+
email: exports.emailSchema,
|
56
|
+
})
|
57
|
+
.strict();
|
58
|
+
exports.resetPasswordConfirmDataSchema = zod_1.z
|
59
|
+
.object({
|
60
|
+
token: exports.tokenSchema,
|
61
|
+
password: zod_1.z.intersection(exports.oldPasswordSchema, exports.newPasswordSchema),
|
62
|
+
})
|
63
|
+
.strict();
|
64
|
+
exports.isAccountStore = (0, type_js_1.buildInterfaceChecker)([
|
65
|
+
'createAccount',
|
66
|
+
'authenticateAccount',
|
67
|
+
'addAuthorizedClient',
|
68
|
+
'addDeviceAccount',
|
69
|
+
'getDeviceAccount',
|
70
|
+
'removeDeviceAccount',
|
71
|
+
'listDeviceAccounts',
|
72
|
+
'resetPasswordRequest',
|
73
|
+
'resetPasswordConfirm',
|
74
|
+
'verifyHandleAvailability',
|
75
|
+
]);
|
25
76
|
function asAccountStore(implementation) {
|
26
|
-
if (!implementation || !isAccountStore(implementation)) {
|
77
|
+
if (!implementation || !(0, exports.isAccountStore)(implementation)) {
|
27
78
|
throw new Error('Invalid AccountStore implementation');
|
28
79
|
}
|
29
80
|
return implementation;
|
@@ -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":";;;AAwKA,wCAKC;AA7KD,2CAA4C;AAC5C,6EAA+D;AAC/D,6BAAuB;AAGvB,gDAA+C;AAC/C,iDAAsE;AACtE,wDAI2B;AAmFzB,uGAtFA,wCAAsB,OAsFA;AACtB,oGAtFA,qCAAmB,OAsFA;AACnB,wHAtFA,yDAAuC,OAsFA;AAjFzC,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,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC3D,QAAA,YAAY,GAAG,OAAC;KAC1B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CAAC,+DAA+D,CAAC,CAAA;AAC5D,QAAA,WAAW,GAAG,OAAC;KACzB,MAAM,EAAE;KACR,KAAK,EAAE;IACR,6EAA6E;IAC7E,uEAAuE;IACvE,UAAU;KACT,MAAM,CAAC,sBAAY,EAAE;IACpB,OAAO,EAAE,uBAAuB;CACjC,CAAC;KACD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,+CA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QACvD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const signInDataSchema: z.ZodObject<z.objectUtil.extendShape<{
|
3
|
+
locale: z.ZodString;
|
4
|
+
username: z.ZodString;
|
5
|
+
password: z.ZodString;
|
6
|
+
emailOtp: z.ZodOptional<z.ZodString>;
|
7
|
+
}, {
|
8
|
+
/**
|
9
|
+
* If false, the account must not be returned from
|
10
|
+
* {@link AccountStore.listDeviceAccounts}. Note that this only makes sense when
|
11
|
+
* used with a device ID.
|
12
|
+
*/
|
13
|
+
remember: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
14
|
+
}>, "strict", z.ZodTypeAny, {
|
15
|
+
locale: string;
|
16
|
+
password: string;
|
17
|
+
username: string;
|
18
|
+
remember: boolean;
|
19
|
+
emailOtp?: string | undefined;
|
20
|
+
}, {
|
21
|
+
locale: string;
|
22
|
+
password: string;
|
23
|
+
username: string;
|
24
|
+
emailOtp?: string | undefined;
|
25
|
+
remember?: boolean | undefined;
|
26
|
+
}>;
|
27
|
+
export type SignInData = z.TypeOf<typeof signInDataSchema>;
|
28
|
+
//# sourceMappingURL=sign-in-data.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign-in-data.d.ts","sourceRoot":"","sources":["../../src/account/sign-in-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,gBAAgB;;;;;;IAEzB;;;;OAIG;;;;;;;;;;;;;;EAGI,CAAA;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.signInDataSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const account_store_js_1 = require("./account-store.js");
|
6
|
+
exports.signInDataSchema = account_store_js_1.authenticateAccountDataSchema
|
7
|
+
.extend({
|
8
|
+
/**
|
9
|
+
* If false, the account must not be returned from
|
10
|
+
* {@link AccountStore.listDeviceAccounts}. Note that this only makes sense when
|
11
|
+
* used with a device ID.
|
12
|
+
*/
|
13
|
+
remember: zod_1.z.boolean().optional().default(false),
|
14
|
+
})
|
15
|
+
.strict();
|
16
|
+
//# sourceMappingURL=sign-in-data.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign-in-data.js","sourceRoot":"","sources":["../../src/account/sign-in-data.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,yDAAkE;AAErD,QAAA,gBAAgB,GAAG,gDAA6B;KAC1D,MAAM,CAAC;IACN;;;;OAIG;IACH,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAChD,CAAC;KACD,MAAM,EAAE,CAAA"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const signUpDataSchema: z.ZodObject<z.objectUtil.extendShape<{
|
3
|
+
locale: z.ZodString;
|
4
|
+
handle: z.ZodString;
|
5
|
+
email: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
6
|
+
password: z.ZodIntersection<z.ZodString, z.ZodString>;
|
7
|
+
inviteCode: z.ZodOptional<z.ZodString>;
|
8
|
+
}, {
|
9
|
+
hcaptchaToken: z.ZodOptional<z.ZodString>;
|
10
|
+
}>, "strict", z.ZodTypeAny, {
|
11
|
+
email: string;
|
12
|
+
locale: string;
|
13
|
+
password: string;
|
14
|
+
handle: string;
|
15
|
+
inviteCode?: string | undefined;
|
16
|
+
hcaptchaToken?: string | undefined;
|
17
|
+
}, {
|
18
|
+
email: string;
|
19
|
+
locale: string;
|
20
|
+
password: string;
|
21
|
+
handle: string;
|
22
|
+
inviteCode?: string | undefined;
|
23
|
+
hcaptchaToken?: string | undefined;
|
24
|
+
}>;
|
25
|
+
export type SignUpData = z.TypeOf<typeof signUpDataSchema>;
|
26
|
+
//# sourceMappingURL=sign-up-data.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sign-up-data.d.ts","sourceRoot":"","sources":["../../src/account/sign-up-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAIlB,CAAA;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.signUpDataSchema = void 0;
|
4
|
+
const hcaptcha_js_1 = require("../lib/hcaptcha.js");
|
5
|
+
const account_store_js_1 = require("./account-store.js");
|
6
|
+
exports.signUpDataSchema = account_store_js_1.createAccountDataSchema
|
7
|
+
.extend({
|
8
|
+
hcaptchaToken: hcaptcha_js_1.hcaptchaTokenSchema.optional(),
|
9
|
+
})
|
10
|
+
.strict();
|
11
|
+
//# sourceMappingURL=sign-up-data.js.map
|