@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
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
import { AssertionError } from "./assertion_error.js";
|
|
4
|
-
/**
|
|
5
|
-
* Use this to stub out methods that will throw when invoked.
|
|
6
|
-
*
|
|
7
|
-
* @example Usage
|
|
8
|
-
* ```ts ignore
|
|
9
|
-
* import { unimplemented } from "@std/assert";
|
|
10
|
-
*
|
|
11
|
-
* unimplemented(); // Throws
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param msg Optional message to include in the error.
|
|
15
|
-
* @returns Never returns, always throws.
|
|
16
|
-
*/
|
|
17
|
-
export function unimplemented(msg) {
|
|
18
|
-
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
19
|
-
throw new AssertionError(`Unimplemented${msgSuffix}`);
|
|
20
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Use this to assert unreachable code.
|
|
3
|
-
*
|
|
4
|
-
* @example Usage
|
|
5
|
-
* ```ts ignore
|
|
6
|
-
* import { unreachable } from "@std/assert";
|
|
7
|
-
*
|
|
8
|
-
* unreachable(); // Throws
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @param msg Optional message to include in the error.
|
|
12
|
-
* @returns Never returns, always throws.
|
|
13
|
-
*/
|
|
14
|
-
export declare function unreachable(msg?: string): never;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
import { AssertionError } from "./assertion_error.js";
|
|
4
|
-
/**
|
|
5
|
-
* Use this to assert unreachable code.
|
|
6
|
-
*
|
|
7
|
-
* @example Usage
|
|
8
|
-
* ```ts ignore
|
|
9
|
-
* import { unreachable } from "@std/assert";
|
|
10
|
-
*
|
|
11
|
-
* unreachable(); // Throws
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param msg Optional message to include in the error.
|
|
15
|
-
* @returns Never returns, always throws.
|
|
16
|
-
*/
|
|
17
|
-
export function unreachable(msg) {
|
|
18
|
-
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
19
|
-
throw new AssertionError(`Unreachable${msgSuffix}`);
|
|
20
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** Options for {@linkcode delay}. */
|
|
2
|
-
export interface DelayOptions {
|
|
3
|
-
/** Signal used to abort the delay. */
|
|
4
|
-
signal?: AbortSignal;
|
|
5
|
-
/** Indicates whether the process should continue to run as long as the timer exists.
|
|
6
|
-
*
|
|
7
|
-
* @default {true}
|
|
8
|
-
*/
|
|
9
|
-
persistent?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Resolve a {@linkcode Promise} after a given amount of milliseconds.
|
|
13
|
-
*
|
|
14
|
-
* If the optional signal is aborted before the delay duration, the returned
|
|
15
|
-
* promise rejects with the signal's reason. If no reason is provided to
|
|
16
|
-
* `abort()`, the browser's default `DOMException` with name `"AbortError"` is used.
|
|
17
|
-
*
|
|
18
|
-
* @param ms Duration in milliseconds for how long the delay should last.
|
|
19
|
-
* @param options Additional options.
|
|
20
|
-
*
|
|
21
|
-
* @example Basic usage
|
|
22
|
-
* ```ts no-assert
|
|
23
|
-
* import { delay } from "@std/async/delay";
|
|
24
|
-
*
|
|
25
|
-
* // ...
|
|
26
|
-
* const delayedPromise = delay(100);
|
|
27
|
-
* const result = await delayedPromise;
|
|
28
|
-
* // ...
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @example Disable persistence
|
|
32
|
-
*
|
|
33
|
-
* Setting `persistent` to `false` will allow the process to continue to run as
|
|
34
|
-
* long as the timer exists.
|
|
35
|
-
*
|
|
36
|
-
* ```ts no-assert ignore
|
|
37
|
-
* import { delay } from "@std/async/delay";
|
|
38
|
-
*
|
|
39
|
-
* // ...
|
|
40
|
-
* await delay(100, { persistent: false });
|
|
41
|
-
* // ...
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare function delay(ms: number, options?: DelayOptions): Promise<void>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a {@linkcode Promise} after a given amount of milliseconds.
|
|
5
|
-
*
|
|
6
|
-
* If the optional signal is aborted before the delay duration, the returned
|
|
7
|
-
* promise rejects with the signal's reason. If no reason is provided to
|
|
8
|
-
* `abort()`, the browser's default `DOMException` with name `"AbortError"` is used.
|
|
9
|
-
*
|
|
10
|
-
* @param ms Duration in milliseconds for how long the delay should last.
|
|
11
|
-
* @param options Additional options.
|
|
12
|
-
*
|
|
13
|
-
* @example Basic usage
|
|
14
|
-
* ```ts no-assert
|
|
15
|
-
* import { delay } from "@std/async/delay";
|
|
16
|
-
*
|
|
17
|
-
* // ...
|
|
18
|
-
* const delayedPromise = delay(100);
|
|
19
|
-
* const result = await delayedPromise;
|
|
20
|
-
* // ...
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @example Disable persistence
|
|
24
|
-
*
|
|
25
|
-
* Setting `persistent` to `false` will allow the process to continue to run as
|
|
26
|
-
* long as the timer exists.
|
|
27
|
-
*
|
|
28
|
-
* ```ts no-assert ignore
|
|
29
|
-
* import { delay } from "@std/async/delay";
|
|
30
|
-
*
|
|
31
|
-
* // ...
|
|
32
|
-
* await delay(100, { persistent: false });
|
|
33
|
-
* // ...
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export function delay(ms, options = {}) {
|
|
37
|
-
const { signal, persistent = true } = options;
|
|
38
|
-
if (signal?.aborted)
|
|
39
|
-
return Promise.reject(signal.reason);
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
const abort = () => {
|
|
42
|
-
clearTimeout(+i);
|
|
43
|
-
reject(signal?.reason);
|
|
44
|
-
};
|
|
45
|
-
const done = () => {
|
|
46
|
-
signal?.removeEventListener("abort", abort);
|
|
47
|
-
resolve();
|
|
48
|
-
};
|
|
49
|
-
const i = setArbitraryLengthTimeout(done, ms);
|
|
50
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
51
|
-
if (persistent === false) {
|
|
52
|
-
try {
|
|
53
|
-
Deno.unrefTimer(+i);
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
if (!(error instanceof ReferenceError)) {
|
|
57
|
-
clearTimeout(+i);
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
// deno-lint-ignore no-console
|
|
61
|
-
console.error("`persistent` option is only available in Deno");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const I32_MAX = 2 ** 31 - 1;
|
|
67
|
-
function setArbitraryLengthTimeout(callback, delay) {
|
|
68
|
-
// ensure non-negative integer (but > I32_MAX is OK, even if Infinity)
|
|
69
|
-
delay = Math.trunc(Math.max(delay, 0) || 0);
|
|
70
|
-
if (delay <= I32_MAX) {
|
|
71
|
-
const id = Number(setTimeout(callback, delay));
|
|
72
|
-
return { valueOf: () => id };
|
|
73
|
-
}
|
|
74
|
-
const start = Date.now();
|
|
75
|
-
let timeoutId;
|
|
76
|
-
const queueTimeout = () => {
|
|
77
|
-
const currentDelay = delay - (Date.now() - start);
|
|
78
|
-
timeoutId = currentDelay > I32_MAX
|
|
79
|
-
? Number(setTimeout(queueTimeout, I32_MAX))
|
|
80
|
-
: Number(setTimeout(callback, currentDelay));
|
|
81
|
-
};
|
|
82
|
-
queueTimeout();
|
|
83
|
-
return { valueOf: () => timeoutId };
|
|
84
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* When checking the values of cryptographic hashes are equal, default
|
|
3
|
-
* comparisons can be susceptible to timing based attacks, where attacker is
|
|
4
|
-
* able to find out information about the host system by repeatedly checking
|
|
5
|
-
* response times to equality comparisons of values.
|
|
6
|
-
*
|
|
7
|
-
* It is likely some form of timing safe equality will make its way to the
|
|
8
|
-
* WebCrypto standard (see:
|
|
9
|
-
* {@link https://github.com/w3c/webcrypto/issues/270 | w3c/webcrypto#270}), but until
|
|
10
|
-
* that time, `timingSafeEqual()` is provided.
|
|
11
|
-
*
|
|
12
|
-
* Note: This is a best-effort constant-time comparison implemented in
|
|
13
|
-
* JavaScript. The V8 JIT compiler does not provide formal constant-time
|
|
14
|
-
* guarantees, and inputs backed by `SharedArrayBuffer` are susceptible to
|
|
15
|
-
* concurrent modification during comparison.
|
|
16
|
-
*
|
|
17
|
-
* @example Usage
|
|
18
|
-
* ```ts
|
|
19
|
-
* import { timingSafeEqual } from "@std/crypto/timing-safe-equal";
|
|
20
|
-
* import { assert } from "@std/assert";
|
|
21
|
-
*
|
|
22
|
-
* const a = await crypto.subtle.digest(
|
|
23
|
-
* "SHA-384",
|
|
24
|
-
* new TextEncoder().encode("hello world"),
|
|
25
|
-
* );
|
|
26
|
-
* const b = await crypto.subtle.digest(
|
|
27
|
-
* "SHA-384",
|
|
28
|
-
* new TextEncoder().encode("hello world"),
|
|
29
|
-
* );
|
|
30
|
-
*
|
|
31
|
-
* assert(timingSafeEqual(a, b));
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @param a The first value to compare.
|
|
35
|
-
* @param b The second value to compare.
|
|
36
|
-
* @returns `true` if the values are equal, otherwise `false`.
|
|
37
|
-
* @throws {TypeError} If the byte lengths of the two buffers are not equal.
|
|
38
|
-
*/
|
|
39
|
-
export declare function timingSafeEqual(a: ArrayBufferView | ArrayBufferLike, b: ArrayBufferView | ArrayBufferLike): boolean;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
// This module is browser compatible.
|
|
3
|
-
function toUint8Array(value) {
|
|
4
|
-
if (value instanceof Uint8Array) {
|
|
5
|
-
return value;
|
|
6
|
-
}
|
|
7
|
-
return ArrayBuffer.isView(value)
|
|
8
|
-
? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
9
|
-
: new Uint8Array(value);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* When checking the values of cryptographic hashes are equal, default
|
|
13
|
-
* comparisons can be susceptible to timing based attacks, where attacker is
|
|
14
|
-
* able to find out information about the host system by repeatedly checking
|
|
15
|
-
* response times to equality comparisons of values.
|
|
16
|
-
*
|
|
17
|
-
* It is likely some form of timing safe equality will make its way to the
|
|
18
|
-
* WebCrypto standard (see:
|
|
19
|
-
* {@link https://github.com/w3c/webcrypto/issues/270 | w3c/webcrypto#270}), but until
|
|
20
|
-
* that time, `timingSafeEqual()` is provided.
|
|
21
|
-
*
|
|
22
|
-
* Note: This is a best-effort constant-time comparison implemented in
|
|
23
|
-
* JavaScript. The V8 JIT compiler does not provide formal constant-time
|
|
24
|
-
* guarantees, and inputs backed by `SharedArrayBuffer` are susceptible to
|
|
25
|
-
* concurrent modification during comparison.
|
|
26
|
-
*
|
|
27
|
-
* @example Usage
|
|
28
|
-
* ```ts
|
|
29
|
-
* import { timingSafeEqual } from "@std/crypto/timing-safe-equal";
|
|
30
|
-
* import { assert } from "@std/assert";
|
|
31
|
-
*
|
|
32
|
-
* const a = await crypto.subtle.digest(
|
|
33
|
-
* "SHA-384",
|
|
34
|
-
* new TextEncoder().encode("hello world"),
|
|
35
|
-
* );
|
|
36
|
-
* const b = await crypto.subtle.digest(
|
|
37
|
-
* "SHA-384",
|
|
38
|
-
* new TextEncoder().encode("hello world"),
|
|
39
|
-
* );
|
|
40
|
-
*
|
|
41
|
-
* assert(timingSafeEqual(a, b));
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @param a The first value to compare.
|
|
45
|
-
* @param b The second value to compare.
|
|
46
|
-
* @returns `true` if the values are equal, otherwise `false`.
|
|
47
|
-
* @throws {TypeError} If the byte lengths of the two buffers are not equal.
|
|
48
|
-
*/
|
|
49
|
-
export function timingSafeEqual(a, b) {
|
|
50
|
-
if (a.byteLength !== b.byteLength) {
|
|
51
|
-
throw new TypeError(`Cannot compare buffers of different byte lengths (${a.byteLength} vs ${b.byteLength})`);
|
|
52
|
-
}
|
|
53
|
-
const ua = toUint8Array(a);
|
|
54
|
-
const ub = toUint8Array(b);
|
|
55
|
-
const length = ua.length;
|
|
56
|
-
let out = 0;
|
|
57
|
-
for (let i = 0; i < length; i++) {
|
|
58
|
-
out |= ua[i] ^ ub[i];
|
|
59
|
-
}
|
|
60
|
-
return out === 0;
|
|
61
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
-
export type { Uint8Array_ };
|
|
3
|
-
export declare const alphabet: Uint8Array<ArrayBuffer>;
|
|
4
|
-
export declare const rAlphabet: Uint8Array<ArrayBuffer>;
|
|
5
|
-
/**
|
|
6
|
-
* Calculate the output size needed to encode a given input size for
|
|
7
|
-
* {@linkcode encodeIntoHex}.
|
|
8
|
-
*
|
|
9
|
-
* @param originalSize The size of the input buffer.
|
|
10
|
-
* @returns The size of the output buffer.
|
|
11
|
-
*
|
|
12
|
-
* @example Basic Usage
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { assertEquals } from "@std/assert";
|
|
15
|
-
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
16
|
-
*
|
|
17
|
-
* assertEquals(calcSizeHex(1), 2);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function calcSizeHex(originalSize: number): number;
|
|
21
|
-
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
22
|
-
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
export const alphabet = new TextEncoder().encode("0123456789abcdef");
|
|
3
|
-
export const rAlphabet = new Uint8Array(128).fill(16); // alphabet.Hex.length
|
|
4
|
-
alphabet.forEach((byte, i) => rAlphabet[byte] = i);
|
|
5
|
-
new TextEncoder()
|
|
6
|
-
.encode("ABCDEF")
|
|
7
|
-
.forEach((byte, i) => rAlphabet[byte] = i + 10);
|
|
8
|
-
/**
|
|
9
|
-
* Calculate the output size needed to encode a given input size for
|
|
10
|
-
* {@linkcode encodeIntoHex}.
|
|
11
|
-
*
|
|
12
|
-
* @param originalSize The size of the input buffer.
|
|
13
|
-
* @returns The size of the output buffer.
|
|
14
|
-
*
|
|
15
|
-
* @example Basic Usage
|
|
16
|
-
* ```ts
|
|
17
|
-
* import { assertEquals } from "@std/assert";
|
|
18
|
-
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
19
|
-
*
|
|
20
|
-
* assertEquals(calcSizeHex(1), 2);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function calcSizeHex(originalSize) {
|
|
24
|
-
return originalSize * 2;
|
|
25
|
-
}
|
|
26
|
-
export function encode(buffer, i, o, alphabet) {
|
|
27
|
-
for (; i < buffer.length; ++i) {
|
|
28
|
-
const x = buffer[i];
|
|
29
|
-
buffer[o++] = alphabet[x >> 4];
|
|
30
|
-
buffer[o++] = alphabet[x & 0xF];
|
|
31
|
-
}
|
|
32
|
-
return o;
|
|
33
|
-
}
|
|
34
|
-
export function decode(buffer, i, o, alphabet) {
|
|
35
|
-
if ((buffer.length - o) % 2 === 1) {
|
|
36
|
-
throw new RangeError(`Cannot decode input as hex: Length (${buffer.length - o}) must be divisible by 2`);
|
|
37
|
-
}
|
|
38
|
-
i += 1;
|
|
39
|
-
for (; i < buffer.length; i += 2) {
|
|
40
|
-
buffer[o++] = (getByte(buffer[i - 1], alphabet) << 4) |
|
|
41
|
-
getByte(buffer[i], alphabet);
|
|
42
|
-
}
|
|
43
|
-
return o;
|
|
44
|
-
}
|
|
45
|
-
function getByte(char, alphabet) {
|
|
46
|
-
const byte = alphabet[char] ?? 16;
|
|
47
|
-
if (byte === 16) { // alphabet.Hex.length
|
|
48
|
-
throw new TypeError(`Cannot decode input as hex: Invalid character (${String.fromCharCode(char)})`);
|
|
49
|
-
}
|
|
50
|
-
return byte;
|
|
51
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
-
export type { Uint8Array_ };
|
|
3
|
-
export declare const padding: number;
|
|
4
|
-
export declare const alphabet: Record<Base32Alphabet, Uint8Array>;
|
|
5
|
-
export declare const rAlphabet: Record<Base32Alphabet, Uint8Array>;
|
|
6
|
-
/**
|
|
7
|
-
* Options for encoding and decoding base32 strings.
|
|
8
|
-
*/
|
|
9
|
-
export interface Base32Options {
|
|
10
|
-
/** The base32 alphabet. Defaults to "base32" */
|
|
11
|
-
alphabet?: Base32Alphabet;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The base32 alphabets.
|
|
15
|
-
*/
|
|
16
|
-
export type Base32Alphabet = "base32" | "base32hex" | "base32crockford";
|
|
17
|
-
/**
|
|
18
|
-
* Calculate the output size needed to encode a given input size for
|
|
19
|
-
* {@linkcode encodeIntoBase32}.
|
|
20
|
-
*
|
|
21
|
-
* @param rawSize The size of the input buffer.
|
|
22
|
-
* @returns The size of the output buffer.
|
|
23
|
-
*
|
|
24
|
-
* @example Basic Usage
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { assertEquals } from "@std/assert";
|
|
27
|
-
* import { calcSizeBase32 } from "@std/encoding/unstable-base32";
|
|
28
|
-
*
|
|
29
|
-
* assertEquals(calcSizeBase32(1), 8);
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function calcSizeBase32(rawSize: number): number;
|
|
33
|
-
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|
|
34
|
-
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
-
export const padding = "=".charCodeAt(0);
|
|
3
|
-
export const alphabet = {
|
|
4
|
-
base32: new TextEncoder().encode("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),
|
|
5
|
-
base32hex: new TextEncoder().encode("0123456789ABCDEFGHIJKLMNOPQRSTUV"),
|
|
6
|
-
base32crockford: new TextEncoder().encode("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),
|
|
7
|
-
};
|
|
8
|
-
export const rAlphabet = {
|
|
9
|
-
base32: new Uint8Array(128).fill(32), // alphabet.base32.length
|
|
10
|
-
base32hex: new Uint8Array(128).fill(32),
|
|
11
|
-
base32crockford: new Uint8Array(128).fill(32),
|
|
12
|
-
};
|
|
13
|
-
alphabet.base32
|
|
14
|
-
.forEach((byte, i) => rAlphabet.base32[byte] = i);
|
|
15
|
-
alphabet.base32hex
|
|
16
|
-
.forEach((byte, i) => rAlphabet.base32hex[byte] = i);
|
|
17
|
-
alphabet.base32crockford
|
|
18
|
-
.forEach((byte, i) => rAlphabet.base32crockford[byte] = i);
|
|
19
|
-
/**
|
|
20
|
-
* Calculate the output size needed to encode a given input size for
|
|
21
|
-
* {@linkcode encodeIntoBase32}.
|
|
22
|
-
*
|
|
23
|
-
* @param rawSize The size of the input buffer.
|
|
24
|
-
* @returns The size of the output buffer.
|
|
25
|
-
*
|
|
26
|
-
* @example Basic Usage
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { assertEquals } from "@std/assert";
|
|
29
|
-
* import { calcSizeBase32 } from "@std/encoding/unstable-base32";
|
|
30
|
-
*
|
|
31
|
-
* assertEquals(calcSizeBase32(1), 8);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export function calcSizeBase32(rawSize) {
|
|
35
|
-
return ((rawSize + 4) / 5 | 0) * 8;
|
|
36
|
-
}
|
|
37
|
-
export function encode(buffer, i, o, alphabet, padding) {
|
|
38
|
-
i += 4;
|
|
39
|
-
for (; i < buffer.length; i += 5) {
|
|
40
|
-
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
41
|
-
buffer[o++] = alphabet[x >> 19];
|
|
42
|
-
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
43
|
-
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
44
|
-
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
45
|
-
x = (x << 16) | (buffer[i - 1] << 8) | buffer[i];
|
|
46
|
-
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
47
|
-
buffer[o++] = alphabet[x >> 10 & 0x1F];
|
|
48
|
-
buffer[o++] = alphabet[x >> 5 & 0x1F];
|
|
49
|
-
buffer[o++] = alphabet[x & 0x1F];
|
|
50
|
-
}
|
|
51
|
-
switch (i) {
|
|
52
|
-
case buffer.length + 3: {
|
|
53
|
-
const x = buffer[i - 4] << 16;
|
|
54
|
-
buffer[o++] = alphabet[x >> 19];
|
|
55
|
-
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
56
|
-
buffer[o++] = padding;
|
|
57
|
-
buffer[o++] = padding;
|
|
58
|
-
buffer[o++] = padding;
|
|
59
|
-
buffer[o++] = padding;
|
|
60
|
-
buffer[o++] = padding;
|
|
61
|
-
buffer[o++] = padding;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case buffer.length + 2: {
|
|
65
|
-
const x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8);
|
|
66
|
-
buffer[o++] = alphabet[x >> 19];
|
|
67
|
-
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
68
|
-
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
69
|
-
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
70
|
-
buffer[o++] = padding;
|
|
71
|
-
buffer[o++] = padding;
|
|
72
|
-
buffer[o++] = padding;
|
|
73
|
-
buffer[o++] = padding;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case buffer.length + 1: {
|
|
77
|
-
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
78
|
-
buffer[o++] = alphabet[x >> 19];
|
|
79
|
-
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
80
|
-
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
81
|
-
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
82
|
-
x <<= 16;
|
|
83
|
-
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
84
|
-
buffer[o++] = padding;
|
|
85
|
-
buffer[o++] = padding;
|
|
86
|
-
buffer[o++] = padding;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
case buffer.length: {
|
|
90
|
-
let x = (buffer[i - 4] << 16) | (buffer[i - 3] << 8) | buffer[i - 2];
|
|
91
|
-
buffer[o++] = alphabet[x >> 19];
|
|
92
|
-
buffer[o++] = alphabet[x >> 14 & 0x1F];
|
|
93
|
-
buffer[o++] = alphabet[x >> 9 & 0x1F];
|
|
94
|
-
buffer[o++] = alphabet[x >> 4 & 0x1F];
|
|
95
|
-
x = (x << 16) | (buffer[i - 1] << 8);
|
|
96
|
-
buffer[o++] = alphabet[x >> 15 & 0x1F];
|
|
97
|
-
buffer[o++] = alphabet[x >> 10 & 0x1F];
|
|
98
|
-
buffer[o++] = alphabet[x >> 5 & 0x1F];
|
|
99
|
-
buffer[o++] = padding;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return o;
|
|
104
|
-
}
|
|
105
|
-
export function decode(buffer, i, o, alphabet, padding) {
|
|
106
|
-
for (let x = buffer.length - 6; x < buffer.length; ++x) {
|
|
107
|
-
if (buffer[x] === padding) {
|
|
108
|
-
for (let y = x + 1; y < buffer.length; ++y) {
|
|
109
|
-
if (buffer[y] !== padding) {
|
|
110
|
-
throw new TypeError(`Cannot decode input as base32: Invalid character (${String.fromCharCode(buffer[y])})`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
buffer = buffer.subarray(0, x);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
switch ((buffer.length - o) % 8) {
|
|
118
|
-
case 6:
|
|
119
|
-
case 3:
|
|
120
|
-
case 1:
|
|
121
|
-
throw new RangeError(`Cannot decode input as base32: Length (${buffer.length - o}), excluding padding, must not have a remainder of 1, 3, or 6 when divided by 8`);
|
|
122
|
-
}
|
|
123
|
-
i += 7;
|
|
124
|
-
for (; i < buffer.length; i += 8) {
|
|
125
|
-
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
126
|
-
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
127
|
-
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
128
|
-
(getByte(buffer[i - 4], alphabet) << 4);
|
|
129
|
-
buffer[o++] = x >> 16;
|
|
130
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
131
|
-
x = (x << 16) |
|
|
132
|
-
(getByte(buffer[i - 3], alphabet) << 15) |
|
|
133
|
-
(getByte(buffer[i - 2], alphabet) << 10) |
|
|
134
|
-
(getByte(buffer[i - 1], alphabet) << 5) |
|
|
135
|
-
getByte(buffer[i], alphabet);
|
|
136
|
-
buffer[o++] = x >> 16 & 0xFF;
|
|
137
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
138
|
-
buffer[o++] = x & 0xFF;
|
|
139
|
-
}
|
|
140
|
-
switch (i) {
|
|
141
|
-
case buffer.length + 5: {
|
|
142
|
-
const x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
143
|
-
(getByte(buffer[i - 6], alphabet) << 14);
|
|
144
|
-
buffer[o++] = x >> 16;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case buffer.length + 3: {
|
|
148
|
-
const x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
149
|
-
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
150
|
-
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
151
|
-
(getByte(buffer[i - 4], alphabet) << 4);
|
|
152
|
-
buffer[o++] = x >> 16;
|
|
153
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
case buffer.length + 2: {
|
|
157
|
-
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
158
|
-
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
159
|
-
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
160
|
-
(getByte(buffer[i - 4], alphabet) << 4);
|
|
161
|
-
buffer[o++] = x >> 16;
|
|
162
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
163
|
-
x = (x << 16) |
|
|
164
|
-
(getByte(buffer[i - 3], alphabet) << 15);
|
|
165
|
-
buffer[o++] = x >> 16 & 0xFF;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
case buffer.length: {
|
|
169
|
-
let x = (getByte(buffer[i - 7], alphabet) << 19) |
|
|
170
|
-
(getByte(buffer[i - 6], alphabet) << 14) |
|
|
171
|
-
(getByte(buffer[i - 5], alphabet) << 9) |
|
|
172
|
-
(getByte(buffer[i - 4], alphabet) << 4);
|
|
173
|
-
buffer[o++] = x >> 16;
|
|
174
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
175
|
-
x = (x << 16) |
|
|
176
|
-
(getByte(buffer[i - 3], alphabet) << 15) |
|
|
177
|
-
(getByte(buffer[i - 2], alphabet) << 10) |
|
|
178
|
-
(getByte(buffer[i - 1], alphabet) << 5);
|
|
179
|
-
buffer[o++] = x >> 16 & 0xFF;
|
|
180
|
-
buffer[o++] = x >> 8 & 0xFF;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return o;
|
|
185
|
-
}
|
|
186
|
-
function getByte(char, alphabet) {
|
|
187
|
-
const byte = alphabet[char] ?? 32;
|
|
188
|
-
if (byte === 32) { // alphabet.Base32.length
|
|
189
|
-
throw new TypeError(`Cannot decode input as base32: Invalid character (${String.fromCharCode(char)})`);
|
|
190
|
-
}
|
|
191
|
-
return byte;
|
|
192
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
-
export type { Uint8Array_ };
|
|
3
|
-
export declare const padding: number;
|
|
4
|
-
export declare const alphabet: Record<Base64Alphabet, Uint8Array>;
|
|
5
|
-
export declare const rAlphabet: Record<Base64Alphabet, Uint8Array>;
|
|
6
|
-
/**
|
|
7
|
-
* Options for encoding and decoding base64 strings.
|
|
8
|
-
*/
|
|
9
|
-
export interface Base64Options {
|
|
10
|
-
/** The base64 alphabet. Defaults to "base64" */
|
|
11
|
-
alphabet?: Base64Alphabet;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* The base64 alphabets.
|
|
15
|
-
*/
|
|
16
|
-
export type Base64Alphabet = "base64" | "base64url";
|
|
17
|
-
/**
|
|
18
|
-
* Calculate the output size needed to encode a given input size for
|
|
19
|
-
* {@linkcode encodeIntoBase64}.
|
|
20
|
-
*
|
|
21
|
-
* @param originalSize The size of the input buffer.
|
|
22
|
-
* @returns The size of the output buffer.
|
|
23
|
-
*
|
|
24
|
-
* @example Basic Usage
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { assertEquals } from "@std/assert";
|
|
27
|
-
* import { calcSizeBase64 } from "@std/encoding/unstable-base64";
|
|
28
|
-
*
|
|
29
|
-
* assertEquals(calcSizeBase64(1), 4);
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function calcSizeBase64(originalSize: number): number;
|
|
33
|
-
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|
|
34
|
-
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array, padding: number): number;
|