@udibo/oauth2 0.14.0 → 0.15.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/README.md +45 -24
- package/{esm → dist}/adapters/hono/_common.d.ts +5 -5
- package/{esm → dist}/adapters/hono/_common.js +1 -1
- package/{esm → dist}/adapters/hono/authorization-server.d.ts +6 -7
- package/{esm → dist}/adapters/hono/authorization-server.js +0 -1
- package/{esm → dist}/adapters/hono/bff/auth-request-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/auth-request-store.js +2 -2
- package/{esm → dist}/adapters/hono/bff/bff.d.ts +22 -12
- package/{esm → dist}/adapters/hono/bff/bff.js +35 -29
- package/{esm → dist}/adapters/hono/bff/cookie-prefix.js +1 -2
- package/{esm → dist}/adapters/hono/bff/mod.d.ts +5 -6
- package/{esm → dist}/adapters/hono/bff/mod.js +1 -2
- package/{esm → dist}/adapters/hono/bff/proxy.js +2 -1
- package/{esm → dist}/adapters/hono/bff/session-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/session-store.js +7 -6
- package/{esm → dist}/adapters/hono/bff/testing.d.ts +7 -8
- package/{esm → dist}/adapters/hono/bff/testing.js +19 -22
- package/{esm → dist}/adapters/hono/identity.d.ts +1 -2
- package/{esm → dist}/adapters/hono/identity.js +10 -10
- package/{esm → dist}/adapters/hono/log.d.ts +0 -1
- package/{esm → dist}/adapters/hono/log.js +0 -6
- package/{esm → dist}/adapters/hono/resource-server.d.ts +5 -6
- package/{esm → dist}/adapters/hono/resource-server.js +0 -1
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +3 -0
- package/dist/cli/idp/config.d.ts +110 -0
- package/dist/cli/idp/config.js +269 -0
- package/dist/cli/idp/mod.d.ts +20 -0
- package/dist/cli/idp/mod.js +175 -0
- package/dist/cli/idp/pages.d.ts +56 -0
- package/dist/cli/idp/pages.js +190 -0
- package/dist/cli/idp/server.d.ts +93 -0
- package/dist/cli/idp/server.js +559 -0
- package/dist/cli/keygen.d.ts +13 -0
- package/dist/cli/keygen.js +30 -0
- package/dist/cli/mod.d.ts +34 -0
- package/dist/cli/mod.js +94 -0
- package/{esm → dist}/client/_http.d.ts +1 -1
- package/{esm → dist}/client/base.d.ts +1 -1
- package/{esm → dist}/client/bff-client.d.ts +1 -1
- package/{esm → dist}/client/bff-client.js +7 -6
- package/{esm → dist}/client/browser-storage.d.ts +1 -1
- package/{esm → dist}/client/check.js +1 -1
- package/{esm → dist}/client/direct-client.d.ts +6 -6
- package/{esm → dist}/client/direct-client.js +11 -13
- package/{esm → dist}/client/discovery-cache.d.ts +1 -1
- package/{esm → dist}/client/discovery-cache.js +2 -2
- package/{esm → dist}/client/events.d.ts +1 -1
- package/{esm → dist}/client/mod.d.ts +11 -12
- package/{esm → dist}/client/mod.js +1 -1
- package/{esm → dist}/errors.d.ts +1 -1
- package/{esm → dist}/errors.js +1 -1
- package/{esm → dist}/identity/events.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.js +1 -2
- package/{esm → dist}/identity/external/apple-client-secret.d.ts +1 -1
- package/{esm → dist}/identity/external/apple-client-secret.js +6 -7
- package/{esm → dist}/identity/external/apple.d.ts +5 -5
- package/{esm → dist}/identity/external/apple.js +10 -11
- package/{esm → dist}/identity/external/discord.d.ts +3 -3
- package/{esm → dist}/identity/external/discord.js +2 -2
- package/{esm → dist}/identity/external/flow.d.ts +1 -1
- package/{esm → dist}/identity/external/flow.js +2 -2
- package/{esm → dist}/identity/external/github.d.ts +3 -3
- package/{esm → dist}/identity/external/github.js +12 -17
- package/{esm → dist}/identity/external/google.d.ts +5 -5
- package/{esm → dist}/identity/external/google.js +2 -2
- package/{esm → dist}/identity/external/mod.d.ts +12 -13
- package/{esm → dist}/identity/external/mod.js +0 -1
- package/{esm → dist}/identity/external/oauth2.d.ts +1 -1
- package/{esm → dist}/identity/external/oauth2.js +8 -8
- package/{esm → dist}/identity/external/oidc.d.ts +4 -4
- package/{esm → dist}/identity/external/oidc.js +9 -8
- package/{esm → dist}/identity/hibp.d.ts +1 -1
- package/{esm → dist}/identity/hibp.js +1 -1
- package/{esm → dist}/identity/lockout.js +1 -2
- package/{esm → dist}/identity/mfa/mod.d.ts +4 -5
- package/{esm → dist}/identity/mfa/mod.js +1 -2
- package/{esm → dist}/identity/mfa/service.d.ts +3 -3
- package/{esm → dist}/identity/mfa/service.js +4 -3
- package/{esm → dist}/identity/mfa/totp.d.ts +1 -1
- package/{esm → dist}/identity/mfa/totp.js +2 -2
- package/{esm → dist}/identity/migration.d.ts +2 -3
- package/{esm → dist}/identity/migration.js +3 -4
- package/{esm → dist}/identity/mod.d.ts +14 -15
- package/{esm → dist}/identity/mod.js +0 -1
- package/{esm → dist}/identity/otp.d.ts +1 -1
- package/{esm → dist}/identity/otp.js +4 -2
- package/{esm → dist}/identity/password.js +8 -5
- package/{esm → dist}/identity/rate-limit.d.ts +1 -1
- package/{esm → dist}/identity/service.d.ts +10 -10
- package/{esm → dist}/identity/service.js +17 -18
- package/{esm → dist}/identity/session.js +2 -2
- package/{esm → dist}/identity/token-flow.js +3 -2
- package/{esm → dist}/models/authorization-code.d.ts +3 -3
- package/{esm → dist}/models/authorization.d.ts +1 -1
- package/{esm → dist}/models/authorization.js +1 -2
- package/{esm → dist}/models/device-authorization.d.ts +2 -2
- package/{esm → dist}/models/token.d.ts +3 -3
- package/{esm → dist}/react/callback.d.ts +1 -1
- package/{esm → dist}/react/callback.js +0 -1
- package/{esm → dist}/react/components/class-names.d.ts +1 -1
- package/{esm → dist}/react/components/class-names.js +3 -2
- package/{esm → dist}/react/components/internal.d.ts +2 -2
- package/{esm → dist}/react/components/internal.js +5 -11
- package/{esm → dist}/react/components/mfa-challenge-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-challenge-form.js +4 -6
- package/{esm → dist}/react/components/mfa-enrollment-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-enrollment-form.js +2 -6
- package/{esm → dist}/react/components/mod.d.ts +20 -21
- package/{esm → dist}/react/components/mod.js +1 -2
- package/{esm → dist}/react/components/request-password-reset-form.d.ts +2 -2
- package/{esm → dist}/react/components/request-password-reset-form.js +1 -3
- package/{esm → dist}/react/components/reset-password-form.d.ts +2 -2
- package/{esm → dist}/react/components/reset-password-form.js +2 -2
- package/{esm → dist}/react/components/sign-in-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-in-form.js +1 -5
- package/{esm → dist}/react/components/sign-up-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-up-form.js +4 -10
- package/{esm → dist}/react/components/types.d.ts +2 -2
- package/{esm → dist}/react/components/use-auth-form.d.ts +3 -3
- package/{esm → dist}/react/components/use-auth-form.js +4 -7
- package/{esm → dist}/react/components/user-menu.d.ts +2 -2
- package/{esm → dist}/react/components/user-menu.js +9 -14
- package/{esm → dist}/react/context.d.ts +1 -1
- package/{esm → dist}/react/mod.d.ts +6 -7
- package/{esm → dist}/react/mod.js +0 -1
- package/{esm → dist}/react/provider.d.ts +2 -2
- package/{esm → dist}/react/require-auth.js +1 -3
- package/{esm → dist}/react/testing.d.ts +2 -3
- package/{esm → dist}/react/testing.js +1 -2
- package/{esm → dist}/react/use-authorization.d.ts +1 -1
- package/{esm → dist}/react/use-oauth2.d.ts +8 -1
- package/{esm → dist}/react/use-oauth2.js +0 -1
- package/{esm → dist}/server/_clock-skew.js +2 -1
- package/{esm → dist}/server/authorization-server.d.ts +40 -41
- package/{esm → dist}/server/authorization-server.js +32 -42
- package/{esm → dist}/server/client-authentication.d.ts +2 -2
- package/{esm → dist}/server/grants/authorization-code.d.ts +9 -9
- package/{esm → dist}/server/grants/authorization-code.js +5 -6
- package/{esm → dist}/server/grants/client-credentials.d.ts +4 -4
- package/{esm → dist}/server/grants/device-authorization.d.ts +6 -6
- package/{esm → dist}/server/grants/device-authorization.js +4 -4
- package/{esm → dist}/server/grants/grant.d.ts +7 -7
- package/{esm → dist}/server/grants/grant.js +7 -7
- package/{esm → dist}/server/grants/password.d.ts +5 -5
- package/{esm → dist}/server/grants/refresh-token.d.ts +4 -4
- package/{esm → dist}/server/grants/refresh-token.js +5 -6
- package/{esm → dist}/server/introspection-token-reader.d.ts +5 -5
- package/{esm → dist}/server/introspection-token-reader.js +4 -4
- package/{esm → dist}/server/jwks-token-reader.d.ts +5 -5
- package/{esm → dist}/server/jwks-token-reader.js +4 -4
- package/{esm → dist}/server/mod.d.ts +12 -13
- package/{esm → dist}/server/mod.js +0 -1
- package/{esm → dist}/server/public-suffix/mod.d.ts +2 -3
- package/{esm → dist}/server/public-suffix/mod.js +1 -2
- package/{esm → dist}/server/public-suffix/rules.d.ts +1 -1
- package/{esm → dist}/server/public-suffix/rules.js +1 -1
- package/{esm → dist}/server/redirect-uri.js +5 -4
- package/{esm → dist}/server/resource-server.d.ts +11 -12
- package/{esm → dist}/server/resource-server.js +12 -14
- package/{esm → dist}/server/services/authorization-code.d.ts +5 -5
- package/{esm → dist}/server/services/client.d.ts +1 -1
- package/{esm → dist}/server/services/device-authorization.d.ts +3 -3
- package/{esm → dist}/server/services/token.d.ts +6 -6
- package/{esm → dist}/server/services/token.js +3 -1
- package/{esm → dist}/server/services/user.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.js +8 -2
- package/{esm → dist}/server/utils/hash.js +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.d.ts +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.js +24 -29
- package/{esm → dist}/testing/contract/authorization-code.d.ts +6 -6
- package/{esm → dist}/testing/contract/authorization-code.js +16 -17
- package/{esm → dist}/testing/contract/client.d.ts +4 -4
- package/{esm → dist}/testing/contract/client.js +14 -15
- package/{esm → dist}/testing/contract/device-authorization.d.ts +6 -6
- package/{esm → dist}/testing/contract/device-authorization.js +37 -39
- package/{esm → dist}/testing/contract/identity-session.d.ts +6 -1
- package/{esm → dist}/testing/contract/identity-session.js +44 -36
- package/{esm → dist}/testing/contract/identity-user-store.d.ts +8 -2
- package/{esm → dist}/testing/contract/identity-user-store.js +48 -46
- package/{esm → dist}/testing/contract/lockout-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/lockout-store.js +23 -24
- package/{esm → dist}/testing/contract/mfa-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/mfa-store.js +53 -54
- package/{esm → dist}/testing/contract/mod.d.ts +15 -16
- package/{esm → dist}/testing/contract/mod.js +0 -1
- package/{esm → dist}/testing/contract/otp-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/otp-store.js +33 -34
- package/{esm → dist}/testing/contract/rate-limit-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/rate-limit-store.js +15 -16
- package/{esm → dist}/testing/contract/tenant.js +361 -330
- package/{esm → dist}/testing/contract/token-flow-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/token-flow-store.js +27 -32
- package/{esm → dist}/testing/contract/token-reader.d.ts +3 -3
- package/{esm → dist}/testing/contract/token-reader.js +6 -7
- package/{esm → dist}/testing/contract/token.d.ts +7 -7
- package/{esm → dist}/testing/contract/token.js +48 -53
- package/{esm → dist}/testing/contract/user.d.ts +2 -2
- package/{esm → dist}/testing/contract/user.js +8 -9
- package/{esm → dist}/testing/mod.d.ts +5 -6
- package/{esm → dist}/testing/mod.js +2 -3
- package/{esm → dist}/testing/server.d.ts +7 -6
- package/{esm → dist}/testing/server.js +2 -1
- package/{esm → dist}/testing/services.d.ts +11 -11
- package/{esm → dist}/testing/services.js +8 -8
- package/{esm → dist}/testing/tenant.d.ts +11 -7
- package/{esm → dist}/testing/tenant.js +109 -94
- package/dist/utils/_constant-time.d.ts +12 -0
- package/dist/utils/_constant-time.js +19 -0
- package/{esm → dist}/utils/_default-fetch.js +4 -1
- package/dist/utils/_delay.d.ts +13 -0
- package/dist/utils/_delay.js +28 -0
- package/dist/utils/_encoding.d.ts +39 -0
- package/dist/utils/_encoding.js +126 -0
- package/{esm → dist}/utils/authentication-context.d.ts +1 -1
- package/{esm → dist}/utils/crypto.d.ts +2 -3
- package/{esm → dist}/utils/crypto.js +3 -4
- package/{esm → dist}/utils/pkce.js +1 -1
- package/{esm → dist}/utils/text.js +1 -1
- package/{esm → dist}/utils/url.d.ts +0 -1
- package/{esm → dist}/utils/url.js +0 -1
- package/package.json +156 -33
- package/esm/_dnt.polyfills.d.ts +0 -31
- package/esm/_dnt.polyfills.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +0 -47
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +0 -65
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +0 -16
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +0 -25
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +0 -193
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +0 -36
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +0 -61
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +0 -27
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +0 -52
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +0 -43
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +0 -45
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +0 -39
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +0 -32
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +0 -177
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +0 -41
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +0 -58
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +0 -20
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +0 -44
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +0 -84
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -39
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +0 -22
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +0 -51
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +0 -192
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +0 -113
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +0 -3
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +0 -13
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +0 -8
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +0 -2
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +0 -26
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +0 -60
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +0 -152
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +0 -131
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +0 -82
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +0 -72
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +0 -38
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +0 -97
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +0 -99
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +0 -119
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +0 -209
- package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +0 -343
- package/esm/deps/jsr.io/@std/http/1.1.3/status.js +0 -343
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +0 -159
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +0 -223
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +0 -79
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +0 -116
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +0 -139
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +0 -277
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +0 -98
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +0 -181
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +0 -29
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +0 -68
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +0 -158
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +0 -206
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +0 -24
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +0 -3
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +0 -91
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +0 -347
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +0 -382
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +0 -1110
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +0 -363
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +0 -616
- package/esm/package.json +0 -3
- /package/{esm → dist}/adapters/hono/bff/cookie-prefix.d.ts +0 -0
- /package/{esm → dist}/adapters/hono/bff/proxy.d.ts +0 -0
- /package/{esm → dist}/client/_http.js +0 -0
- /package/{esm → dist}/client/base.js +0 -0
- /package/{esm → dist}/client/browser-storage.js +0 -0
- /package/{esm → dist}/client/check.d.ts +0 -0
- /package/{esm → dist}/client/events.js +0 -0
- /package/{esm → dist}/client/storage.d.ts +0 -0
- /package/{esm → dist}/client/storage.js +0 -0
- /package/{esm → dist}/identity/captcha.d.ts +0 -0
- /package/{esm → dist}/identity/captcha.js +0 -0
- /package/{esm → dist}/identity/delivery.d.ts +0 -0
- /package/{esm → dist}/identity/delivery.js +0 -0
- /package/{esm → dist}/identity/errors.d.ts +0 -0
- /package/{esm → dist}/identity/errors.js +0 -0
- /package/{esm → dist}/identity/events.js +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.d.ts +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.js +0 -0
- /package/{esm → dist}/identity/external/errors.d.ts +0 -0
- /package/{esm → dist}/identity/external/errors.js +0 -0
- /package/{esm → dist}/identity/external/provider.d.ts +0 -0
- /package/{esm → dist}/identity/external/provider.js +0 -0
- /package/{esm → dist}/identity/identifier.d.ts +0 -0
- /package/{esm → dist}/identity/identifier.js +0 -0
- /package/{esm → dist}/identity/lockout.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.js +0 -0
- /package/{esm → dist}/identity/password-policy.d.ts +0 -0
- /package/{esm → dist}/identity/password-policy.js +0 -0
- /package/{esm → dist}/identity/password.d.ts +0 -0
- /package/{esm → dist}/identity/rate-limit.js +0 -0
- /package/{esm → dist}/identity/session.d.ts +0 -0
- /package/{esm → dist}/identity/token-flow.d.ts +0 -0
- /package/{esm → dist}/models/authentication.d.ts +0 -0
- /package/{esm → dist}/models/authentication.js +0 -0
- /package/{esm → dist}/models/authorization-code.js +0 -0
- /package/{esm → dist}/models/client.d.ts +0 -0
- /package/{esm → dist}/models/client.js +0 -0
- /package/{esm → dist}/models/device-authorization.js +0 -0
- /package/{esm → dist}/models/responses.d.ts +0 -0
- /package/{esm → dist}/models/responses.js +0 -0
- /package/{esm → dist}/models/scope.d.ts +0 -0
- /package/{esm → dist}/models/scope.js +0 -0
- /package/{esm → dist}/models/token.js +0 -0
- /package/{esm → dist}/react/components/types.js +0 -0
- /package/{esm → dist}/react/context.js +0 -0
- /package/{esm → dist}/react/provider.js +0 -0
- /package/{esm → dist}/react/require-auth.d.ts +0 -0
- /package/{esm → dist}/react/use-authorization.js +0 -0
- /package/{esm → dist}/server/_clock-skew.d.ts +0 -0
- /package/{esm → dist}/server/client-authentication.js +0 -0
- /package/{esm → dist}/server/grants/client-credentials.js +0 -0
- /package/{esm → dist}/server/grants/password.js +0 -0
- /package/{esm → dist}/server/redirect-uri.d.ts +0 -0
- /package/{esm → dist}/server/services/authorization-code.js +0 -0
- /package/{esm → dist}/server/services/client.js +0 -0
- /package/{esm → dist}/server/services/device-authorization.js +0 -0
- /package/{esm → dist}/server/services/user.js +0 -0
- /package/{esm → dist}/server/utils/hash.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.js +0 -0
- /package/{esm → dist}/testing/contract/tenant.d.ts +0 -0
- /package/{esm → dist}/utils/_body.d.ts +0 -0
- /package/{esm → dist}/utils/_body.js +0 -0
- /package/{esm → dist}/utils/_buffer.d.ts +0 -0
- /package/{esm → dist}/utils/_buffer.js +0 -0
- /package/{esm → dist}/utils/_default-fetch.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.js +0 -0
- /package/{esm → dist}/utils/authentication-context.js +0 -0
- /package/{esm → dist}/utils/basic-auth.d.ts +0 -0
- /package/{esm → dist}/utils/basic-auth.js +0 -0
- /package/{esm → dist}/utils/pkce.d.ts +0 -0
- /package/{esm → dist}/utils/text.d.ts +0 -0
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import { delay } from "../
|
|
20
|
+
import { delay } from "../utils/_delay.js";
|
|
21
21
|
import { buildResetUrl, buildSignInUrl, buildUnlockUrl, buildVerificationUrl, } from "./delivery.js";
|
|
22
22
|
import { PasswordIdentityService, } from "./password.js";
|
|
23
23
|
import { TokenPurpose, } from "./token-flow.js";
|
|
@@ -82,8 +82,7 @@ export class IdentityService {
|
|
|
82
82
|
this.#rateLimiters = {
|
|
83
83
|
signIn: options.rateLimiters?.signIn ?? options.rateLimiter,
|
|
84
84
|
passwordReset: options.rateLimiters?.passwordReset ?? options.rateLimiter,
|
|
85
|
-
emailVerification: options.rateLimiters?.emailVerification ??
|
|
86
|
-
options.rateLimiter,
|
|
85
|
+
emailVerification: options.rateLimiters?.emailVerification ?? options.rateLimiter,
|
|
87
86
|
accountUnlock: options.rateLimiters?.accountUnlock ?? options.rateLimiter,
|
|
88
87
|
signInLink: options.rateLimiters?.signInLink ?? options.rateLimiter,
|
|
89
88
|
signInCode: options.rateLimiters?.signInCode ?? options.rateLimiter,
|
|
@@ -102,11 +101,11 @@ export class IdentityService {
|
|
|
102
101
|
this.#legacyVerifiers = options.legacyVerifiers?.length
|
|
103
102
|
? options.legacyVerifiers
|
|
104
103
|
: undefined;
|
|
105
|
-
const floor = options.failedSignInFloorMs ??
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const floor = options.failedSignInFloorMs ?? DEFAULT_FAILED_SIGN_IN_FLOOR_MS;
|
|
105
|
+
this.#failedSignInFloorMs =
|
|
106
|
+
Number.isFinite(floor) && floor >= 0
|
|
107
|
+
? floor
|
|
108
|
+
: DEFAULT_FAILED_SIGN_IN_FLOOR_MS;
|
|
110
109
|
}
|
|
111
110
|
/**
|
|
112
111
|
* Create a user with a hashed password. `profile` is your app's own fields.
|
|
@@ -615,8 +614,7 @@ export class IdentityService {
|
|
|
615
614
|
await this.#passwords.hash(password);
|
|
616
615
|
}
|
|
617
616
|
async #rejectSignIn(startedAt) {
|
|
618
|
-
const remaining = this.#failedSignInFloorMs -
|
|
619
|
-
(performance.now() - startedAt);
|
|
617
|
+
const remaining = this.#failedSignInFloorMs - (performance.now() - startedAt);
|
|
620
618
|
if (remaining > 0)
|
|
621
619
|
await delay(remaining);
|
|
622
620
|
return null;
|
|
@@ -639,24 +637,26 @@ export class IdentityService {
|
|
|
639
637
|
const credential = await this.#users.getCredential(userId);
|
|
640
638
|
// Native credential is authoritative: only try an imported hash when there
|
|
641
639
|
// is none, so a wrong password can't resurrect a stale one (no downgrade).
|
|
642
|
-
const legacyHash = credential
|
|
640
|
+
const legacyHash = credential
|
|
641
|
+
? null
|
|
642
|
+
: await this.#getLegacyCredential(userId);
|
|
643
643
|
if (!credential && !legacyHash) {
|
|
644
644
|
await this.#equalizeTiming(password);
|
|
645
645
|
return "no_password";
|
|
646
646
|
}
|
|
647
|
-
if (credential && await this.#passwords.verify(password, credential)) {
|
|
648
|
-
return await this.#rehashCredential(userId, password, credential)
|
|
647
|
+
if (credential && (await this.#passwords.verify(password, credential))) {
|
|
648
|
+
return (await this.#rehashCredential(userId, password, credential))
|
|
649
649
|
? "authenticated"
|
|
650
650
|
: "wrong_password";
|
|
651
651
|
}
|
|
652
652
|
if (!legacyHash)
|
|
653
653
|
return "wrong_password";
|
|
654
654
|
const verifier = findLegacyVerifier(this.#legacyVerifiers, legacyHash);
|
|
655
|
-
if (!verifier || !await this.#tryLegacy(verifier, password, legacyHash)) {
|
|
655
|
+
if (!verifier || !(await this.#tryLegacy(verifier, password, legacyHash))) {
|
|
656
656
|
await this.#equalizeTiming(password);
|
|
657
657
|
return "wrong_password";
|
|
658
658
|
}
|
|
659
|
-
return await this.#upgradeCredential(userId, password, verifier.id)
|
|
659
|
+
return (await this.#upgradeCredential(userId, password, verifier.id))
|
|
660
660
|
? "authenticated"
|
|
661
661
|
: "wrong_password";
|
|
662
662
|
}
|
|
@@ -672,7 +672,7 @@ export class IdentityService {
|
|
|
672
672
|
this.#logPersistFailure("password rehash", error);
|
|
673
673
|
return true;
|
|
674
674
|
}
|
|
675
|
-
return replaced || await this.#verifyCurrentCredential(userId, password);
|
|
675
|
+
return replaced || (await this.#verifyCurrentCredential(userId, password));
|
|
676
676
|
}
|
|
677
677
|
async #upgradeCredential(userId, password, verifierId) {
|
|
678
678
|
if (!this.#users.replaceCredential)
|
|
@@ -698,8 +698,7 @@ export class IdentityService {
|
|
|
698
698
|
}
|
|
699
699
|
async #verifyCurrentCredential(userId, password) {
|
|
700
700
|
const current = await this.#users.getCredential(userId);
|
|
701
|
-
return current !== undefined &&
|
|
702
|
-
await this.#passwords.verify(password, current);
|
|
701
|
+
return (current !== undefined && (await this.#passwords.verify(password, current)));
|
|
703
702
|
}
|
|
704
703
|
#logPersistFailure(operation, error) {
|
|
705
704
|
console.error(`[@udibo/oauth2] ${operation} persist failed:`, error instanceof Error ? error.message : error);
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* stateless one that only revokes returns `false`.
|
|
26
26
|
*/
|
|
27
27
|
export function supportsSessionListing(service) {
|
|
28
|
-
return typeof service.listByUser ===
|
|
29
|
-
"function";
|
|
28
|
+
return (typeof service.listByUser ===
|
|
29
|
+
"function");
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Whether a session authenticated within `maxAgeMs` — a recent-auth ("step-up")
|
|
@@ -98,7 +98,7 @@ export class TokenFlowService {
|
|
|
98
98
|
const status = this.#statusOf(await this.#store.get(tokenHash), purpose);
|
|
99
99
|
if (status.status !== "valid")
|
|
100
100
|
return null;
|
|
101
|
-
if (!await this.#store.markConsumed(tokenHash, Date.now()))
|
|
101
|
+
if (!(await this.#store.markConsumed(tokenHash, Date.now())))
|
|
102
102
|
return null;
|
|
103
103
|
return { subject: status.subject, data: status.data };
|
|
104
104
|
}
|
|
@@ -162,7 +162,8 @@ export class MemoryTokenFlowStore {
|
|
|
162
162
|
*/
|
|
163
163
|
deleteBySubject(purpose, subject) {
|
|
164
164
|
for (const [hash, record] of this.#byHash) {
|
|
165
|
-
if (record.purpose === purpose &&
|
|
165
|
+
if (record.purpose === purpose &&
|
|
166
|
+
record.subject === subject &&
|
|
166
167
|
record.consumedAt === undefined) {
|
|
167
168
|
this.#byHash.delete(hash);
|
|
168
169
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AbstractScope, BasicScope } from "./scope.
|
|
2
|
-
import type { ClientInterface } from "./client.
|
|
3
|
-
import type { AuthenticationContext } from "./authentication.
|
|
1
|
+
import type { AbstractScope, BasicScope } from "./scope.ts";
|
|
2
|
+
import type { ClientInterface } from "./client.ts";
|
|
3
|
+
import type { AuthenticationContext } from "./authentication.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Authorization code model.
|
|
6
6
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
|
-
import type { AbstractScope } from "./scope.
|
|
19
|
+
import type { AbstractScope } from "./scope.ts";
|
|
20
20
|
/**
|
|
21
21
|
* The active organization a credential was issued in: the one organization
|
|
22
22
|
* whose roles and permissions the credential carries. Absent (`null` on
|
|
@@ -88,8 +88,7 @@ export class Authorization {
|
|
|
88
88
|
return false;
|
|
89
89
|
if (idOrSlug === undefined)
|
|
90
90
|
return true;
|
|
91
|
-
return this.organization.id === idOrSlug ||
|
|
92
|
-
this.organization.slug === idOrSlug;
|
|
91
|
+
return (this.organization.id === idOrSlug || this.organization.slug === idOrSlug);
|
|
93
92
|
}
|
|
94
93
|
/**
|
|
95
94
|
* The first non-scope condition this authorization does not satisfy, or
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ClientInterface } from "./client.
|
|
2
|
-
import type { AbstractScope, BasicScope } from "./scope.
|
|
1
|
+
import type { ClientInterface } from "./client.ts";
|
|
2
|
+
import type { AbstractScope, BasicScope } from "./scope.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Device authorization request stored by the service.
|
|
5
5
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AbstractScope, BasicScope } from "./scope.
|
|
2
|
-
import type { ClientInterface } from "./client.
|
|
3
|
-
import type { AuthenticationContext } from "./authentication.
|
|
1
|
+
import type { AbstractScope, BasicScope } from "./scope.ts";
|
|
2
|
+
import type { ClientInterface } from "./client.ts";
|
|
3
|
+
import type { AuthenticationContext } from "./authentication.ts";
|
|
4
4
|
/**
|
|
5
5
|
* Token model representing an access token.
|
|
6
6
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
16
|
import { type ReactNode } from "react";
|
|
17
|
-
import { type OAuth2Error } from "../client/mod.
|
|
17
|
+
import { type OAuth2Error } from "../client/mod.ts";
|
|
18
18
|
/** Props for {@link OAuth2Callback}. */
|
|
19
19
|
export interface OAuth2CallbackProps {
|
|
20
20
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// deno-lint-ignore-file no-window -- browser-only; `window` used only after isBrowser() guards
|
|
3
2
|
/**
|
|
4
3
|
* `<OAuth2Callback>` — mount on the SPA's callback route when the app runs a
|
|
5
4
|
* `DirectClient`. Calls `client.handleAuthorizationCallback` with the current
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import { type ReactNode } from "react";
|
|
15
|
-
import type { AuthFormClassNames } from "./types.
|
|
15
|
+
import type { AuthFormClassNames } from "./types.ts";
|
|
16
16
|
/**
|
|
17
17
|
* Resolves the per-slot class map for this position in the tree: the nearest
|
|
18
18
|
* {@link AuthFormClassNamesProvider}'s map with `overrides` applied slot by
|
|
@@ -27,7 +27,7 @@ function merge(inherited, overrides) {
|
|
|
27
27
|
function slotKey(classNames) {
|
|
28
28
|
const slots = Object.entries(classNames)
|
|
29
29
|
.filter(([, value]) => value !== undefined)
|
|
30
|
-
.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
30
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
31
31
|
return JSON.stringify(slots);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -66,7 +66,8 @@ export function useAuthFormClassNames(overrides) {
|
|
|
66
66
|
const inherited = useContext(AuthFormClassNamesContext);
|
|
67
67
|
const key = overrides ? slotKey(overrides) : "";
|
|
68
68
|
const held = useRef(null);
|
|
69
|
-
if (held.current === null ||
|
|
69
|
+
if (held.current === null ||
|
|
70
|
+
held.current.inherited !== inherited ||
|
|
70
71
|
held.current.key !== key) {
|
|
71
72
|
held.current = {
|
|
72
73
|
inherited,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, type Ref } from "react";
|
|
2
|
-
import type { AuthFieldProps, AuthFormState } from "./use-auth-form.
|
|
3
|
-
import type { AuthFormClassNames, AuthFormValues, SocialProvidersProps } from "./types.
|
|
2
|
+
import type { AuthFieldProps, AuthFormState } from "./use-auth-form.ts";
|
|
3
|
+
import type { AuthFormClassNames, AuthFormValues, SocialProvidersProps } from "./types.ts";
|
|
4
4
|
/**
|
|
5
5
|
* What every default form component returns: the shared root, `<form>` and
|
|
6
6
|
* error summary, or the caller's `render` output instead, with the resolved
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, } from "react";
|
|
3
3
|
import { AuthFormClassNamesScope, useAuthFormClassNames, } from "./class-names.js";
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import { AuthFormClassNamesScope, useAuthFormClassNames, } from "./class-names.j
|
|
|
9
9
|
*/
|
|
10
10
|
export function AuthFormShell(props) {
|
|
11
11
|
const { name, form, className, classNames, render, rootProps, aboveForm, succeeded, children, action, method, formRef, } = props;
|
|
12
|
-
return (_jsx(AuthFormClassNamesScope, { classNames: classNames, children: render ? render(form) : (_jsxs("div", { "data-oauth2-form": name, ...rootProps, className: combineClassNames(className, classNames.root), children: [aboveForm, succeeded ?? (_jsxs("form", { onSubmit: form.handleSubmit, action: action, method: method ?? (action ? "post" : undefined), ref: formRef, noValidate: true, "data-oauth2-form-element": "", className: classNames.form, children: [_jsx(ErrorSummary, { error: form.formError, focusTrigger: form.submitCount }), children] }))] })) }));
|
|
12
|
+
return (_jsx(AuthFormClassNamesScope, { classNames: classNames, children: render ? (render(form)) : (_jsxs("div", { "data-oauth2-form": name, ...rootProps, className: combineClassNames(className, classNames.root), children: [aboveForm, succeeded ?? (_jsxs("form", { onSubmit: form.handleSubmit, action: action, method: method ?? (action ? "post" : undefined), ref: formRef, noValidate: true, "data-oauth2-form-element": "", className: classNames.form, children: [_jsx(ErrorSummary, { error: form.formError, focusTrigger: form.submitCount }), children] }))] })) }));
|
|
13
13
|
}
|
|
14
14
|
function ignoreActivation(event) {
|
|
15
15
|
event.preventDefault();
|
|
@@ -22,9 +22,7 @@ export function SubmitButton(props) {
|
|
|
22
22
|
export function TextField(props) {
|
|
23
23
|
const { fieldProps, label, type = "text", autoComplete, required, error, inputRef, children, } = props;
|
|
24
24
|
const classNames = useAuthFormClassNames();
|
|
25
|
-
return (_jsxs("div", { "data-oauth2-field": fieldProps.name, className: classNames.field, children: [_jsx("label", { htmlFor: fieldProps.id, "data-oauth2-label": "", className: classNames.label, children: label }), _jsx("input", { ...fieldProps, type: type, autoComplete: autoComplete, required: required, "data-oauth2-input": "", className: classNames.input, ref: inputRef }), children, error
|
|
26
|
-
? (_jsx("p", { id: `${fieldProps.id}-error`, role: "alert", "data-oauth2-error": "", className: classNames.error, children: error }))
|
|
27
|
-
: null] }));
|
|
25
|
+
return (_jsxs("div", { "data-oauth2-field": fieldProps.name, className: classNames.field, children: [_jsx("label", { htmlFor: fieldProps.id, "data-oauth2-label": "", className: classNames.label, children: label }), _jsx("input", { ...fieldProps, type: type, autoComplete: autoComplete, required: required, "data-oauth2-input": "", className: classNames.input, ref: inputRef }), children, error ? (_jsx("p", { id: `${fieldProps.id}-error`, role: "alert", "data-oauth2-error": "", className: classNames.error, children: error })) : null] }));
|
|
28
26
|
}
|
|
29
27
|
export function ErrorSummary(props) {
|
|
30
28
|
const { error, focusTrigger } = props;
|
|
@@ -68,12 +66,8 @@ export function SocialButtons(props) {
|
|
|
68
66
|
const classNames = useAuthFormClassNames();
|
|
69
67
|
if (!socialProviders || socialProviders.length === 0)
|
|
70
68
|
return null;
|
|
71
|
-
const label = (provider) => (_jsxs(_Fragment, { children: [provider.iconSlot
|
|
72
|
-
|
|
73
|
-
: null, _jsxs("span", { "data-oauth2-social-label": "", children: ["Continue with ", provider.name] })] }));
|
|
74
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { "data-oauth2-social": "", className: classNames.socialSection, children: socialProviders.map((provider) => socialHref
|
|
75
|
-
? (_jsx("a", { href: socialHref(provider), "data-oauth2-social-button": provider.id, className: classNames.socialButton, children: label(provider) }, provider.id))
|
|
76
|
-
: (_jsx("button", { type: "button", onClick: () => onSocialSelect?.(provider), "data-oauth2-social-button": provider.id, className: classNames.socialButton, children: label(provider) }, provider.id))) }), _jsx("div", { "data-oauth2-social-divider": "", "aria-hidden": "true", className: classNames.socialDivider })] }));
|
|
69
|
+
const label = (provider) => (_jsxs(_Fragment, { children: [provider.iconSlot ? (_jsx("span", { "data-oauth2-social-icon": "", children: provider.iconSlot })) : null, _jsxs("span", { "data-oauth2-social-label": "", children: ["Continue with ", provider.name] })] }));
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { "data-oauth2-social": "", className: classNames.socialSection, children: socialProviders.map((provider) => socialHref ? (_jsx("a", { href: socialHref(provider), "data-oauth2-social-button": provider.id, className: classNames.socialButton, children: label(provider) }, provider.id)) : (_jsx("button", { type: "button", onClick: () => onSocialSelect?.(provider), "data-oauth2-social-button": provider.id, className: classNames.socialButton, children: label(provider) }, provider.id))) }), _jsx("div", { "data-oauth2-social-divider": "", "aria-hidden": "true", className: classNames.socialDivider })] }));
|
|
77
71
|
}
|
|
78
72
|
export function combineClassNames(className, slot) {
|
|
79
73
|
return [className, slot].filter(Boolean).join(" ") || undefined;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import type { ReactNode } from "react";
|
|
10
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
11
|
-
import type { BaseAuthFormProps } from "./types.
|
|
10
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
11
|
+
import type { BaseAuthFormProps } from "./types.ts";
|
|
12
12
|
/** Which credential the user is submitting. */
|
|
13
13
|
export type MfaChallengeMethod = "totp" | "recovery";
|
|
14
14
|
/** Values collected by {@link MfaChallengeForm}. */
|
|
@@ -37,10 +37,8 @@ export function MfaChallengeForm(props) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
return (_jsxs(AuthFormShell, { name: "mfa-challenge", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, rootProps: { "data-oauth2-method": form.values.method }, children: [_jsx(TextField, { fieldProps: form.getFieldProps("code"), label: isRecovery
|
|
40
|
-
? labels?.recoveryCode ?? "Recovery code"
|
|
41
|
-
: labels?.code ?? "Authentication code", autoComplete: isRecovery ? "off" : "one-time-code", required: true, error: form.errors.code }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Verify", submittingLabel: labels?.submitting ?? "Verifying…" }), allowRecoveryCode
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
: labels?.useRecovery ?? "Use a recovery code" }))
|
|
45
|
-
: null] }));
|
|
40
|
+
? (labels?.recoveryCode ?? "Recovery code")
|
|
41
|
+
: (labels?.code ?? "Authentication code"), autoComplete: isRecovery ? "off" : "one-time-code", required: true, error: form.errors.code }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Verify", submittingLabel: labels?.submitting ?? "Verifying…" }), allowRecoveryCode ? (_jsx("button", { type: "button", onClick: toggleMethod, "data-oauth2-secondary": "", "data-oauth2-toggle-recovery": "", className: classNames.secondary, children: isRecovery
|
|
42
|
+
? (labels?.useAuthenticator ?? "Use your authenticator app")
|
|
43
|
+
: (labels?.useRecovery ?? "Use a recovery code") })) : null] }));
|
|
46
44
|
}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import type { ReactNode } from "react";
|
|
13
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
14
|
-
import type { BaseAuthFormProps } from "./types.
|
|
13
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
14
|
+
import type { BaseAuthFormProps } from "./types.ts";
|
|
15
15
|
/** The enrollment secret material to display, produced server-side. */
|
|
16
16
|
export interface MfaEnrollmentData {
|
|
17
17
|
/** Base32 shared secret for manual entry into an authenticator app. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAuthForm } from "./use-auth-form.js";
|
|
3
3
|
import { AuthFormShell, SubmitButton, TextField, useFocusFirstError, } from "./internal.js";
|
|
4
4
|
import { useAuthFormClassNames } from "./class-names.js";
|
|
@@ -33,9 +33,5 @@ export function MfaEnrollmentForm(props) {
|
|
|
33
33
|
useFocusFirstError(form);
|
|
34
34
|
const classNames = useAuthFormClassNames(props.classNames);
|
|
35
35
|
const qr = typeof qrSlot === "function" ? qrSlot(data.otpauthUri) : qrSlot;
|
|
36
|
-
return (_jsxs(AuthFormShell, { name: "mfa-enrollment", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsxs(_Fragment, { children: [_jsxs("div", { "data-oauth2-secret": "", className: classNames.secret, children: [_jsx("p", { role: "heading", "aria-level": 2, "data-oauth2-secret-heading": "", children: labels?.secretHeading ?? "Scan this QR code" }), qr
|
|
37
|
-
? _jsx("div", { "data-oauth2-qr": "", className: classNames.qr, children: qr })
|
|
38
|
-
: null, _jsxs("p", { "data-oauth2-secret-hint": "", children: [labels?.secretHint ?? "Or enter this code:", " ", _jsx("code", { "data-oauth2-secret-value": "", children: data.secret })] })] }), data.recoveryCodes && data.recoveryCodes.length > 0
|
|
39
|
-
? (_jsxs("div", { "data-oauth2-recovery": "", children: [_jsx("p", { role: "heading", "aria-level": 2, "data-oauth2-recovery-heading": "", children: labels?.recoveryHeading ?? "Save your recovery codes" }), _jsx("ul", { "data-oauth2-recovery-codes": "", className: classNames.recoveryCodes, children: data.recoveryCodes.map((recoveryCode) => (_jsx("li", { "data-oauth2-recovery-code": "", className: classNames.recoveryCode, children: _jsx("code", { children: recoveryCode }) }, recoveryCode))) })] }))
|
|
40
|
-
: null] }), children: [_jsx(TextField, { fieldProps: form.getFieldProps("code"), label: labels?.code ?? "Authentication code", autoComplete: "one-time-code", required: true, error: form.errors.code }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Confirm", submittingLabel: labels?.submitting ?? "Confirming…" })] }));
|
|
36
|
+
return (_jsxs(AuthFormShell, { name: "mfa-enrollment", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsxs(_Fragment, { children: [_jsxs("div", { "data-oauth2-secret": "", className: classNames.secret, children: [_jsx("p", { role: "heading", "aria-level": 2, "data-oauth2-secret-heading": "", children: labels?.secretHeading ?? "Scan this QR code" }), qr ? (_jsx("div", { "data-oauth2-qr": "", className: classNames.qr, children: qr })) : null, _jsxs("p", { "data-oauth2-secret-hint": "", children: [labels?.secretHint ?? "Or enter this code:", " ", _jsx("code", { "data-oauth2-secret-value": "", children: data.secret })] })] }), data.recoveryCodes && data.recoveryCodes.length > 0 ? (_jsxs("div", { "data-oauth2-recovery": "", children: [_jsx("p", { role: "heading", "aria-level": 2, "data-oauth2-recovery-heading": "", children: labels?.recoveryHeading ?? "Save your recovery codes" }), _jsx("ul", { "data-oauth2-recovery-codes": "", className: classNames.recoveryCodes, children: data.recoveryCodes.map((recoveryCode) => (_jsx("li", { "data-oauth2-recovery-code": "", className: classNames.recoveryCode, children: _jsx("code", { children: recoveryCode }) }, recoveryCode))) })] })) : null] }), children: [_jsx(TextField, { fieldProps: form.getFieldProps("code"), label: labels?.code ?? "Authentication code", autoComplete: "one-time-code", required: true, error: form.errors.code }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Confirm", submittingLabel: labels?.submitting ?? "Confirming…" })] }));
|
|
41
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prebuilt React auth components for `@udibo/oauth2` — the composable,
|
|
3
3
|
* headless-first, themeable form set an app assembles into its own auth
|
|
4
|
-
* surface. Works
|
|
4
|
+
* surface. Works with React Router v7 in data or framework mode.
|
|
5
5
|
*
|
|
6
6
|
* These components are **composed by your app**: you own the routes, storage,
|
|
7
7
|
* session, and the submit wiring. Nothing here mounts routes, talks to a
|
|
@@ -83,23 +83,22 @@
|
|
|
83
83
|
*
|
|
84
84
|
* @module
|
|
85
85
|
*/
|
|
86
|
-
|
|
87
|
-
export {
|
|
88
|
-
export type {
|
|
89
|
-
export
|
|
90
|
-
export {
|
|
91
|
-
export
|
|
92
|
-
export {
|
|
93
|
-
export
|
|
94
|
-
export {
|
|
95
|
-
export
|
|
96
|
-
export {
|
|
97
|
-
export
|
|
98
|
-
export {
|
|
99
|
-
export
|
|
100
|
-
export {
|
|
101
|
-
export
|
|
102
|
-
export {
|
|
103
|
-
export
|
|
104
|
-
export {
|
|
105
|
-
export type { UserMenuClassNames, UserMenuLabels, UserMenuProps, } from "./user-menu.js";
|
|
86
|
+
export { useAuthForm } from "./use-auth-form.ts";
|
|
87
|
+
export type { AuthFieldProps, AuthFormState, AuthFormStatus, UseAuthFormOptions, } from "./use-auth-form.ts";
|
|
88
|
+
export type { AuthFormClassNames, AuthFormErrors, AuthFormResult, AuthFormValues, AuthSubmitHandler, BaseAuthFormProps, BaseClassNames, SocialProvider, SocialProvidersProps, } from "./types.ts";
|
|
89
|
+
export { AuthFormClassNamesProvider, useAuthFormClassNames, } from "./class-names.tsx";
|
|
90
|
+
export type { AuthFormClassNamesProviderProps } from "./class-names.tsx";
|
|
91
|
+
export { SignInForm } from "./sign-in-form.tsx";
|
|
92
|
+
export type { SignInFormProps, SignInLabels, SignInValues, } from "./sign-in-form.tsx";
|
|
93
|
+
export { SignUpForm } from "./sign-up-form.tsx";
|
|
94
|
+
export type { SignUpFormProps, SignUpLabels, SignUpValues, } from "./sign-up-form.tsx";
|
|
95
|
+
export { RequestPasswordResetForm } from "./request-password-reset-form.tsx";
|
|
96
|
+
export type { RequestPasswordResetFormProps, RequestPasswordResetLabels, RequestPasswordResetValues, } from "./request-password-reset-form.tsx";
|
|
97
|
+
export { ResetPasswordForm } from "./reset-password-form.tsx";
|
|
98
|
+
export type { ResetPasswordFormProps, ResetPasswordLabels, ResetPasswordValues, } from "./reset-password-form.tsx";
|
|
99
|
+
export { MfaEnrollmentForm } from "./mfa-enrollment-form.tsx";
|
|
100
|
+
export type { MfaEnrollmentData, MfaEnrollmentFormProps, MfaEnrollmentLabels, MfaEnrollmentValues, } from "./mfa-enrollment-form.tsx";
|
|
101
|
+
export { MfaChallengeForm } from "./mfa-challenge-form.tsx";
|
|
102
|
+
export type { MfaChallengeFormProps, MfaChallengeLabels, MfaChallengeMethod, MfaChallengeValues, } from "./mfa-challenge-form.tsx";
|
|
103
|
+
export { UserMenu } from "./user-menu.tsx";
|
|
104
|
+
export type { UserMenuClassNames, UserMenuLabels, UserMenuProps, } from "./user-menu.tsx";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prebuilt React auth components for `@udibo/oauth2` — the composable,
|
|
3
3
|
* headless-first, themeable form set an app assembles into its own auth
|
|
4
|
-
* surface. Works
|
|
4
|
+
* surface. Works with React Router v7 in data or framework mode.
|
|
5
5
|
*
|
|
6
6
|
* These components are **composed by your app**: you own the routes, storage,
|
|
7
7
|
* session, and the submit wiring. Nothing here mounts routes, talks to a
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
*
|
|
84
84
|
* @module
|
|
85
85
|
*/
|
|
86
|
-
import "../../_dnt.polyfills.js";
|
|
87
86
|
export { useAuthForm } from "./use-auth-form.js";
|
|
88
87
|
export { AuthFormClassNamesProvider, useAuthFormClassNames, } from "./class-names.js";
|
|
89
88
|
export { SignInForm } from "./sign-in-form.js";
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import type { ReactNode } from "react";
|
|
10
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
11
|
-
import type { BaseAuthFormProps } from "./types.
|
|
10
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
11
|
+
import type { BaseAuthFormProps } from "./types.ts";
|
|
12
12
|
/** Values collected by {@link RequestPasswordResetForm}. */
|
|
13
13
|
export type RequestPasswordResetValues = {
|
|
14
14
|
/** The email to send the reset link to. */
|
|
@@ -35,7 +35,5 @@ export function RequestPasswordResetForm(props) {
|
|
|
35
35
|
});
|
|
36
36
|
useFocusFirstError(form);
|
|
37
37
|
const classNames = useAuthFormClassNames(props.classNames);
|
|
38
|
-
return (_jsxs(AuthFormShell, { name: "request-password-reset", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, succeeded: form.succeeded
|
|
39
|
-
? (_jsx("div", { "data-oauth2-success": "", role: "status", className: classNames.success, children: labels?.success ?? DEFAULT_SUCCESS }))
|
|
40
|
-
: null, children: [_jsx(TextField, { fieldProps: form.getFieldProps("email"), label: labels?.email ?? "Email", type: "email", autoComplete: "email", required: true, error: form.errors.email }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Send reset link", submittingLabel: labels?.submitting ?? "Sending…" })] }));
|
|
38
|
+
return (_jsxs(AuthFormShell, { name: "request-password-reset", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, succeeded: form.succeeded ? (_jsx("div", { "data-oauth2-success": "", role: "status", className: classNames.success, children: labels?.success ?? DEFAULT_SUCCESS })) : null, children: [_jsx(TextField, { fieldProps: form.getFieldProps("email"), label: labels?.email ?? "Email", type: "email", autoComplete: "email", required: true, error: form.errors.email }), _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Send reset link", submittingLabel: labels?.submitting ?? "Sending…" })] }));
|
|
41
39
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import { type ReactNode } from "react";
|
|
10
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
11
|
-
import type { BaseAuthFormProps } from "./types.
|
|
10
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
11
|
+
import type { BaseAuthFormProps } from "./types.ts";
|
|
12
12
|
/** Values collected by {@link ResetPasswordForm}. */
|
|
13
13
|
export type ResetPasswordValues = {
|
|
14
14
|
/** The new password. */
|
|
@@ -40,8 +40,8 @@ export function ResetPasswordForm(props) {
|
|
|
40
40
|
validate: (values) => {
|
|
41
41
|
const errors = {};
|
|
42
42
|
if (values.password !== values.confirmPassword) {
|
|
43
|
-
errors.confirmPassword =
|
|
44
|
-
"Passwords do not match.";
|
|
43
|
+
errors.confirmPassword =
|
|
44
|
+
labels?.passwordMismatch ?? "Passwords do not match.";
|
|
45
45
|
}
|
|
46
46
|
return errors;
|
|
47
47
|
},
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import type { ReactNode } from "react";
|
|
11
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
12
|
-
import type { BaseAuthFormProps, SocialProvidersProps } from "./types.
|
|
11
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
12
|
+
import type { BaseAuthFormProps, SocialProvidersProps } from "./types.ts";
|
|
13
13
|
/** Values collected by {@link SignInForm}. */
|
|
14
14
|
export type SignInValues = {
|
|
15
15
|
/** Email address or username. */
|
|
@@ -35,9 +35,5 @@ export function SignInForm(props) {
|
|
|
35
35
|
useFocusFirstError(form);
|
|
36
36
|
const classNames = useAuthFormClassNames(props.classNames);
|
|
37
37
|
const rememberField = form.getFieldProps("remember");
|
|
38
|
-
return (_jsxs(AuthFormShell, { name: "sign-in", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsx(SocialButtons, { socialProviders: socialProviders, onSocialSelect: onSocialSelect, socialHref: socialHref }), children: [_jsx(TextField, { fieldProps: form.getFieldProps("identifier"), label: labels?.identifier ?? "Email or username", autoComplete: "username", required: true, error: form.errors.identifier }), _jsx(TextField, { fieldProps: form.getFieldProps("password"), label: labels?.password ?? "Password", type: "password", autoComplete: "current-password", required: true, error: form.errors.password, children: forgotPasswordHref
|
|
39
|
-
? (_jsx("a", { href: forgotPasswordHref, "data-oauth2-forgot-password": "", className: classNames.hint, children: labels?.forgotPassword ?? "Forgot password?" }))
|
|
40
|
-
: null }), showRemember
|
|
41
|
-
? (_jsx("div", { "data-oauth2-field": "remember", className: classNames.field, children: _jsxs("label", { htmlFor: rememberField.id, "data-oauth2-label": "", className: classNames.label, children: [_jsx("input", { ...rememberField, type: "checkbox", "data-oauth2-input": "", className: classNames.input }), labels?.remember ?? "Remember me"] }) }))
|
|
42
|
-
: null, _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Sign in", submittingLabel: labels?.submitting ?? "Signing in…" })] }));
|
|
38
|
+
return (_jsxs(AuthFormShell, { name: "sign-in", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsx(SocialButtons, { socialProviders: socialProviders, onSocialSelect: onSocialSelect, socialHref: socialHref }), children: [_jsx(TextField, { fieldProps: form.getFieldProps("identifier"), label: labels?.identifier ?? "Email or username", autoComplete: "username", required: true, error: form.errors.identifier }), _jsx(TextField, { fieldProps: form.getFieldProps("password"), label: labels?.password ?? "Password", type: "password", autoComplete: "current-password", required: true, error: form.errors.password, children: forgotPasswordHref ? (_jsx("a", { href: forgotPasswordHref, "data-oauth2-forgot-password": "", className: classNames.hint, children: labels?.forgotPassword ?? "Forgot password?" })) : null }), showRemember ? (_jsx("div", { "data-oauth2-field": "remember", className: classNames.field, children: _jsxs("label", { htmlFor: rememberField.id, "data-oauth2-label": "", className: classNames.label, children: [_jsx("input", { ...rememberField, type: "checkbox", "data-oauth2-input": "", className: classNames.input }), labels?.remember ?? "Remember me"] }) })) : null, _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Sign in", submittingLabel: labels?.submitting ?? "Signing in…" })] }));
|
|
43
39
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import type { ReactNode } from "react";
|
|
10
|
-
import type { AuthFormState } from "./use-auth-form.
|
|
11
|
-
import type { BaseAuthFormProps, SocialProvidersProps } from "./types.
|
|
10
|
+
import type { AuthFormState } from "./use-auth-form.ts";
|
|
11
|
+
import type { BaseAuthFormProps, SocialProvidersProps } from "./types.ts";
|
|
12
12
|
/** Values collected by {@link SignUpForm}. */
|
|
13
13
|
export type SignUpValues = {
|
|
14
14
|
/** Email address. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAuthForm } from "./use-auth-form.js";
|
|
3
3
|
import { AuthFormShell, SocialButtons, SubmitButton, TextField, useFocusFirstError, } from "./internal.js";
|
|
4
4
|
import { useAuthFormClassNames } from "./class-names.js";
|
|
@@ -39,19 +39,13 @@ export function SignUpForm(props) {
|
|
|
39
39
|
validate: (values) => {
|
|
40
40
|
const errors = {};
|
|
41
41
|
if (showConfirmPassword && values.password !== values.confirmPassword) {
|
|
42
|
-
errors.confirmPassword =
|
|
43
|
-
"Passwords do not match.";
|
|
42
|
+
errors.confirmPassword =
|
|
43
|
+
labels?.passwordMismatch ?? "Passwords do not match.";
|
|
44
44
|
}
|
|
45
45
|
return errors;
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
48
|
useFocusFirstError(form);
|
|
49
49
|
const classNames = useAuthFormClassNames(props.classNames);
|
|
50
|
-
return (_jsxs(AuthFormShell, { name: "sign-up", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsx(SocialButtons, { socialProviders: socialProviders, onSocialSelect: onSocialSelect, socialHref: socialHref }), children: [showUsername
|
|
51
|
-
? (_jsx(TextField, { fieldProps: form.getFieldProps("username"), label: labels?.username ?? "Username", autoComplete: "username", required: true, error: form.errors.username }))
|
|
52
|
-
: null, _jsx(TextField, { fieldProps: form.getFieldProps("email"), label: labels?.email ?? "Email", type: "email", autoComplete: "email", required: true, error: form.errors.email }), showName
|
|
53
|
-
? (_jsxs(_Fragment, { children: [_jsx(TextField, { fieldProps: form.getFieldProps("firstName"), label: labels?.firstName ?? "First name", autoComplete: "given-name", required: true, error: form.errors.firstName }), _jsx(TextField, { fieldProps: form.getFieldProps("lastName"), label: labels?.lastName ?? "Last name", autoComplete: "family-name", required: true, error: form.errors.lastName })] }))
|
|
54
|
-
: null, _jsx(TextField, { fieldProps: form.getFieldProps("password"), label: labels?.password ?? "Password", type: "password", autoComplete: "new-password", required: true, error: form.errors.password }), showConfirmPassword
|
|
55
|
-
? (_jsx(TextField, { fieldProps: form.getFieldProps("confirmPassword"), label: labels?.confirmPassword ?? "Confirm password", type: "password", autoComplete: "new-password", required: true, error: form.errors.confirmPassword }))
|
|
56
|
-
: null, _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Create account", submittingLabel: labels?.submitting ?? "Creating account…" })] }));
|
|
50
|
+
return (_jsxs(AuthFormShell, { name: "sign-up", form: form, className: className, classNames: classNames, render: children, action: props.action, method: props.method, formRef: props.formRef, aboveForm: _jsx(SocialButtons, { socialProviders: socialProviders, onSocialSelect: onSocialSelect, socialHref: socialHref }), children: [showUsername ? (_jsx(TextField, { fieldProps: form.getFieldProps("username"), label: labels?.username ?? "Username", autoComplete: "username", required: true, error: form.errors.username })) : null, _jsx(TextField, { fieldProps: form.getFieldProps("email"), label: labels?.email ?? "Email", type: "email", autoComplete: "email", required: true, error: form.errors.email }), showName ? (_jsxs(_Fragment, { children: [_jsx(TextField, { fieldProps: form.getFieldProps("firstName"), label: labels?.firstName ?? "First name", autoComplete: "given-name", required: true, error: form.errors.firstName }), _jsx(TextField, { fieldProps: form.getFieldProps("lastName"), label: labels?.lastName ?? "Last name", autoComplete: "family-name", required: true, error: form.errors.lastName })] })) : null, _jsx(TextField, { fieldProps: form.getFieldProps("password"), label: labels?.password ?? "Password", type: "password", autoComplete: "new-password", required: true, error: form.errors.password }), showConfirmPassword ? (_jsx(TextField, { fieldProps: form.getFieldProps("confirmPassword"), label: labels?.confirmPassword ?? "Confirm password", type: "password", autoComplete: "new-password", required: true, error: form.errors.confirmPassword })) : null, _jsx(SubmitButton, { isSubmitting: form.isSubmitting, label: labels?.submit ?? "Create account", submittingLabel: labels?.submitting ?? "Creating account…" })] }));
|
|
57
51
|
}
|
|
@@ -37,8 +37,8 @@ export interface AuthFormResult {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* The app-provided function that performs a form's action — a client-side
|
|
40
|
-
* `fetch
|
|
41
|
-
*
|
|
40
|
+
* `fetch`, or a call that submits a React Router action. Receives the
|
|
41
|
+
* collected values; resolve/return an
|
|
42
42
|
* {@link AuthFormResult} (or throw) to report the outcome.
|
|
43
43
|
*/
|
|
44
44
|
export type AuthSubmitHandler<V extends AuthFormValues> = (values: V) => Promise<AuthFormResult | void> | AuthFormResult | void;
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* It owns field values, per-field and form-level errors, and the submit
|
|
6
6
|
* lifecycle, and stays entirely presentation-free: no markup, no styling, no
|
|
7
7
|
* router or network assumptions. The action is injected as `onSubmit`, so the
|
|
8
|
-
* same hook drives a client-side `fetch`
|
|
9
|
-
*
|
|
8
|
+
* same hook drives a client-side `fetch` or a React Router action submit.
|
|
9
|
+
* Reach for it directly when you want to own
|
|
10
10
|
* the markup completely (the "eject to headless" path); otherwise use a
|
|
11
11
|
* default component, which is built on this hook.
|
|
12
12
|
*
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
15
|
import { type ChangeEvent } from "react";
|
|
16
|
-
import type { AuthFormErrors, AuthFormValues, AuthSubmitHandler } from "./types.
|
|
16
|
+
import type { AuthFormErrors, AuthFormValues, AuthSubmitHandler } from "./types.ts";
|
|
17
17
|
/** Lifecycle status of an {@link useAuthForm} instance. */
|
|
18
18
|
export type AuthFormStatus = "idle" | "submitting" | "success" | "error";
|
|
19
19
|
/**
|