@udibo/oauth2 0.14.1 → 0.15.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/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 +8 -8
- package/{esm → dist}/adapters/hono/bff/bff.js +33 -27
- 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/dist/utils/_inbound-request.d.ts +15 -0
- package/dist/utils/_inbound-request.js +25 -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
|
@@ -29,8 +29,8 @@ const GITHUB_EMAILS_URL = "https://api.github.com/user/emails";
|
|
|
29
29
|
* ```ts
|
|
30
30
|
* const flow = new ExternalAuthFlow({
|
|
31
31
|
* provider: githubProvider({
|
|
32
|
-
* clientId:
|
|
33
|
-
* clientSecret:
|
|
32
|
+
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
33
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
34
34
|
* }),
|
|
35
35
|
* });
|
|
36
36
|
* ```
|
|
@@ -111,19 +111,16 @@ export function githubProvider(options) {
|
|
|
111
111
|
}
|
|
112
112
|
const emails = parseGithubEmails(emailsRaw);
|
|
113
113
|
const chosen = emails?.find((entry) => entry.primary) ??
|
|
114
|
-
emails?.find((entry) => entry.verified) ??
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
: undefined;
|
|
114
|
+
emails?.find((entry) => entry.verified) ??
|
|
115
|
+
emails?.[0];
|
|
116
|
+
const publicEmail = typeof user.email === "string" ? user.email : undefined;
|
|
118
117
|
return {
|
|
119
118
|
provider: id,
|
|
120
119
|
subject: String(user.id),
|
|
121
120
|
email: chosen?.email ?? publicEmail,
|
|
122
121
|
emailVerified: chosen?.verified === true,
|
|
123
122
|
name: typeof user.name === "string" ? user.name : undefined,
|
|
124
|
-
picture: typeof user.avatar_url === "string"
|
|
125
|
-
? user.avatar_url
|
|
126
|
-
: undefined,
|
|
123
|
+
picture: typeof user.avatar_url === "string" ? user.avatar_url : undefined,
|
|
127
124
|
raw: Array.isArray(emailsRaw) ? { ...user, emails: emailsRaw } : user,
|
|
128
125
|
};
|
|
129
126
|
},
|
|
@@ -149,17 +146,15 @@ function parseGithubEmails(raw) {
|
|
|
149
146
|
}
|
|
150
147
|
function githubTokenErrorHint(error) {
|
|
151
148
|
if (error === "incorrect_client_credentials") {
|
|
152
|
-
return `Check clientId/clientSecret against the GitHub OAuth App ` +
|
|
153
|
-
`settings.`;
|
|
149
|
+
return (`Check clientId/clientSecret against the GitHub OAuth App ` + `settings.`);
|
|
154
150
|
}
|
|
155
151
|
if (error === "redirect_uri_mismatch") {
|
|
156
|
-
return `The redirectUri must exactly match the "Authorization callback ` +
|
|
157
|
-
`URL" configured on the GitHub OAuth App
|
|
152
|
+
return (`The redirectUri must exactly match the "Authorization callback ` +
|
|
153
|
+
`URL" configured on the GitHub OAuth App.`);
|
|
158
154
|
}
|
|
159
155
|
if (error === "bad_verification_code") {
|
|
160
|
-
return `The code expired or was already used — ask the user to start ` +
|
|
161
|
-
`signing in again
|
|
156
|
+
return (`The code expired or was already used — ask the user to start ` +
|
|
157
|
+
`signing in again.`);
|
|
162
158
|
}
|
|
163
|
-
return `See https://docs.github.com/apps/oauth-apps for the error's ` +
|
|
164
|
-
`meaning.`;
|
|
159
|
+
return (`See https://docs.github.com/apps/oauth-apps for the error's ` + `meaning.`);
|
|
165
160
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { DiscoveryCache } from "../../client/discovery-cache.
|
|
7
|
-
import type { AzpPolicy } from "./_shared.
|
|
8
|
-
import type { ExternalProvider } from "./provider.
|
|
6
|
+
import type { DiscoveryCache } from "../../client/discovery-cache.ts";
|
|
7
|
+
import type { AzpPolicy } from "./_shared.ts";
|
|
8
|
+
import type { ExternalProvider } from "./provider.ts";
|
|
9
9
|
/** Options for {@link googleProvider}. */
|
|
10
10
|
export interface GoogleProviderOptions {
|
|
11
11
|
/** OAuth client ID from the Google Cloud console ("Web application" type). */
|
|
@@ -47,8 +47,8 @@ export interface GoogleProviderOptions {
|
|
|
47
47
|
* ```ts
|
|
48
48
|
* const flow = new ExternalAuthFlow({
|
|
49
49
|
* provider: googleProvider({
|
|
50
|
-
* clientId:
|
|
51
|
-
* clientSecret:
|
|
50
|
+
* clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
51
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
52
52
|
* }),
|
|
53
53
|
* });
|
|
54
54
|
* ```
|
|
@@ -17,8 +17,8 @@ import { oidcProvider } from "./oidc.js";
|
|
|
17
17
|
* ```ts
|
|
18
18
|
* const flow = new ExternalAuthFlow({
|
|
19
19
|
* provider: googleProvider({
|
|
20
|
-
* clientId:
|
|
21
|
-
* clientSecret:
|
|
20
|
+
* clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
21
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
22
22
|
* }),
|
|
23
23
|
* });
|
|
24
24
|
* ```
|
|
@@ -48,16 +48,15 @@
|
|
|
48
48
|
*
|
|
49
49
|
* @module
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
export
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export type
|
|
57
|
-
export {
|
|
58
|
-
export {
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export {
|
|
62
|
-
export {
|
|
63
|
-
export { APPLE_AUDIENCE, APPLE_CLIENT_SECRET_MAX_TTL_SECONDS, type AppleClientSecretFactory, type AppleClientSecretOptions, createAppleClientSecretFactory, DEFAULT_APPLE_CLIENT_SECRET_TTL_SECONDS, generateAppleClientSecret, } from "./apple-client-secret.js";
|
|
51
|
+
export { ExternalAuthError, type ExternalAuthErrorCode, isExternalAuthError, } from "./errors.ts";
|
|
52
|
+
export type { ExternalAuthorizationUrlInput, ExternalAuthTransient, ExternalProfile, ExternalProfileInput, ExternalProvider, } from "./provider.ts";
|
|
53
|
+
export { DEFAULT_MAX_TRANSIENT_AGE_MS, type ExternalAuthFinishInput, ExternalAuthFlow, type ExternalAuthFlowOptions, type ExternalAuthStartInput, type ExternalAuthStartResult, } from "./flow.ts";
|
|
54
|
+
export { oidcProvider, type OidcProviderOptions } from "./oidc.ts";
|
|
55
|
+
export type { AzpPolicy } from "./_shared.ts";
|
|
56
|
+
export { DEFAULT_DISCOVERY_CACHE_MAX_ENTRIES, DEFAULT_DISCOVERY_TTL_MS, type DiscoveryCache, type DiscoveryCacheEntry, MemoryDiscoveryCache, type MemoryDiscoveryCacheOptions, } from "../../client/discovery-cache.ts";
|
|
57
|
+
export { googleProvider, type GoogleProviderOptions } from "./google.ts";
|
|
58
|
+
export { githubProvider, type GithubProviderOptions } from "./github.ts";
|
|
59
|
+
export { type OAuth2ProfileMapper, type OAuth2ProfileMapping, oauth2Provider, type OAuth2ProviderOptions, type OAuth2TokenResult, } from "./oauth2.ts";
|
|
60
|
+
export { discordProvider, type DiscordProviderOptions } from "./discord.ts";
|
|
61
|
+
export { appleProvider, type AppleProviderOptions } from "./apple.ts";
|
|
62
|
+
export { APPLE_AUDIENCE, APPLE_CLIENT_SECRET_MAX_TTL_SECONDS, type AppleClientSecretFactory, type AppleClientSecretOptions, createAppleClientSecretFactory, DEFAULT_APPLE_CLIENT_SECRET_TTL_SECONDS, generateAppleClientSecret, } from "./apple-client-secret.ts";
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import type { ExternalProvider } from "./provider.
|
|
10
|
+
import type { ExternalProvider } from "./provider.ts";
|
|
11
11
|
/** The token-endpoint response fields the mapper may read. */
|
|
12
12
|
export interface OAuth2TokenResult {
|
|
13
13
|
/** The bearer access token issued by the token endpoint. */
|
|
@@ -142,18 +142,18 @@ export function oauth2Provider(options) {
|
|
|
142
142
|
}
|
|
143
143
|
function oauth2TokenErrorHint(error) {
|
|
144
144
|
if (error === "invalid_client" || error === "unauthorized_client") {
|
|
145
|
-
return `The provider rejected the client credentials — check clientId ` +
|
|
146
|
-
`and clientSecret against the app registration
|
|
145
|
+
return (`The provider rejected the client credentials — check clientId ` +
|
|
146
|
+
`and clientSecret against the app registration.`);
|
|
147
147
|
}
|
|
148
148
|
if (error === "invalid_grant") {
|
|
149
|
-
return `The provider rejected the code — it expired, was already used, ` +
|
|
149
|
+
return (`The provider rejected the code — it expired, was already used, ` +
|
|
150
150
|
`or the redirect URI does not match the registered one. Ask the user ` +
|
|
151
|
-
`to start again
|
|
151
|
+
`to start again.`);
|
|
152
152
|
}
|
|
153
153
|
if (error === "invalid_scope") {
|
|
154
|
-
return `The provider rejected the requested scopes — check the ` +
|
|
155
|
-
`connector's scopes against what the app registration allows
|
|
154
|
+
return (`The provider rejected the requested scopes — check the ` +
|
|
155
|
+
`connector's scopes against what the app registration allows.`);
|
|
156
156
|
}
|
|
157
|
-
return `The code may have expired or already been used — ask the user to ` +
|
|
158
|
-
`start again
|
|
157
|
+
return (`The code may have expired or already been used — ask the user to ` +
|
|
158
|
+
`start again.`);
|
|
159
159
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import type { DiscoveryCache } from "../../client/discovery-cache.
|
|
8
|
-
import { type AzpPolicy } from "./_shared.
|
|
9
|
-
import type { ExternalProvider } from "./provider.
|
|
7
|
+
import type { DiscoveryCache } from "../../client/discovery-cache.ts";
|
|
8
|
+
import { type AzpPolicy } from "./_shared.ts";
|
|
9
|
+
import type { ExternalProvider } from "./provider.ts";
|
|
10
10
|
/** Options for {@link oidcProvider}. */
|
|
11
11
|
export interface OidcProviderOptions {
|
|
12
12
|
/** Provider id used in profiles and error messages. Defaults to `"oidc"`. */
|
|
@@ -84,7 +84,7 @@ export interface OidcProviderOptions {
|
|
|
84
84
|
* displayName: "Acme SSO",
|
|
85
85
|
* issuer: "https://sso.acme.example",
|
|
86
86
|
* clientId: "my-app",
|
|
87
|
-
* clientSecret:
|
|
87
|
+
* clientSecret: process.env.ACME_CLIENT_SECRET!,
|
|
88
88
|
* });
|
|
89
89
|
* const flow = new ExternalAuthFlow({ provider });
|
|
90
90
|
* ```
|
|
@@ -42,7 +42,7 @@ import { ExternalAuthError } from "./errors.js";
|
|
|
42
42
|
* displayName: "Acme SSO",
|
|
43
43
|
* issuer: "https://sso.acme.example",
|
|
44
44
|
* clientId: "my-app",
|
|
45
|
-
* clientSecret:
|
|
45
|
+
* clientSecret: process.env.ACME_CLIENT_SECRET!,
|
|
46
46
|
* });
|
|
47
47
|
* const flow = new ExternalAuthFlow({ provider });
|
|
48
48
|
* ```
|
|
@@ -232,7 +232,8 @@ function assertSecureIssuer(id, issuer) {
|
|
|
232
232
|
throw new ExternalAuthError(id, "configuration", `issuer "${issuer}" is not a valid absolute URL.`);
|
|
233
233
|
}
|
|
234
234
|
const loopback = url.hostname === "localhost" ||
|
|
235
|
-
url.hostname === "127.0.0.1" ||
|
|
235
|
+
url.hostname === "127.0.0.1" ||
|
|
236
|
+
url.hostname === "[::1]";
|
|
236
237
|
if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) {
|
|
237
238
|
throw new ExternalAuthError(id, "configuration", `issuer "${issuer}" must use https — this connector trusts the ` +
|
|
238
239
|
`id_token because it arrives directly from the token endpoint over ` +
|
|
@@ -243,14 +244,14 @@ function assertSecureIssuer(id, issuer) {
|
|
|
243
244
|
function tokenExchangeHint(error) {
|
|
244
245
|
const code = isOAuth2Error(error) ? error.extensions.error : undefined;
|
|
245
246
|
if (code === "invalid_client") {
|
|
246
|
-
return `The provider rejected the client credentials — check clientId ` +
|
|
247
|
-
`and clientSecret against the provider's app registration
|
|
247
|
+
return (`The provider rejected the client credentials — check clientId ` +
|
|
248
|
+
`and clientSecret against the provider's app registration.`);
|
|
248
249
|
}
|
|
249
250
|
if (code === "invalid_grant") {
|
|
250
|
-
return `The provider rejected the code — most often the redirectUri ` +
|
|
251
|
+
return (`The provider rejected the code — most often the redirectUri ` +
|
|
251
252
|
`does not exactly match the URI registered with the provider, or the ` +
|
|
252
|
-
`code expired or was already used
|
|
253
|
+
`code expired or was already used.`);
|
|
253
254
|
}
|
|
254
|
-
return `Check the provider's app registration (client credentials and ` +
|
|
255
|
-
`redirect URI) if this persists
|
|
255
|
+
return (`Check the provider's app registration (client credentials and ` +
|
|
256
|
+
`redirect URI) if this persists.`);
|
|
256
257
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import { encodeHex } from "../
|
|
20
|
+
import { encodeHex } from "../utils/_encoding.js";
|
|
21
21
|
import { defaultFetch, packageDeadlineSignal, } from "../utils/_default-fetch.js";
|
|
22
22
|
import { dispatchIdentityEvent } from "./events.js";
|
|
23
23
|
const DEFAULT_BASE_URL = "https://api.pwnedpasswords.com/range/";
|
|
@@ -92,8 +92,7 @@ export class MemoryLockoutStore {
|
|
|
92
92
|
/** Add one failure synchronously (atomic in a single-process store). */
|
|
93
93
|
increment(userId, now) {
|
|
94
94
|
const record = this.#records.get(userId);
|
|
95
|
-
const lockExpired = record?.lockedUntil !== undefined &&
|
|
96
|
-
record.lockedUntil <= now;
|
|
95
|
+
const lockExpired = record?.lockedUntil !== undefined && record.lockedUntil <= now;
|
|
97
96
|
const next = record && !lockExpired
|
|
98
97
|
? {
|
|
99
98
|
failures: record.failures + 1,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* MFA primitives for apps that own their login: TOTP (RFC 6238) and single-use
|
|
3
3
|
* recovery codes, plus a small orchestrator over an app-owned store — the same
|
|
4
4
|
* thin-seam philosophy as the rest of the identity layer. Built entirely on
|
|
5
|
-
* Web Crypto
|
|
5
|
+
* Web Crypto; no other dependencies.
|
|
6
6
|
*
|
|
7
7
|
* - {@link generateTotpSecret} / {@link buildOtpauthUri} /
|
|
8
8
|
* {@link generateTotpCode} / {@link verifyTotpCode} — the TOTP math, with a
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
*
|
|
38
38
|
* @module
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
export { type
|
|
43
|
-
export { MemoryMfaStore, type MfaEnrollmentConfirmation, type MfaEnrollmentStart, type MfaEnrollmentStatus, MfaService, type MfaServiceOptions, type MfaStore, type MfaTotpOptions, type MfaTotpRecord, type MfaVerification, type MfaVerifyFailureReason, type MfaVerifyOptions, type StartEnrollmentOptions, } from "./service.js";
|
|
40
|
+
export { buildOtpauthUri, decodeTotpSecret, type GeneratedTotpSecret, generateTotpCode, type GenerateTotpCodeOptions, generateTotpSecret, type OtpauthUriOptions, type TotpAlgorithm, type TotpVerification, verifyTotpCode, type VerifyTotpCodeOptions, } from "./totp.ts";
|
|
41
|
+
export { type GeneratedRecoveryCodes, generateRecoveryCodes, type GenerateRecoveryCodesOptions, hashRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_LENGTH, type RecoveryCodeVerification, verifyRecoveryCode, type VerifyRecoveryCodeOptions, } from "./recovery-codes.ts";
|
|
42
|
+
export { MemoryMfaStore, type MfaEnrollmentConfirmation, type MfaEnrollmentStart, type MfaEnrollmentStatus, MfaService, type MfaServiceOptions, type MfaStore, type MfaTotpOptions, type MfaTotpRecord, type MfaVerification, type MfaVerifyFailureReason, type MfaVerifyOptions, type StartEnrollmentOptions, } from "./service.ts";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* MFA primitives for apps that own their login: TOTP (RFC 6238) and single-use
|
|
3
3
|
* recovery codes, plus a small orchestrator over an app-owned store — the same
|
|
4
4
|
* thin-seam philosophy as the rest of the identity layer. Built entirely on
|
|
5
|
-
* Web Crypto
|
|
5
|
+
* Web Crypto; no other dependencies.
|
|
6
6
|
*
|
|
7
7
|
* - {@link generateTotpSecret} / {@link buildOtpauthUri} /
|
|
8
8
|
* {@link generateTotpCode} / {@link verifyTotpCode} — the TOTP math, with a
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
*
|
|
38
38
|
* @module
|
|
39
39
|
*/
|
|
40
|
-
import "../../_dnt.polyfills.js";
|
|
41
40
|
export { buildOtpauthUri, decodeTotpSecret, generateTotpCode, generateTotpSecret, verifyTotpCode, } from "./totp.js";
|
|
42
41
|
export { generateRecoveryCodes, hashRecoveryCode, normalizeRecoveryCode, RECOVERY_CODE_LENGTH, verifyRecoveryCode, } from "./recovery-codes.js";
|
|
43
42
|
export { MemoryMfaStore, MfaService, } from "./service.js";
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import { type IdentityEventHook } from "../events.
|
|
11
|
-
import { type RateLimiterLike } from "../rate-limit.
|
|
12
|
-
import { type TotpAlgorithm } from "./totp.
|
|
10
|
+
import { type IdentityEventHook } from "../events.ts";
|
|
11
|
+
import { type RateLimiterLike } from "../rate-limit.ts";
|
|
12
|
+
import { type TotpAlgorithm } from "./totp.ts";
|
|
13
13
|
/**
|
|
14
14
|
* A user's TOTP state as the store persists it. `secretBase32` is a symmetric
|
|
15
15
|
* key — encrypt it at rest. A record may hold only a pending secret (enrollment
|
|
@@ -228,7 +228,7 @@ export class MfaService {
|
|
|
228
228
|
* TOTP enrollment.
|
|
229
229
|
*/
|
|
230
230
|
async regenerateRecoveryCodes(userId) {
|
|
231
|
-
if (!await this.isEnrolled(userId)) {
|
|
231
|
+
if (!(await this.isEnrolled(userId))) {
|
|
232
232
|
throw new IdentityError("mfa_not_enrolled", "cannot regenerate recovery codes: MFA is not enrolled");
|
|
233
233
|
}
|
|
234
234
|
const codes = await this.#issueRecoveryCodes(userId);
|
|
@@ -244,7 +244,7 @@ export class MfaService {
|
|
|
244
244
|
});
|
|
245
245
|
if (!result.valid)
|
|
246
246
|
return undefined;
|
|
247
|
-
if (!await this.#store.advanceLastStep(userId, result.matchedStep)) {
|
|
247
|
+
if (!(await this.#store.advanceLastStep(userId, result.matchedStep))) {
|
|
248
248
|
return await this.#verifyFailed(userId, "replayed");
|
|
249
249
|
}
|
|
250
250
|
await this.#resetThrottle(userId);
|
|
@@ -258,7 +258,8 @@ export class MfaService {
|
|
|
258
258
|
const consumed = await this.#store.consumeRecoveryHash(userId, await hashRecoveryCode(code));
|
|
259
259
|
if (!consumed)
|
|
260
260
|
return undefined;
|
|
261
|
-
const remainingRecoveryCodes = (await this.#store.getRecoveryHashes(userId))
|
|
261
|
+
const remainingRecoveryCodes = (await this.#store.getRecoveryHashes(userId))
|
|
262
|
+
.length;
|
|
262
263
|
await this.#resetThrottle(userId);
|
|
263
264
|
await this.#emit({
|
|
264
265
|
type: "mfa.verify.succeeded",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TOTP primitives (RFC 6238 over RFC 4226 HOTP) built on Web Crypto — no
|
|
3
|
-
* dependencies
|
|
3
|
+
* dependencies. Generate a secret, render the `otpauth://` URI an
|
|
4
4
|
* authenticator app scans, and verify submitted codes with a constant-time
|
|
5
5
|
* comparison.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TOTP primitives (RFC 6238 over RFC 4226 HOTP) built on Web Crypto — no
|
|
3
|
-
* dependencies
|
|
3
|
+
* dependencies. Generate a secret, render the `otpauth://` URI an
|
|
4
4
|
* authenticator app scans, and verify submitted codes with a constant-time
|
|
5
5
|
* comparison.
|
|
6
6
|
*
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import { decodeBase32, encodeBase32 } from "../../deps/jsr.io/@std/encoding/1.0.11/base32.js";
|
|
15
14
|
import { toArrayBuffer } from "../../utils/_buffer.js";
|
|
15
|
+
import { decodeBase32, encodeBase32 } from "../../utils/_encoding.js";
|
|
16
16
|
import { timingSafeMatchIndex } from "../../utils/_timing-safe.js";
|
|
17
17
|
const DEFAULT_DIGITS = 6;
|
|
18
18
|
const DEFAULT_PERIOD_SECONDS = 30;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* only built-in verifier is {@link pbkdf2Verifier} (PBKDF2 is a Web Crypto
|
|
17
17
|
* primitive). **bcrypt, argon2, and scrypt cannot be implemented dep-free** —
|
|
18
18
|
* bcrypt and argon2 have no Web Crypto primitive, and scrypt is not exposed by
|
|
19
|
-
* Web Crypto
|
|
19
|
+
* Web Crypto. Those are **BYO**: you implement the
|
|
20
20
|
* {@link LegacyPasswordVerifier} seam with your app's own bcrypt/argon2/scrypt
|
|
21
21
|
* dependency and pass it in. {@link parsePhc} is provided to parse the PHC /
|
|
22
22
|
* modular-crypt strings those algorithms store, so a BYO verifier is a few
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @module
|
|
26
26
|
*/
|
|
27
|
-
import "../_dnt.polyfills.js";
|
|
28
27
|
/**
|
|
29
28
|
* A verifier for one foreign password-hash format, used during
|
|
30
29
|
* upgrade-on-login. Connectors identify the formats they handle by sniffing the
|
|
@@ -35,7 +34,7 @@ import "../_dnt.polyfills.js";
|
|
|
35
34
|
* Implement this to bring your own bcrypt/argon2/scrypt verifier (using your
|
|
36
35
|
* app's dependency) — the package only ships {@link pbkdf2Verifier} built-in.
|
|
37
36
|
*
|
|
38
|
-
* @example Bring-your-own bcrypt (app adds
|
|
37
|
+
* @example Bring-your-own bcrypt (app adds a `bcryptjs` dependency)
|
|
39
38
|
* ```ts
|
|
40
39
|
* import { compare } from "bcryptjs";
|
|
41
40
|
* import type { LegacyPasswordVerifier } from "@udibo/oauth2/identity/migration";
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* only built-in verifier is {@link pbkdf2Verifier} (PBKDF2 is a Web Crypto
|
|
17
17
|
* primitive). **bcrypt, argon2, and scrypt cannot be implemented dep-free** —
|
|
18
18
|
* bcrypt and argon2 have no Web Crypto primitive, and scrypt is not exposed by
|
|
19
|
-
* Web Crypto
|
|
19
|
+
* Web Crypto. Those are **BYO**: you implement the
|
|
20
20
|
* {@link LegacyPasswordVerifier} seam with your app's own bcrypt/argon2/scrypt
|
|
21
21
|
* dependency and pass it in. {@link parsePhc} is provided to parse the PHC /
|
|
22
22
|
* modular-crypt strings those algorithms store, so a BYO verifier is a few
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @module
|
|
26
26
|
*/
|
|
27
|
-
import "
|
|
28
|
-
import { decodeBase64 } from "../
|
|
29
|
-
import { timingSafeEqual } from "../deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js";
|
|
27
|
+
import { timingSafeEqual } from "node:crypto";
|
|
28
|
+
import { decodeBase64 } from "../utils/_encoding.js";
|
|
30
29
|
/**
|
|
31
30
|
* The first verifier in `verifiers` (in order) whose `canVerify` accepts `phc`,
|
|
32
31
|
* or `undefined` if none do. A verifier that throws from `canVerify` is skipped
|
|
@@ -48,18 +48,17 @@
|
|
|
48
48
|
*
|
|
49
49
|
* @module
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
57
|
-
export {
|
|
58
|
-
export {
|
|
59
|
-
export
|
|
60
|
-
export type
|
|
61
|
-
export {
|
|
62
|
-
export {
|
|
63
|
-
export {
|
|
64
|
-
export {
|
|
65
|
-
export { type BreachedPasswordOptions, breachedPasswordValidator, } from "./hibp.js";
|
|
51
|
+
export { DEFAULT_PBKDF2_ITERATIONS, generateSalt, hashPassword, LEGACY_PBKDF2_ITERATIONS, type PasswordCredential, type PasswordHasherLike, type PasswordHashParams, PasswordIdentityService, type PasswordIdentityServiceOptions, PBKDF2_SHA256, verifyPassword, } from "./password.ts";
|
|
52
|
+
export { classifyIdentifier, createIdentifierResolver, type IdentifierKind, type IdentifierLookups, } from "./identifier.ts";
|
|
53
|
+
export { type CreatedToken, type CreateTokenOptions, MemoryTokenFlowStore, type ResolvedToken, type TokenFlowRecord, TokenFlowService, type TokenFlowStore, TokenPurpose, type TokenStatus, } from "./token-flow.ts";
|
|
54
|
+
export { buildResetUrl, buildSignInUrl, buildTokenUrl, buildUnlockUrl, buildVerificationUrl, type CodeDeliveryHook, type CodeDeliveryMessage, type DeliveryHook, type DeliveryHooks, type DeliveryMessage, } from "./delivery.ts";
|
|
55
|
+
export { isRecentlyAuthenticated, type ListableSessionService, type RevocableSessionService, type SessionSummary, supportsSessionListing, } from "./session.ts";
|
|
56
|
+
export { type ConsumeSignInLinkResult, type IdentityRateLimiters, IdentityService, type IdentityServiceOptions, type IdentityUser, type IdentityUserStore, type UnlockAccountResult, type VerifyEmailResult, type VerifySignInCodeResult, } from "./service.ts";
|
|
57
|
+
export { EmailOtpService, type EmailOtpServiceOptions, MemoryOtpStore, type OtpRecord, type OtpStore, type RequestedOtp, type RequestOtpOptions, type VerifyOtpOptions, type VerifyOtpResult, } from "./otp.ts";
|
|
58
|
+
export { AccountLockout, type AccountLockoutLike, type AccountLockoutOptions, type LockoutFailureResult, type LockoutRecord, type LockoutStatus, type LockoutStore, MemoryLockoutStore, } from "./lockout.ts";
|
|
59
|
+
export type { IdentityEvent, IdentityEventHook, SignInCodeFailureReason, SignInFailureReason, } from "./events.ts";
|
|
60
|
+
export { IdentityError, type IdentityErrorCode, type IdentityErrorOptions, type IdentityErrorStatus, identityErrorStatus, isIdentityError, } from "./errors.ts";
|
|
61
|
+
export { MemoryRateLimitStore, RateLimiter, type RateLimiterLike, type RateLimiterOptions, type RateLimitResult, type RateLimitStore, } from "./rate-limit.ts";
|
|
62
|
+
export { type CaptchaOutcome, type CaptchaProvider, type CaptchaVerifyContext, type CaptchaVerifyResult, verifyCaptcha, type VerifyCaptchaOptions, } from "./captcha.ts";
|
|
63
|
+
export { assertPasswordPolicy, checkPasswordPolicy, type PasswordPolicy, type PasswordPolicyResult, } from "./password-policy.ts";
|
|
64
|
+
export { type BreachedPasswordOptions, breachedPasswordValidator, } from "./hibp.ts";
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
*
|
|
49
49
|
* @module
|
|
50
50
|
*/
|
|
51
|
-
import "../_dnt.polyfills.js";
|
|
52
51
|
export { DEFAULT_PBKDF2_ITERATIONS, generateSalt, hashPassword, LEGACY_PBKDF2_ITERATIONS, PasswordIdentityService, PBKDF2_SHA256, verifyPassword, } from "./password.js";
|
|
53
52
|
export { classifyIdentifier, createIdentifierResolver, } from "./identifier.js";
|
|
54
53
|
export { MemoryTokenFlowStore, TokenFlowService, TokenPurpose, } from "./token-flow.js";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import { type RateLimiterLike } from "./rate-limit.
|
|
20
|
+
import { type RateLimiterLike } from "./rate-limit.ts";
|
|
21
21
|
/**
|
|
22
22
|
* The rate-limit key a one-time-code request is throttled under. Exported so
|
|
23
23
|
* `IdentityService` throttles its sign-in-code flow under the very key
|
|
@@ -181,7 +181,7 @@ export class EmailOtpService {
|
|
|
181
181
|
}
|
|
182
182
|
if (timingSafeEqualString(record.codeHash, submittedHash)) {
|
|
183
183
|
return {
|
|
184
|
-
status: await this.#store.consume(record.id) ? "success" : "invalid",
|
|
184
|
+
status: (await this.#store.consume(record.id)) ? "success" : "invalid",
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
if (attempts === record.maxAttempts) {
|
|
@@ -209,7 +209,9 @@ export class MemoryOtpStore {
|
|
|
209
209
|
let latest = null;
|
|
210
210
|
for (const id of this.#active) {
|
|
211
211
|
const record = this.#records.get(id);
|
|
212
|
-
if (record &&
|
|
212
|
+
if (record &&
|
|
213
|
+
record.email === email &&
|
|
214
|
+
record.purpose === purpose &&
|
|
213
215
|
(!latest || record.createdAt >= latest.createdAt)) {
|
|
214
216
|
latest = record;
|
|
215
217
|
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { timingSafeEqual } from "node:crypto";
|
|
18
|
+
import { encodeHex } from "../utils/_encoding.js";
|
|
19
19
|
/**
|
|
20
20
|
* Generates a cryptographically random salt for password hashing.
|
|
21
21
|
*
|
|
@@ -81,7 +81,11 @@ export async function verifyPassword(password, salt, hash, iterations = DEFAULT_
|
|
|
81
81
|
// Both are fixed-width hex digests, so length carries no secret.
|
|
82
82
|
if (computedHash.length !== hash.length)
|
|
83
83
|
return false;
|
|
84
|
-
|
|
84
|
+
const computedBytes = encoder.encode(computedHash);
|
|
85
|
+
const expectedBytes = encoder.encode(hash);
|
|
86
|
+
if (computedBytes.byteLength !== expectedBytes.byteLength)
|
|
87
|
+
return false;
|
|
88
|
+
return timingSafeEqual(computedBytes, expectedBytes);
|
|
85
89
|
}
|
|
86
90
|
/**
|
|
87
91
|
* Hashes and verifies passwords (PBKDF2-SHA-256, constant-time digest
|
|
@@ -153,7 +157,6 @@ export class PasswordIdentityService {
|
|
|
153
157
|
const params = credential.params;
|
|
154
158
|
if (!params)
|
|
155
159
|
return LEGACY_PBKDF2_ITERATIONS < this.#iterations;
|
|
156
|
-
return params.algorithm !== PBKDF2_SHA256 ||
|
|
157
|
-
params.iterations < this.#iterations;
|
|
160
|
+
return (params.algorithm !== PBKDF2_SHA256 || params.iterations < this.#iterations);
|
|
158
161
|
}
|
|
159
162
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
-
import type { IdentityEvent, RateLimitedEventInit } from "./events.
|
|
12
|
+
import type { IdentityEvent, RateLimitedEventInit } from "./events.ts";
|
|
13
13
|
/** Pluggable counter store for {@link RateLimiter}. */
|
|
14
14
|
export interface RateLimitStore {
|
|
15
15
|
/**
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import { type DeliveryHooks } from "./delivery.
|
|
21
|
-
import type { AccountLockoutLike } from "./lockout.
|
|
22
|
-
import { type PasswordCredential, type PasswordHasherLike } from "./password.
|
|
23
|
-
import { type TokenFlowService } from "./token-flow.
|
|
24
|
-
import type { RevocableSessionService } from "./session.
|
|
25
|
-
import { type PasswordPolicy } from "./password-policy.
|
|
26
|
-
import { type RateLimiterLike } from "./rate-limit.
|
|
27
|
-
import { type OtpStore } from "./otp.
|
|
28
|
-
import { type IdentityEventHook } from "./events.
|
|
29
|
-
import { type LegacyPasswordVerifier } from "./migration.
|
|
20
|
+
import { type DeliveryHooks } from "./delivery.ts";
|
|
21
|
+
import type { AccountLockoutLike } from "./lockout.ts";
|
|
22
|
+
import { type PasswordCredential, type PasswordHasherLike } from "./password.ts";
|
|
23
|
+
import { type TokenFlowService } from "./token-flow.ts";
|
|
24
|
+
import type { RevocableSessionService } from "./session.ts";
|
|
25
|
+
import { type PasswordPolicy } from "./password-policy.ts";
|
|
26
|
+
import { type RateLimiterLike } from "./rate-limit.ts";
|
|
27
|
+
import { type OtpStore } from "./otp.ts";
|
|
28
|
+
import { type IdentityEventHook } from "./events.ts";
|
|
29
|
+
import { type LegacyPasswordVerifier } from "./migration.ts";
|
|
30
30
|
/** The minimum the identity flows require of your user record. */
|
|
31
31
|
export interface IdentityUser {
|
|
32
32
|
/** Opaque user id the flows address users by; never interpreted by the library. */
|