@udibo/oauth2 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +174 -0
- package/SECURITY.md +77 -0
- package/esm/_dnt.polyfills.d.ts +17 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/adapters/hono/_common.d.ts +66 -0
- package/esm/adapters/hono/_common.js +108 -0
- package/esm/adapters/hono/authorization-server.d.ts +211 -0
- package/esm/adapters/hono/authorization-server.js +214 -0
- package/esm/adapters/hono/bff/auth-request-store.d.ts +164 -0
- package/esm/adapters/hono/bff/auth-request-store.js +154 -0
- package/esm/adapters/hono/bff/bff.d.ts +852 -0
- package/esm/adapters/hono/bff/bff.js +1194 -0
- package/esm/adapters/hono/bff/cookie-prefix.d.ts +72 -0
- package/esm/adapters/hono/bff/cookie-prefix.js +85 -0
- package/esm/adapters/hono/bff/mod.d.ts +19 -0
- package/esm/adapters/hono/bff/mod.js +19 -0
- package/esm/adapters/hono/bff/proxy.d.ts +108 -0
- package/esm/adapters/hono/bff/proxy.js +314 -0
- package/esm/adapters/hono/bff/session-store.d.ts +250 -0
- package/esm/adapters/hono/bff/session-store.js +216 -0
- package/esm/adapters/hono/bff/testing.d.ts +165 -0
- package/esm/adapters/hono/bff/testing.js +254 -0
- package/esm/adapters/hono/identity.d.ts +117 -0
- package/esm/adapters/hono/identity.js +215 -0
- package/esm/adapters/hono/log.d.ts +49 -0
- package/esm/adapters/hono/log.js +66 -0
- package/esm/adapters/hono/resource-server.d.ts +101 -0
- package/esm/adapters/hono/resource-server.js +108 -0
- package/esm/client/_http.d.ts +91 -0
- package/esm/client/_http.js +303 -0
- package/esm/client/base.d.ts +184 -0
- package/esm/client/base.js +93 -0
- package/esm/client/bff-client.d.ts +235 -0
- package/esm/client/bff-client.js +280 -0
- package/esm/client/browser-storage.d.ts +152 -0
- package/esm/client/browser-storage.js +246 -0
- package/esm/client/check.d.ts +114 -0
- package/esm/client/check.js +97 -0
- package/esm/client/direct-client.d.ts +707 -0
- package/esm/client/direct-client.js +1237 -0
- package/esm/client/discovery-cache.d.ts +138 -0
- package/esm/client/discovery-cache.js +124 -0
- package/esm/client/events.d.ts +54 -0
- package/esm/client/events.js +37 -0
- package/esm/client/mod.d.ts +35 -0
- package/esm/client/mod.js +33 -0
- package/esm/client/storage.d.ts +127 -0
- package/esm/client/storage.js +81 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +65 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +16 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +193 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +36 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +61 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +14 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +22 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +52 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +43 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +39 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +22 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +32 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +177 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +41 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +14 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +14 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +20 -0
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +44 -0
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +84 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +39 -0
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +61 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +22 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +51 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +34 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +192 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +34 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +113 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +3 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +13 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +8 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +2 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +26 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +60 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +152 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +87 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +131 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +39 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +72 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +38 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +87 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +97 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +99 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +119 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +209 -0
- package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +343 -0
- package/esm/deps/jsr.io/@std/http/1.1.3/status.js +343 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +223 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +79 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +116 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +139 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +277 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +98 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +181 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +68 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +158 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +206 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +24 -0
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +3 -0
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +91 -0
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +347 -0
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +382 -0
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +1110 -0
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +363 -0
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +616 -0
- package/esm/errors.d.ts +203 -0
- package/esm/errors.js +287 -0
- package/esm/identity/captcha.d.ts +147 -0
- package/esm/identity/captcha.js +64 -0
- package/esm/identity/delivery.d.ts +96 -0
- package/esm/identity/delivery.js +41 -0
- package/esm/identity/errors.d.ts +39 -0
- package/esm/identity/errors.js +46 -0
- package/esm/identity/events.d.ts +242 -0
- package/esm/identity/events.js +39 -0
- package/esm/identity/external/_shared.d.ts +86 -0
- package/esm/identity/external/_shared.js +107 -0
- package/esm/identity/external/_token-exchange.d.ts +61 -0
- package/esm/identity/external/_token-exchange.js +179 -0
- package/esm/identity/external/apple-client-secret.d.ts +82 -0
- package/esm/identity/external/apple-client-secret.js +133 -0
- package/esm/identity/external/apple.d.ts +64 -0
- package/esm/identity/external/apple.js +248 -0
- package/esm/identity/external/discord.d.ts +38 -0
- package/esm/identity/external/discord.js +62 -0
- package/esm/identity/external/errors.d.ts +48 -0
- package/esm/identity/external/errors.js +36 -0
- package/esm/identity/external/flow.d.ts +107 -0
- package/esm/identity/external/flow.js +158 -0
- package/esm/identity/external/github.d.ts +42 -0
- package/esm/identity/external/github.js +164 -0
- package/esm/identity/external/google.d.ts +52 -0
- package/esm/identity/external/google.js +38 -0
- package/esm/identity/external/mod.d.ts +63 -0
- package/esm/identity/external/mod.js +61 -0
- package/esm/identity/external/oauth2.d.ts +110 -0
- package/esm/identity/external/oauth2.js +158 -0
- package/esm/identity/external/oidc.d.ts +81 -0
- package/esm/identity/external/oidc.js +250 -0
- package/esm/identity/external/provider.d.ts +132 -0
- package/esm/identity/external/provider.js +12 -0
- package/esm/identity/hibp.d.ts +67 -0
- package/esm/identity/hibp.js +87 -0
- package/esm/identity/identifier.d.ts +44 -0
- package/esm/identity/identifier.js +47 -0
- package/esm/identity/lockout.d.ts +155 -0
- package/esm/identity/lockout.js +117 -0
- package/esm/identity/mfa/mod.d.ts +42 -0
- package/esm/identity/mfa/mod.js +42 -0
- package/esm/identity/mfa/recovery-codes.d.ts +96 -0
- package/esm/identity/mfa/recovery-codes.js +80 -0
- package/esm/identity/mfa/service.d.ts +338 -0
- package/esm/identity/mfa/service.js +351 -0
- package/esm/identity/mfa/totp.d.ts +186 -0
- package/esm/identity/mfa/totp.js +194 -0
- package/esm/identity/migration.d.ts +155 -0
- package/esm/identity/migration.js +243 -0
- package/esm/identity/mod.d.ts +65 -0
- package/esm/identity/mod.js +64 -0
- package/esm/identity/otp.d.ts +255 -0
- package/esm/identity/otp.js +245 -0
- package/esm/identity/password-policy.d.ts +45 -0
- package/esm/identity/password-policy.js +60 -0
- package/esm/identity/password.d.ts +171 -0
- package/esm/identity/password.js +160 -0
- package/esm/identity/rate-limit.d.ts +192 -0
- package/esm/identity/rate-limit.js +168 -0
- package/esm/identity/service.d.ts +579 -0
- package/esm/identity/service.js +835 -0
- package/esm/identity/session.d.ts +122 -0
- package/esm/identity/session.js +48 -0
- package/esm/identity/token-flow.d.ts +214 -0
- package/esm/identity/token-flow.js +173 -0
- package/esm/models/authentication.d.ts +24 -0
- package/esm/models/authentication.js +1 -0
- package/esm/models/authorization-code.d.ts +63 -0
- package/esm/models/authorization-code.js +1 -0
- package/esm/models/authorization.d.ts +165 -0
- package/esm/models/authorization.js +160 -0
- package/esm/models/client.d.ts +78 -0
- package/esm/models/client.js +1 -0
- package/esm/models/device-authorization.d.ts +30 -0
- package/esm/models/device-authorization.js +1 -0
- package/esm/models/responses.d.ts +93 -0
- package/esm/models/responses.js +1 -0
- package/esm/models/scope.d.ts +81 -0
- package/esm/models/scope.js +125 -0
- package/esm/models/token.d.ts +135 -0
- package/esm/models/token.js +1 -0
- package/esm/package.json +3 -0
- package/esm/react/callback.d.ts +52 -0
- package/esm/react/callback.js +71 -0
- package/esm/react/components/class-names.d.ts +91 -0
- package/esm/react/components/class-names.js +118 -0
- package/esm/react/components/internal.d.ts +62 -0
- package/esm/react/components/internal.js +102 -0
- package/esm/react/components/mfa-challenge-form.d.ts +66 -0
- package/esm/react/components/mfa-challenge-form.js +46 -0
- package/esm/react/components/mfa-enrollment-form.d.ts +83 -0
- package/esm/react/components/mfa-enrollment-form.js +41 -0
- package/esm/react/components/mod.d.ts +103 -0
- package/esm/react/components/mod.js +93 -0
- package/esm/react/components/request-password-reset-form.d.ts +61 -0
- package/esm/react/components/request-password-reset-form.js +41 -0
- package/esm/react/components/reset-password-form.d.ts +66 -0
- package/esm/react/components/reset-password-form.js +56 -0
- package/esm/react/components/sign-in-form.d.ts +74 -0
- package/esm/react/components/sign-in-form.js +43 -0
- package/esm/react/components/sign-up-form.d.ts +85 -0
- package/esm/react/components/sign-up-form.js +57 -0
- package/esm/react/components/types.d.ts +208 -0
- package/esm/react/components/types.js +14 -0
- package/esm/react/components/use-auth-form.d.ts +118 -0
- package/esm/react/components/use-auth-form.js +172 -0
- package/esm/react/components/user-menu.d.ts +79 -0
- package/esm/react/components/user-menu.js +73 -0
- package/esm/react/context.d.ts +51 -0
- package/esm/react/context.js +16 -0
- package/esm/react/mod.d.ts +26 -0
- package/esm/react/mod.js +26 -0
- package/esm/react/provider.d.ts +40 -0
- package/esm/react/provider.js +189 -0
- package/esm/react/require-auth.d.ts +31 -0
- package/esm/react/require-auth.js +37 -0
- package/esm/react/testing.d.ts +322 -0
- package/esm/react/testing.js +461 -0
- package/esm/react/use-authorization.d.ts +31 -0
- package/esm/react/use-authorization.js +36 -0
- package/esm/react/use-oauth2.d.ts +112 -0
- package/esm/react/use-oauth2.js +127 -0
- package/esm/server/authorization-server.d.ts +736 -0
- package/esm/server/authorization-server.js +1304 -0
- package/esm/server/client-authentication.d.ts +28 -0
- package/esm/server/client-authentication.js +51 -0
- package/esm/server/grants/authorization-code.d.ts +179 -0
- package/esm/server/grants/authorization-code.js +232 -0
- package/esm/server/grants/client-credentials.d.ts +52 -0
- package/esm/server/grants/client-credentials.js +53 -0
- package/esm/server/grants/device-authorization.d.ts +103 -0
- package/esm/server/grants/device-authorization.js +156 -0
- package/esm/server/grants/grant.d.ts +165 -0
- package/esm/server/grants/grant.js +173 -0
- package/esm/server/grants/password.d.ts +80 -0
- package/esm/server/grants/password.js +92 -0
- package/esm/server/grants/refresh-token.d.ts +80 -0
- package/esm/server/grants/refresh-token.js +136 -0
- package/esm/server/introspection-token-reader.d.ts +153 -0
- package/esm/server/introspection-token-reader.js +164 -0
- package/esm/server/jwks-token-reader.d.ts +263 -0
- package/esm/server/jwks-token-reader.js +508 -0
- package/esm/server/mod.d.ts +23 -0
- package/esm/server/mod.js +15 -0
- package/esm/server/public-suffix/mod.d.ts +62 -0
- package/esm/server/public-suffix/mod.js +103 -0
- package/esm/server/public-suffix/rules.d.ts +23 -0
- package/esm/server/public-suffix/rules.js +23 -0
- package/esm/server/redirect-uri.d.ts +187 -0
- package/esm/server/redirect-uri.js +331 -0
- package/esm/server/resource-server.d.ts +286 -0
- package/esm/server/resource-server.js +365 -0
- package/esm/server/services/authorization-code.d.ts +84 -0
- package/esm/server/services/authorization-code.js +35 -0
- package/esm/server/services/client.d.ts +35 -0
- package/esm/server/services/client.js +1 -0
- package/esm/server/services/device-authorization.d.ts +134 -0
- package/esm/server/services/device-authorization.js +7 -0
- package/esm/server/services/token.d.ts +242 -0
- package/esm/server/services/token.js +78 -0
- package/esm/server/services/user.d.ts +29 -0
- package/esm/server/services/user.js +7 -0
- package/esm/server/signing-keys.d.ts +201 -0
- package/esm/server/signing-keys.js +225 -0
- package/esm/server/utils/hash.d.ts +6 -0
- package/esm/server/utils/hash.js +11 -0
- package/esm/testing/contract/authorization-code.d.ts +37 -0
- package/esm/testing/contract/authorization-code.js +93 -0
- package/esm/testing/contract/client.d.ts +85 -0
- package/esm/testing/contract/client.js +126 -0
- package/esm/testing/contract/device-authorization.d.ts +37 -0
- package/esm/testing/contract/device-authorization.js +193 -0
- package/esm/testing/contract/lockout-store.d.ts +47 -0
- package/esm/testing/contract/lockout-store.js +122 -0
- package/esm/testing/contract/mfa-store.d.ts +50 -0
- package/esm/testing/contract/mfa-store.js +226 -0
- package/esm/testing/contract/mod.d.ts +39 -0
- package/esm/testing/contract/mod.js +39 -0
- package/esm/testing/contract/otp-store.d.ts +48 -0
- package/esm/testing/contract/otp-store.js +197 -0
- package/esm/testing/contract/rate-limit-store.d.ts +52 -0
- package/esm/testing/contract/rate-limit-store.js +105 -0
- package/esm/testing/contract/token-flow-store.d.ts +54 -0
- package/esm/testing/contract/token-flow-store.js +179 -0
- package/esm/testing/contract/token-reader.d.ts +77 -0
- package/esm/testing/contract/token-reader.js +78 -0
- package/esm/testing/contract/token.d.ts +61 -0
- package/esm/testing/contract/token.js +287 -0
- package/esm/testing/contract/user.d.ts +63 -0
- package/esm/testing/contract/user.js +75 -0
- package/esm/testing/mod.d.ts +34 -0
- package/esm/testing/mod.js +34 -0
- package/esm/testing/server.d.ts +197 -0
- package/esm/testing/server.js +193 -0
- package/esm/testing/services.d.ts +373 -0
- package/esm/testing/services.js +703 -0
- package/esm/utils/_buffer.d.ts +10 -0
- package/esm/utils/_buffer.js +12 -0
- package/esm/utils/_timing-safe.d.ts +13 -0
- package/esm/utils/_timing-safe.js +22 -0
- package/esm/utils/authentication-context.d.ts +3 -0
- package/esm/utils/authentication-context.js +14 -0
- package/esm/utils/basic-auth.d.ts +50 -0
- package/esm/utils/basic-auth.js +106 -0
- package/esm/utils/crypto.d.ts +97 -0
- package/esm/utils/crypto.js +162 -0
- package/esm/utils/pkce.d.ts +151 -0
- package/esm/utils/pkce.js +179 -0
- package/esm/utils/text.d.ts +24 -0
- package/esm/utils/text.js +28 -0
- package/esm/utils/url.d.ts +66 -0
- package/esm/utils/url.js +90 -0
- package/package.json +92 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory implementations of every OAuth2 service interface.
|
|
3
|
+
*
|
|
4
|
+
* The `Memory*Service` family is the public, generic version of the fixtures
|
|
5
|
+
* the library uses for its own tests. They satisfy the
|
|
6
|
+
* `UserServiceInterface`, `ClientServiceInterface`, `TokenServiceInterface`,
|
|
7
|
+
* `AuthorizationCodeServiceInterface`, and `DeviceAuthorizationServiceInterface`
|
|
8
|
+
* contracts using `Map`-backed storage that lives only for the process /
|
|
9
|
+
* test lifetime.
|
|
10
|
+
*
|
|
11
|
+
* They are deliberately **not** for production: tokens and codes vanish on
|
|
12
|
+
* restart, there is no concurrency control, and nothing is ever reclaimed — an
|
|
13
|
+
* expired record stays in its `Map` until something revokes it, and the
|
|
14
|
+
* revoked-refresh-token tombstones that reuse detection reads are kept for the
|
|
15
|
+
* process lifetime, so memory grows with every token issued. Port the shape to
|
|
16
|
+
* a database and it needs the expiry sweep or row TTL these fixtures skip. Use
|
|
17
|
+
* them to:
|
|
18
|
+
*
|
|
19
|
+
* - Spin up a stand-in authorization server in tests of consumer apps.
|
|
20
|
+
* - Prototype an OAuth2 integration before the database schema lands.
|
|
21
|
+
* - Drive examples that need realistic data without DB infrastructure.
|
|
22
|
+
*
|
|
23
|
+
* Pair with `createMemoryAuthorizationServer` for the one-shot factory
|
|
24
|
+
* variant, or compose directly when you need finer control.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import type { ClientInterface } from "../models/client.js";
|
|
29
|
+
import type { AuthorizationCode } from "../models/authorization-code.js";
|
|
30
|
+
import type { RefreshToken, Token } from "../models/token.js";
|
|
31
|
+
import type { DeviceAuthorization } from "../models/device-authorization.js";
|
|
32
|
+
import type { AbstractScope, BasicScope } from "../models/scope.js";
|
|
33
|
+
import type { AuthorizationCodeServiceInterface } from "../server/services/authorization-code.js";
|
|
34
|
+
import type { ClientServiceInterface } from "../server/services/client.js";
|
|
35
|
+
import type { DeviceAuthorizationServiceInterface } from "../server/services/device-authorization.js";
|
|
36
|
+
import type { TokenServiceInterface } from "../server/services/token.js";
|
|
37
|
+
import type { UserServiceInterface } from "../server/services/user.js";
|
|
38
|
+
import { type PasswordCredential, type PasswordHasherLike } from "../identity/password.js";
|
|
39
|
+
/** Options for {@link MemoryUserService}. */
|
|
40
|
+
export interface MemoryUserServiceOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Hasher used to mint and check credentials. Defaults to
|
|
43
|
+
* {@link PasswordIdentityService} at a deliberately low iteration count:
|
|
44
|
+
* these credentials live in a `Map` that dies with the process, so a
|
|
45
|
+
* production work factor defends nothing here and only slows a test suite
|
|
46
|
+
* down. Credentials still record their `params`, so one minted by a
|
|
47
|
+
* production-strength hasher and handed to {@link
|
|
48
|
+
* MemoryUserService.setCredential} verifies unchanged. Pass your own hasher
|
|
49
|
+
* to exercise the real cost.
|
|
50
|
+
*/
|
|
51
|
+
passwords?: PasswordHasherLike;
|
|
52
|
+
}
|
|
53
|
+
/** Minimal user shape the default `MemoryUserService` knows how to index. */
|
|
54
|
+
export interface MemoryUserShape {
|
|
55
|
+
/** Stable identifier the service indexes users by. */
|
|
56
|
+
id: string;
|
|
57
|
+
/** Login name used by the resource-owner password and credential lookups. */
|
|
58
|
+
username: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* In-memory `UserServiceInterface` implementation.
|
|
62
|
+
*
|
|
63
|
+
* Generic over the user type — supply your real app's `User` interface
|
|
64
|
+
* (extending {@link MemoryUserShape}) so fixtures match production data.
|
|
65
|
+
*/
|
|
66
|
+
export declare class MemoryUserService<U extends MemoryUserShape> implements UserServiceInterface<U> {
|
|
67
|
+
#private;
|
|
68
|
+
/** Applies the password-hasher default; construct with no arguments for it. */
|
|
69
|
+
constructor(options?: MemoryUserServiceOptions);
|
|
70
|
+
/** Adds a user with the given password. Throws on duplicate id or username. */
|
|
71
|
+
add(user: U, password: string): Promise<void>;
|
|
72
|
+
/** Looks up a user by id, or resolves `undefined` when none is stored. */
|
|
73
|
+
get(id: string): Promise<U | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolves the user when the username exists and the password verifies
|
|
76
|
+
* against its stored salt/hash, otherwise `undefined`. Backs the
|
|
77
|
+
* resource-owner password-credentials grant.
|
|
78
|
+
*/
|
|
79
|
+
getAuthenticated(username: string, password: string): Promise<U | undefined>;
|
|
80
|
+
/** Looks up a user by username without a password check, or `undefined`. */
|
|
81
|
+
findByUsername(username: string): Promise<U | undefined>;
|
|
82
|
+
/**
|
|
83
|
+
* The user's stored password credential, or `undefined`. Shape-compatible
|
|
84
|
+
* with the identity layer's `IdentityUserStore.getCredential`, so a
|
|
85
|
+
* memory-backed store can drive the own-auth flows (sign-in, password
|
|
86
|
+
* reset) in examples and tests.
|
|
87
|
+
*/
|
|
88
|
+
getCredential(userId: string): Promise<PasswordCredential | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Replace the user's stored password credential (e.g. after a password
|
|
91
|
+
* reset). Matches `IdentityUserStore.setCredential`.
|
|
92
|
+
* @throws Error when no user with `userId` exists.
|
|
93
|
+
*/
|
|
94
|
+
setCredential(userId: string, credential: PasswordCredential): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* In-memory `ClientServiceInterface` implementation.
|
|
98
|
+
*
|
|
99
|
+
* A client is treated as confidential when {@link add} is called with a
|
|
100
|
+
* secret, and public when it is not — there is no separate flag to
|
|
101
|
+
* remember. `getAuthenticated` requires the secret for confidential
|
|
102
|
+
* clients and accepts a missing secret for public clients.
|
|
103
|
+
*/
|
|
104
|
+
export declare class MemoryClientService<C extends ClientInterface, U> implements ClientServiceInterface<C, U> {
|
|
105
|
+
#private;
|
|
106
|
+
/**
|
|
107
|
+
* Creates an empty client store backed by the given user service.
|
|
108
|
+
*
|
|
109
|
+
* @param userService Resolves the owner returned by {@linkcode getUser}
|
|
110
|
+
* for the client-credentials grant.
|
|
111
|
+
*/
|
|
112
|
+
constructor(userService: UserServiceInterface<U>);
|
|
113
|
+
/**
|
|
114
|
+
* Registers a client. Pass `secret` to make it confidential; omit for a
|
|
115
|
+
* public client. `ownerUserId` is the user returned by {@link getUser},
|
|
116
|
+
* used by the client-credentials grant.
|
|
117
|
+
* @throws Error when a client with the same id is already registered.
|
|
118
|
+
*/
|
|
119
|
+
add(client: C, secret?: string, ownerUserId?: string): Promise<void>;
|
|
120
|
+
/** Looks up a client by id, or resolves `undefined` when none is stored. */
|
|
121
|
+
get(id: string): Promise<C | undefined>;
|
|
122
|
+
/**
|
|
123
|
+
* Resolves the client when authentication succeeds, otherwise `undefined`.
|
|
124
|
+
* Confidential clients (registered with a secret) require a matching
|
|
125
|
+
* `secret`; public clients (registered without one) ignore it.
|
|
126
|
+
*/
|
|
127
|
+
getAuthenticated(id: string, secret?: string): Promise<C | undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* Resolves the user registered as the client's owner via the `ownerUserId`
|
|
130
|
+
* passed to {@linkcode add}, or `undefined` when none was set. Accepts the
|
|
131
|
+
* client or its id.
|
|
132
|
+
*/
|
|
133
|
+
getUser(client: C | string): Promise<U | undefined>;
|
|
134
|
+
}
|
|
135
|
+
/** Options for {@link MemoryTokenService}. */
|
|
136
|
+
export interface MemoryTokenServiceOptions<C extends ClientInterface, U extends MemoryUserShape> {
|
|
137
|
+
/** Resolves clients when hydrating stored tokens back into full records. */
|
|
138
|
+
clientService: ClientServiceInterface<C, U>;
|
|
139
|
+
/** Resolves users when hydrating stored tokens back into full records. */
|
|
140
|
+
userService: UserServiceInterface<U>;
|
|
141
|
+
/** Default access-token lifetime in seconds. Defaults to 1 hour. */
|
|
142
|
+
accessTokenLifetime?: number;
|
|
143
|
+
/** Default refresh-token lifetime in seconds. Defaults to 14 days. */
|
|
144
|
+
refreshTokenLifetime?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Default absolute lifetime of a refresh-token family in seconds. Omit to
|
|
147
|
+
* leave rotation uncapped.
|
|
148
|
+
*/
|
|
149
|
+
refreshTokenMaxLifetime?: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* In-memory `TokenServiceInterface` implementation. Tokens are hashed on
|
|
153
|
+
* write and looked up by hash, mirroring how a real database-backed token
|
|
154
|
+
* service would store them.
|
|
155
|
+
*
|
|
156
|
+
* Per-client lifetime overrides are supported via three optional fields the
|
|
157
|
+
* client may declare: `accessTokenLifetime`, `refreshTokenLifetime`, and
|
|
158
|
+
* `refreshTokenMaxLifetime`. Each takes precedence over the service-wide
|
|
159
|
+
* default when present.
|
|
160
|
+
*/
|
|
161
|
+
export declare class MemoryTokenService<C extends ClientInterface, U extends MemoryUserShape, S extends AbstractScope = BasicScope> implements TokenServiceInterface<C, U, S> {
|
|
162
|
+
#private;
|
|
163
|
+
/** Service-wide access-token lifetime in seconds when a client sets none. */
|
|
164
|
+
accessTokenLifetime: number;
|
|
165
|
+
/** Service-wide refresh-token lifetime in seconds when a client sets none. */
|
|
166
|
+
refreshTokenLifetime: number;
|
|
167
|
+
/**
|
|
168
|
+
* Service-wide absolute refresh-token family lifetime in seconds when a
|
|
169
|
+
* client sets none. Undefined leaves families uncapped.
|
|
170
|
+
*/
|
|
171
|
+
refreshTokenMaxLifetime?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Creates an empty token store.
|
|
174
|
+
*
|
|
175
|
+
* @param options Backing client/user services and optional default token
|
|
176
|
+
* lifetimes.
|
|
177
|
+
*/
|
|
178
|
+
constructor(options: MemoryTokenServiceOptions<C, U>);
|
|
179
|
+
/**
|
|
180
|
+
* Accepts the requested scope verbatim; the stub performs no scope
|
|
181
|
+
* narrowing. Return `false` from a subclass to reject a request.
|
|
182
|
+
*/
|
|
183
|
+
acceptedScope(_client: C, _user: U, scope?: S | null): Promise<S | null | undefined | false>;
|
|
184
|
+
/** Mints a random opaque access token. */
|
|
185
|
+
generateAccessToken(_client: C, _user: U, _scope?: S | null): Promise<string>;
|
|
186
|
+
/** Mints a random opaque refresh token. */
|
|
187
|
+
generateRefreshToken(_client: C, _user: U, _scope?: S | null): Promise<string | undefined>;
|
|
188
|
+
/**
|
|
189
|
+
* Returns now plus the client's `accessTokenLifetime` override, falling back
|
|
190
|
+
* to {@linkcode accessTokenLifetime}.
|
|
191
|
+
*/
|
|
192
|
+
accessTokenExpiresAt(client: C, _user: U, _scope?: S | null): Promise<Date | undefined>;
|
|
193
|
+
/**
|
|
194
|
+
* Returns now plus the client's `refreshTokenLifetime` override, falling
|
|
195
|
+
* back to {@linkcode refreshTokenLifetime}.
|
|
196
|
+
*/
|
|
197
|
+
refreshTokenExpiresAt(client: C, _user: U, _scope?: S | null): Promise<Date | undefined>;
|
|
198
|
+
/**
|
|
199
|
+
* Returns the family anchor plus the client's `refreshTokenMaxLifetime`
|
|
200
|
+
* override, falling back to {@linkcode refreshTokenMaxLifetime}, or
|
|
201
|
+
* `undefined` when neither caps the family.
|
|
202
|
+
*/
|
|
203
|
+
refreshTokenFamilyExpiresAt(client: C, _user: U, familyCreatedAt: Date, _scope?: S | null): Promise<Date | undefined>;
|
|
204
|
+
/**
|
|
205
|
+
* Resolves the token whose access token hashes to the given value, with its
|
|
206
|
+
* client and user rehydrated, or `undefined` when not found.
|
|
207
|
+
*/
|
|
208
|
+
getToken(accessToken: string): Promise<Token<C, U, S> | undefined>;
|
|
209
|
+
/**
|
|
210
|
+
* Resolves the refresh token whose value hashes to the given input, with its
|
|
211
|
+
* client and user rehydrated, or `undefined` when not found.
|
|
212
|
+
*/
|
|
213
|
+
getRefreshToken(refreshToken: string): Promise<RefreshToken<C, U, S> | undefined>;
|
|
214
|
+
/**
|
|
215
|
+
* Persists a token, indexing it by hashed access token (and hashed refresh
|
|
216
|
+
* token, plus authorization-code hash when a `code` is present so
|
|
217
|
+
* {@linkcode revokeCode} can find it). Returns the input unchanged.
|
|
218
|
+
*/
|
|
219
|
+
save(token: RefreshToken<C, U, S>): Promise<RefreshToken<C, U, S>>;
|
|
220
|
+
/**
|
|
221
|
+
* Persists a token, indexing it by hashed access token (and authorization-code
|
|
222
|
+
* hash when a `code` is present). Returns the input unchanged.
|
|
223
|
+
*/
|
|
224
|
+
save(token: Token<C, U, S>): Promise<Token<C, U, S>>;
|
|
225
|
+
/**
|
|
226
|
+
* Removes the given token and its paired access/refresh entry. Resolves
|
|
227
|
+
* `true` when something was removed, `false` otherwise.
|
|
228
|
+
*/
|
|
229
|
+
revoke(token: Token<C, U, S>): Promise<boolean>;
|
|
230
|
+
/**
|
|
231
|
+
* Removes the given refresh token and its paired access entry. Resolves
|
|
232
|
+
* `true` when something was removed, `false` otherwise.
|
|
233
|
+
*/
|
|
234
|
+
revoke(token: RefreshToken<C, U, S>): Promise<boolean>;
|
|
235
|
+
/**
|
|
236
|
+
* Removes a token by its raw string value. Pass `hint` of `"refresh_token"`
|
|
237
|
+
* to look it up as a refresh token; any other value treats it as an access
|
|
238
|
+
* token. Resolves `true` when something was removed.
|
|
239
|
+
*/
|
|
240
|
+
revoke(token: string, hint?: string | null): Promise<boolean>;
|
|
241
|
+
/**
|
|
242
|
+
* Looks up a revoked/rotated-out refresh token for the refresh grant's
|
|
243
|
+
* reuse detection: revoked refresh records are kept as tombstones instead
|
|
244
|
+
* of deleted.
|
|
245
|
+
*/
|
|
246
|
+
getRevokedRefreshToken(refreshToken: string): Promise<RefreshToken<C, U, S> | undefined>;
|
|
247
|
+
/**
|
|
248
|
+
* Revokes every live token in a rotation family (reuse detection response).
|
|
249
|
+
* Resolves `true` when at least one live token was removed.
|
|
250
|
+
*/
|
|
251
|
+
revokeFamily(familyId: string): Promise<boolean>;
|
|
252
|
+
/**
|
|
253
|
+
* Removes every token issued from the given authorization code, used when a
|
|
254
|
+
* code is replayed. Resolves `true` when at least one token was removed.
|
|
255
|
+
*/
|
|
256
|
+
revokeCode(code: string): Promise<boolean>;
|
|
257
|
+
}
|
|
258
|
+
/** Options for {@link MemoryAuthorizationCodeService}. */
|
|
259
|
+
export interface MemoryAuthorizationCodeServiceOptions<C extends ClientInterface, U extends MemoryUserShape> {
|
|
260
|
+
/** Resolves clients when hydrating stored codes back into full records. */
|
|
261
|
+
clientService: ClientServiceInterface<C, U>;
|
|
262
|
+
/** Resolves users when hydrating stored codes back into full records. */
|
|
263
|
+
userService: UserServiceInterface<U>;
|
|
264
|
+
/** Lifetime in seconds. Defaults to 10 minutes. */
|
|
265
|
+
lifetime?: number;
|
|
266
|
+
}
|
|
267
|
+
/** In-memory `AuthorizationCodeServiceInterface` implementation. */
|
|
268
|
+
export declare class MemoryAuthorizationCodeService<C extends ClientInterface, U extends MemoryUserShape, S extends AbstractScope = BasicScope> implements AuthorizationCodeServiceInterface<C, U, S> {
|
|
269
|
+
#private;
|
|
270
|
+
/** Authorization-code lifetime in seconds applied by {@linkcode expiresAt}. */
|
|
271
|
+
lifetime: number;
|
|
272
|
+
/**
|
|
273
|
+
* Creates an empty authorization-code store.
|
|
274
|
+
*
|
|
275
|
+
* @param options Backing client/user services and optional code lifetime.
|
|
276
|
+
*/
|
|
277
|
+
constructor(options: MemoryAuthorizationCodeServiceOptions<C, U>);
|
|
278
|
+
/** Mints a random opaque authorization code. */
|
|
279
|
+
generateCode(_client: C, _user: U, _scope?: S | null): Promise<string>;
|
|
280
|
+
/** Returns now plus {@linkcode lifetime}. */
|
|
281
|
+
expiresAt(_client: C, _user: U, _scope?: S | null): Promise<Date>;
|
|
282
|
+
/**
|
|
283
|
+
* Resolves the code whose value hashes to the given input, with its client
|
|
284
|
+
* and user rehydrated, or `undefined` when not found or either is missing.
|
|
285
|
+
*/
|
|
286
|
+
get(code: string): Promise<AuthorizationCode<C, U, S> | undefined>;
|
|
287
|
+
/**
|
|
288
|
+
* Persists an authorization code indexed by its hash, including the PKCE
|
|
289
|
+
* challenge and redirect URI. Returns the input unchanged.
|
|
290
|
+
*/
|
|
291
|
+
save(authorizationCode: AuthorizationCode<C, U, S>): Promise<AuthorizationCode<C, U, S>>;
|
|
292
|
+
/**
|
|
293
|
+
* Removes a code, accepting the record or its raw string. Resolves `true`
|
|
294
|
+
* when a code was removed, `false` otherwise.
|
|
295
|
+
*/
|
|
296
|
+
revoke(authorizationCode: AuthorizationCode<C, U, S> | string): Promise<boolean>;
|
|
297
|
+
}
|
|
298
|
+
/** Options for {@link MemoryDeviceAuthorizationService}. */
|
|
299
|
+
export interface MemoryDeviceAuthorizationServiceOptions<C extends ClientInterface, U extends MemoryUserShape> {
|
|
300
|
+
/** Resolves clients when hydrating stored authorizations into full records. */
|
|
301
|
+
clientService: ClientServiceInterface<C, U>;
|
|
302
|
+
/** Resolves users when hydrating stored authorizations into full records. */
|
|
303
|
+
userService: UserServiceInterface<U>;
|
|
304
|
+
/** Lifetime in seconds. Defaults to 30 minutes. */
|
|
305
|
+
lifetime?: number;
|
|
306
|
+
/** Polling interval floor in seconds. Defaults to 5. */
|
|
307
|
+
interval?: number;
|
|
308
|
+
}
|
|
309
|
+
/** In-memory `DeviceAuthorizationServiceInterface` implementation. */
|
|
310
|
+
export declare class MemoryDeviceAuthorizationService<C extends ClientInterface, U extends MemoryUserShape, S extends AbstractScope = BasicScope> implements DeviceAuthorizationServiceInterface<C, U, S> {
|
|
311
|
+
#private;
|
|
312
|
+
/** Device-authorization lifetime in seconds applied by {@linkcode expiresAt}. */
|
|
313
|
+
lifetime: number;
|
|
314
|
+
/** Minimum seconds clients must wait between token-endpoint polls. */
|
|
315
|
+
interval: number;
|
|
316
|
+
/**
|
|
317
|
+
* Creates an empty device-authorization store.
|
|
318
|
+
*
|
|
319
|
+
* @param options Backing client/user services and optional lifetime and
|
|
320
|
+
* polling interval.
|
|
321
|
+
*/
|
|
322
|
+
constructor(options: MemoryDeviceAuthorizationServiceOptions<C, U>);
|
|
323
|
+
/** Mints a random opaque device code (polled by the device). */
|
|
324
|
+
generateDeviceCode(_client: C, _scope?: S | null): Promise<string>;
|
|
325
|
+
/**
|
|
326
|
+
* Mints a short, human-enterable user code in `XXXX-XXXX` form drawn from an
|
|
327
|
+
* unambiguous alphabet (no vowels or look-alike digits).
|
|
328
|
+
*/
|
|
329
|
+
generateUserCode(_client: C, _scope?: S | null): Promise<string>;
|
|
330
|
+
/** Returns now plus {@linkcode lifetime}. */
|
|
331
|
+
expiresAt(_client: C, _scope?: S | null): Promise<Date>;
|
|
332
|
+
/**
|
|
333
|
+
* Persists a device authorization indexed by both its hashed device code and
|
|
334
|
+
* hashed user code. Returns the input unchanged.
|
|
335
|
+
*/
|
|
336
|
+
save(authorization: DeviceAuthorization<C, U, S>): Promise<DeviceAuthorization<C, U, S>>;
|
|
337
|
+
/**
|
|
338
|
+
* Resolves the authorization for a device code (the value the device polls
|
|
339
|
+
* with), client and user rehydrated, or `undefined` when not found.
|
|
340
|
+
*/
|
|
341
|
+
getByDeviceCode(deviceCode: string): Promise<DeviceAuthorization<C, U, S> | undefined>;
|
|
342
|
+
/**
|
|
343
|
+
* Resolves the authorization for a user code (the value the user enters in a
|
|
344
|
+
* browser), client and user rehydrated, or `undefined` when not found.
|
|
345
|
+
*/
|
|
346
|
+
getByUserCode(userCode: string): Promise<DeviceAuthorization<C, U, S> | undefined>;
|
|
347
|
+
/**
|
|
348
|
+
* Marks the authorization granted by `user`, optionally narrowing `scope`,
|
|
349
|
+
* so a subsequent device-code poll can exchange it for a token. Returns the
|
|
350
|
+
* updated record. Throws when the authorization is not stored.
|
|
351
|
+
*/
|
|
352
|
+
approve(authorization: DeviceAuthorization<C, U, S>, user: U, scope?: S | null): Promise<DeviceAuthorization<C, U, S>>;
|
|
353
|
+
/**
|
|
354
|
+
* Marks the authorization denied so a subsequent poll is rejected. Returns
|
|
355
|
+
* the updated record. Throws when the authorization is not stored.
|
|
356
|
+
*/
|
|
357
|
+
deny(authorization: DeviceAuthorization<C, U, S>): Promise<DeviceAuthorization<C, U, S>>;
|
|
358
|
+
/**
|
|
359
|
+
* Records that the device just polled (and stores its current interval) so
|
|
360
|
+
* `slow_down` rate limiting can be enforced. Returns the updated record.
|
|
361
|
+
* Throws when the authorization is not stored.
|
|
362
|
+
*/
|
|
363
|
+
updateLastPolled(authorization: DeviceAuthorization<C, U, S>): Promise<DeviceAuthorization<C, U, S>>;
|
|
364
|
+
/**
|
|
365
|
+
* Removes a device authorization, accepting a raw device code or any record
|
|
366
|
+
* this store returns — including the partially hydrated ones from
|
|
367
|
+
* {@linkcode getByDeviceCode} and {@linkcode getByUserCode}, which are
|
|
368
|
+
* resolved back to the stored entry so both its device-code and user-code
|
|
369
|
+
* index entries are dropped. Resolves `true` only for the call that removed
|
|
370
|
+
* a live authorization, `false` otherwise.
|
|
371
|
+
*/
|
|
372
|
+
revoke(authorization: DeviceAuthorization<C, U, S> | string): Promise<boolean>;
|
|
373
|
+
}
|