@_mustachio/openauth 0.9.2 → 0.11.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/dist/esm/adapters/d1/audit-log.js +15 -0
- package/dist/esm/adapters/d1/config-store.js +45 -0
- package/dist/esm/adapters/d1/index.js +12 -0
- package/dist/esm/adapters/d1/key-store.js +116 -0
- package/dist/esm/adapters/d1/method-store.js +52 -0
- package/dist/esm/adapters/d1/migrations.js +77 -0
- package/dist/esm/adapters/d1/session-store.js +134 -0
- package/dist/esm/adapters/d1/session.js +18 -0
- package/dist/esm/adapters/d1/token-store.js +140 -0
- package/dist/esm/adapters/durable-object/index.js +3 -0
- package/dist/esm/adapters/durable-object/session-store.js +139 -0
- package/dist/esm/adapters/durable-object/types.js +0 -0
- package/dist/esm/adapters/dynamo/audit-log.js +23 -0
- package/dist/esm/adapters/dynamo/client.js +0 -0
- package/dist/esm/adapters/dynamo/config-store.js +57 -0
- package/dist/esm/adapters/dynamo/index.js +10 -0
- package/dist/esm/adapters/dynamo/key-store.js +188 -0
- package/dist/esm/adapters/dynamo/method-store.js +72 -0
- package/dist/esm/adapters/dynamo/passkey-credential-store.js +83 -0
- package/dist/esm/adapters/dynamo/sdk.js +128 -0
- package/dist/esm/adapters/dynamo/session-store.js +173 -0
- package/dist/esm/adapters/dynamo/token-store.js +178 -0
- package/dist/esm/adapters/kms/in-memory-backing.js +28 -0
- package/dist/esm/adapters/kms/index.js +5 -0
- package/dist/esm/adapters/kms/key-store.js +129 -0
- package/dist/esm/adapters/kms/sdk.js +23 -0
- package/dist/esm/adapters/kms/types.js +0 -0
- package/dist/esm/adapters/kv/audit-log.js +21 -0
- package/dist/esm/adapters/kv/config-store.js +43 -0
- package/dist/esm/adapters/kv/index.js +5 -0
- package/dist/esm/adapters/kv/method-store.js +63 -0
- package/dist/esm/adapters/kv/types.js +0 -0
- package/dist/esm/adapters/memory/audit-log.js +16 -0
- package/dist/esm/adapters/memory/clock.js +5 -0
- package/dist/esm/adapters/memory/config-store.js +31 -0
- package/dist/esm/adapters/memory/index.js +10 -0
- package/dist/esm/adapters/memory/key-store.js +78 -0
- package/dist/esm/adapters/memory/method-store.js +43 -0
- package/dist/esm/adapters/memory/passkey-credential-store.js +53 -0
- package/dist/esm/adapters/memory/session-store.js +104 -0
- package/dist/esm/adapters/memory/token-store.js +104 -0
- package/dist/esm/adapters/postgres/audit-log.js +16 -0
- package/dist/esm/adapters/postgres/config-store.js +48 -0
- package/dist/esm/adapters/postgres/executor.js +21 -0
- package/dist/esm/adapters/postgres/index.js +13 -0
- package/dist/esm/adapters/postgres/key-store.js +191 -0
- package/dist/esm/adapters/postgres/method-store.js +61 -0
- package/dist/esm/adapters/postgres/migrations.js +111 -0
- package/dist/esm/adapters/postgres/passkey-credential-store.js +80 -0
- package/dist/esm/adapters/postgres/session-store.js +135 -0
- package/dist/esm/adapters/postgres/token-store.js +151 -0
- package/dist/esm/client.js +35 -12
- package/dist/esm/domain/audit.js +13 -0
- package/dist/esm/domain/authorize.js +217 -0
- package/dist/esm/domain/callback.js +176 -0
- package/dist/esm/domain/client-auth.js +61 -0
- package/dist/esm/domain/client-credentials.js +91 -0
- package/dist/esm/domain/crypto.js +97 -0
- package/dist/esm/domain/discovery.js +83 -0
- package/dist/esm/domain/dpop.js +122 -0
- package/dist/esm/domain/id-token.js +94 -0
- package/dist/esm/domain/introspect.js +55 -0
- package/dist/esm/domain/jwt.js +71 -0
- package/dist/esm/domain/logout.js +75 -0
- package/dist/esm/domain/method-cache.js +136 -0
- package/dist/esm/domain/method-dispatch.js +36 -0
- package/dist/esm/domain/method-route.js +111 -0
- package/dist/esm/domain/par.js +51 -0
- package/dist/esm/domain/pkce.js +16 -0
- package/dist/esm/domain/refresh.js +102 -0
- package/dist/esm/domain/register.js +74 -0
- package/dist/esm/domain/revoke.js +81 -0
- package/dist/esm/domain/state-envelope.js +80 -0
- package/dist/esm/domain/token-exchange.js +102 -0
- package/dist/esm/domain/token.js +246 -0
- package/dist/esm/domain/userinfo.js +62 -0
- package/dist/esm/http/context.js +7 -0
- package/dist/esm/http/cookies.js +98 -0
- package/dist/esm/http/errors.js +71 -0
- package/dist/esm/http/handlers/authorize.js +250 -0
- package/dist/esm/http/handlers/callback.js +53 -0
- package/dist/esm/http/handlers/end-session.js +64 -0
- package/dist/esm/http/handlers/metadata.js +37 -0
- package/dist/esm/http/handlers/method-route.js +87 -0
- package/dist/esm/http/handlers/par.js +53 -0
- package/dist/esm/http/handlers/register.js +46 -0
- package/dist/esm/http/handlers/revocation.js +98 -0
- package/dist/esm/http/handlers/token.js +197 -0
- package/dist/esm/http/handlers/userinfo.js +60 -0
- package/dist/esm/http/middleware/error.js +15 -0
- package/dist/esm/http/middleware/tenant.js +102 -0
- package/dist/esm/http/resolver.js +15 -0
- package/dist/esm/http/router.js +45 -0
- package/dist/esm/http/schemas/authorize.js +30 -0
- package/dist/esm/http/schemas/end-session.js +13 -0
- package/dist/esm/http/schemas/par.js +9 -0
- package/dist/esm/http/schemas/register.js +16 -0
- package/dist/esm/http/schemas/revocation.js +18 -0
- package/dist/esm/http/schemas/token.js +57 -0
- package/dist/esm/index.js +126 -9
- package/dist/esm/methods/code.js +221 -0
- package/dist/esm/methods/m2m.js +41 -0
- package/dist/esm/methods/oauth2-factory.js +84 -0
- package/dist/esm/methods/oauth2-generic.js +196 -0
- package/dist/esm/methods/oidc-generic.js +53 -0
- package/dist/esm/methods/passkey.js +275 -0
- package/dist/esm/methods/password-hash.js +79 -0
- package/dist/esm/methods/password.js +166 -0
- package/dist/esm/methods/providers/apple.js +29 -0
- package/dist/esm/methods/providers/cognito.js +37 -0
- package/dist/esm/methods/providers/discord.js +28 -0
- package/dist/esm/methods/providers/facebook.js +42 -0
- package/dist/esm/methods/providers/github.js +29 -0
- package/dist/esm/methods/providers/google.js +29 -0
- package/dist/esm/methods/providers/index.js +17 -0
- package/dist/esm/methods/providers/jumpcloud.js +27 -0
- package/dist/esm/methods/providers/keycloak.js +32 -0
- package/dist/esm/methods/providers/linkedin.js +28 -0
- package/dist/esm/methods/providers/microsoft.js +28 -0
- package/dist/esm/methods/providers/slack.js +30 -0
- package/dist/esm/methods/providers/spotify.js +28 -0
- package/dist/esm/methods/providers/twitch.js +28 -0
- package/dist/esm/methods/providers/x.js +28 -0
- package/dist/esm/methods/providers/yahoo.js +27 -0
- package/dist/esm/pkce.js +4 -16
- package/dist/esm/ports/audit-log.js +0 -0
- package/dist/esm/ports/config-store.js +0 -0
- package/dist/esm/ports/key-store.js +0 -0
- package/dist/esm/ports/method-store.js +0 -0
- package/dist/esm/ports/session-store.js +0 -0
- package/dist/esm/ports/token-store.js +0 -0
- package/dist/esm/types/authorization.js +0 -0
- package/dist/esm/types/error.js +70 -0
- package/dist/esm/types/flow.js +0 -0
- package/dist/esm/types/idp.js +0 -0
- package/dist/esm/types/method.js +0 -0
- package/dist/esm/types/picker.js +0 -0
- package/dist/esm/types/result.js +11 -0
- package/dist/esm/types/subject.js +0 -0
- package/dist/esm/types/tenant.js +5 -0
- package/dist/esm/types/token.js +0 -0
- package/dist/esm/ui/forms.js +253 -0
- package/dist/esm/ui/index.js +8 -0
- package/dist/esm/ui/picker.js +49 -0
- package/dist/types/adapters/d1/audit-log.d.ts +19 -0
- package/dist/types/adapters/d1/audit-log.d.ts.map +1 -0
- package/dist/types/adapters/d1/config-store.d.ts +20 -0
- package/dist/types/adapters/d1/config-store.d.ts.map +1 -0
- package/dist/types/adapters/d1/index.d.ts +35 -0
- package/dist/types/adapters/d1/index.d.ts.map +1 -0
- package/dist/types/adapters/d1/key-store.d.ts +17 -0
- package/dist/types/adapters/d1/key-store.d.ts.map +1 -0
- package/dist/types/adapters/d1/method-store.d.ts +21 -0
- package/dist/types/adapters/d1/method-store.d.ts.map +1 -0
- package/dist/types/adapters/d1/migrations.d.ts +18 -0
- package/dist/types/adapters/d1/migrations.d.ts.map +1 -0
- package/dist/types/adapters/d1/session-store.d.ts +20 -0
- package/dist/types/adapters/d1/session-store.d.ts.map +1 -0
- package/dist/types/adapters/d1/session.d.ts +18 -0
- package/dist/types/adapters/d1/session.d.ts.map +1 -0
- package/dist/types/adapters/d1/token-store.d.ts +29 -0
- package/dist/types/adapters/d1/token-store.d.ts.map +1 -0
- package/dist/types/adapters/d1/types.d.ts +43 -0
- package/dist/types/adapters/d1/types.d.ts.map +1 -0
- package/dist/types/adapters/durable-object/index.d.ts +17 -0
- package/dist/types/adapters/durable-object/index.d.ts.map +1 -0
- package/dist/types/adapters/durable-object/session-store.d.ts +21 -0
- package/dist/types/adapters/durable-object/session-store.d.ts.map +1 -0
- package/dist/types/adapters/durable-object/types.d.ts +23 -0
- package/dist/types/adapters/durable-object/types.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/audit-log.d.ts +19 -0
- package/dist/types/adapters/dynamo/audit-log.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/client.d.ts +111 -0
- package/dist/types/adapters/dynamo/client.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/config-store.d.ts +21 -0
- package/dist/types/adapters/dynamo/config-store.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/index.d.ts +60 -0
- package/dist/types/adapters/dynamo/index.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/key-store.d.ts +23 -0
- package/dist/types/adapters/dynamo/key-store.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/method-store.d.ts +20 -0
- package/dist/types/adapters/dynamo/method-store.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/passkey-credential-store.d.ts +47 -0
- package/dist/types/adapters/dynamo/passkey-credential-store.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/sdk.d.ts +23 -0
- package/dist/types/adapters/dynamo/sdk.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/session-store.d.ts +20 -0
- package/dist/types/adapters/dynamo/session-store.d.ts.map +1 -0
- package/dist/types/adapters/dynamo/token-store.d.ts +29 -0
- package/dist/types/adapters/dynamo/token-store.d.ts.map +1 -0
- package/dist/types/adapters/kms/in-memory-backing.d.ts +9 -0
- package/dist/types/adapters/kms/in-memory-backing.d.ts.map +1 -0
- package/dist/types/adapters/kms/index.d.ts +35 -0
- package/dist/types/adapters/kms/index.d.ts.map +1 -0
- package/dist/types/adapters/kms/key-store.d.ts +20 -0
- package/dist/types/adapters/kms/key-store.d.ts.map +1 -0
- package/dist/types/adapters/kms/sdk.d.ts +16 -0
- package/dist/types/adapters/kms/sdk.d.ts.map +1 -0
- package/dist/types/adapters/kms/types.d.ts +58 -0
- package/dist/types/adapters/kms/types.d.ts.map +1 -0
- package/dist/types/adapters/kv/audit-log.d.ts +22 -0
- package/dist/types/adapters/kv/audit-log.d.ts.map +1 -0
- package/dist/types/adapters/kv/config-store.d.ts +25 -0
- package/dist/types/adapters/kv/config-store.d.ts.map +1 -0
- package/dist/types/adapters/kv/index.d.ts +21 -0
- package/dist/types/adapters/kv/index.d.ts.map +1 -0
- package/dist/types/adapters/kv/method-store.d.ts +23 -0
- package/dist/types/adapters/kv/method-store.d.ts.map +1 -0
- package/dist/types/adapters/kv/types.d.ts +28 -0
- package/dist/types/adapters/kv/types.d.ts.map +1 -0
- package/dist/types/adapters/memory/audit-log.d.ts +18 -0
- package/dist/types/adapters/memory/audit-log.d.ts.map +1 -0
- package/dist/types/adapters/memory/clock.d.ts +7 -0
- package/dist/types/adapters/memory/clock.d.ts.map +1 -0
- package/dist/types/adapters/memory/config-store.d.ts +19 -0
- package/dist/types/adapters/memory/config-store.d.ts.map +1 -0
- package/dist/types/adapters/memory/index.d.ts +15 -0
- package/dist/types/adapters/memory/index.d.ts.map +1 -0
- package/dist/types/adapters/memory/key-store.d.ts +17 -0
- package/dist/types/adapters/memory/key-store.d.ts.map +1 -0
- package/dist/types/adapters/memory/method-store.d.ts +26 -0
- package/dist/types/adapters/memory/method-store.d.ts.map +1 -0
- package/dist/types/adapters/memory/passkey-credential-store.d.ts +43 -0
- package/dist/types/adapters/memory/passkey-credential-store.d.ts.map +1 -0
- package/dist/types/adapters/memory/session-store.d.ts +21 -0
- package/dist/types/adapters/memory/session-store.d.ts.map +1 -0
- package/dist/types/adapters/memory/token-store.d.ts +29 -0
- package/dist/types/adapters/memory/token-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/audit-log.d.ts +18 -0
- package/dist/types/adapters/postgres/audit-log.d.ts.map +1 -0
- package/dist/types/adapters/postgres/config-store.d.ts +21 -0
- package/dist/types/adapters/postgres/config-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/executor.d.ts +48 -0
- package/dist/types/adapters/postgres/executor.d.ts.map +1 -0
- package/dist/types/adapters/postgres/index.d.ts +39 -0
- package/dist/types/adapters/postgres/index.d.ts.map +1 -0
- package/dist/types/adapters/postgres/key-store.d.ts +23 -0
- package/dist/types/adapters/postgres/key-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/method-store.d.ts +21 -0
- package/dist/types/adapters/postgres/method-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/migrations.d.ts +22 -0
- package/dist/types/adapters/postgres/migrations.d.ts.map +1 -0
- package/dist/types/adapters/postgres/passkey-credential-store.d.ts +48 -0
- package/dist/types/adapters/postgres/passkey-credential-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/session-store.d.ts +20 -0
- package/dist/types/adapters/postgres/session-store.d.ts.map +1 -0
- package/dist/types/adapters/postgres/token-store.d.ts +30 -0
- package/dist/types/adapters/postgres/token-store.d.ts.map +1 -0
- package/dist/types/client.d.ts +20 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/domain/audit.d.ts +17 -0
- package/dist/types/domain/audit.d.ts.map +1 -0
- package/dist/types/domain/authorize.d.ts +125 -0
- package/dist/types/domain/authorize.d.ts.map +1 -0
- package/dist/types/domain/callback.d.ts +70 -0
- package/dist/types/domain/callback.d.ts.map +1 -0
- package/dist/types/domain/client-auth.d.ts +57 -0
- package/dist/types/domain/client-auth.d.ts.map +1 -0
- package/dist/types/domain/client-credentials.d.ts +54 -0
- package/dist/types/domain/client-credentials.d.ts.map +1 -0
- package/dist/types/domain/crypto.d.ts +53 -0
- package/dist/types/domain/crypto.d.ts.map +1 -0
- package/dist/types/domain/discovery.d.ts +81 -0
- package/dist/types/domain/discovery.d.ts.map +1 -0
- package/dist/types/domain/dpop.d.ts +61 -0
- package/dist/types/domain/dpop.d.ts.map +1 -0
- package/dist/types/domain/id-token.d.ts +83 -0
- package/dist/types/domain/id-token.d.ts.map +1 -0
- package/dist/types/domain/introspect.d.ts +79 -0
- package/dist/types/domain/introspect.d.ts.map +1 -0
- package/dist/types/domain/jwt.d.ts +74 -0
- package/dist/types/domain/jwt.d.ts.map +1 -0
- package/dist/types/domain/logout.d.ts +69 -0
- package/dist/types/domain/logout.d.ts.map +1 -0
- package/dist/types/domain/method-cache.d.ts +42 -0
- package/dist/types/domain/method-cache.d.ts.map +1 -0
- package/dist/types/domain/method-dispatch.d.ts +37 -0
- package/dist/types/domain/method-dispatch.d.ts.map +1 -0
- package/dist/types/domain/method-route.d.ts +77 -0
- package/dist/types/domain/method-route.d.ts.map +1 -0
- package/dist/types/domain/par.d.ts +62 -0
- package/dist/types/domain/par.d.ts.map +1 -0
- package/dist/types/domain/pkce.d.ts +15 -0
- package/dist/types/domain/pkce.d.ts.map +1 -0
- package/dist/types/domain/refresh.d.ts +52 -0
- package/dist/types/domain/refresh.d.ts.map +1 -0
- package/dist/types/domain/register.d.ts +33 -0
- package/dist/types/domain/register.d.ts.map +1 -0
- package/dist/types/domain/revoke.d.ts +61 -0
- package/dist/types/domain/revoke.d.ts.map +1 -0
- package/dist/types/domain/state-envelope.d.ts +30 -0
- package/dist/types/domain/state-envelope.d.ts.map +1 -0
- package/dist/types/domain/token-exchange.d.ts +69 -0
- package/dist/types/domain/token-exchange.d.ts.map +1 -0
- package/dist/types/domain/token.d.ts +140 -0
- package/dist/types/domain/token.d.ts.map +1 -0
- package/dist/types/domain/userinfo.d.ts +61 -0
- package/dist/types/domain/userinfo.d.ts.map +1 -0
- package/dist/types/http/context.d.ts +66 -0
- package/dist/types/http/context.d.ts.map +1 -0
- package/dist/types/http/cookies.d.ts +45 -0
- package/dist/types/http/cookies.d.ts.map +1 -0
- package/dist/types/http/errors.d.ts +36 -0
- package/dist/types/http/errors.d.ts.map +1 -0
- package/dist/types/http/handlers/authorize.d.ts +3 -0
- package/dist/types/http/handlers/authorize.d.ts.map +1 -0
- package/dist/types/http/handlers/callback.d.ts +3 -0
- package/dist/types/http/handlers/callback.d.ts.map +1 -0
- package/dist/types/http/handlers/end-session.d.ts +3 -0
- package/dist/types/http/handlers/end-session.d.ts.map +1 -0
- package/dist/types/http/handlers/metadata.d.ts +4 -0
- package/dist/types/http/handlers/metadata.d.ts.map +1 -0
- package/dist/types/http/handlers/method-route.d.ts +3 -0
- package/dist/types/http/handlers/method-route.d.ts.map +1 -0
- package/dist/types/http/handlers/par.d.ts +3 -0
- package/dist/types/http/handlers/par.d.ts.map +1 -0
- package/dist/types/http/handlers/register.d.ts +3 -0
- package/dist/types/http/handlers/register.d.ts.map +1 -0
- package/dist/types/http/handlers/revocation.d.ts +4 -0
- package/dist/types/http/handlers/revocation.d.ts.map +1 -0
- package/dist/types/http/handlers/token.d.ts +3 -0
- package/dist/types/http/handlers/token.d.ts.map +1 -0
- package/dist/types/http/handlers/userinfo.d.ts +3 -0
- package/dist/types/http/handlers/userinfo.d.ts.map +1 -0
- package/dist/types/http/middleware/error.d.ts +9 -0
- package/dist/types/http/middleware/error.d.ts.map +1 -0
- package/dist/types/http/middleware/tenant.d.ts +30 -0
- package/dist/types/http/middleware/tenant.d.ts.map +1 -0
- package/dist/types/http/resolver.d.ts +22 -0
- package/dist/types/http/resolver.d.ts.map +1 -0
- package/dist/types/http/router.d.ts +21 -0
- package/dist/types/http/router.d.ts.map +1 -0
- package/dist/types/http/schemas/authorize.d.ts +92 -0
- package/dist/types/http/schemas/authorize.d.ts.map +1 -0
- package/dist/types/http/schemas/end-session.d.ts +31 -0
- package/dist/types/http/schemas/end-session.d.ts.map +1 -0
- package/dist/types/http/schemas/par.d.ts +20 -0
- package/dist/types/http/schemas/par.d.ts.map +1 -0
- package/dist/types/http/schemas/register.d.ts +42 -0
- package/dist/types/http/schemas/register.d.ts.map +1 -0
- package/dist/types/http/schemas/revocation.d.ts +41 -0
- package/dist/types/http/schemas/revocation.d.ts.map +1 -0
- package/dist/types/http/schemas/token.d.ts +227 -0
- package/dist/types/http/schemas/token.d.ts.map +1 -0
- package/dist/types/index.d.ts +63 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/methods/code.d.ts +96 -0
- package/dist/types/methods/code.d.ts.map +1 -0
- package/dist/types/methods/m2m.d.ts +41 -0
- package/dist/types/methods/m2m.d.ts.map +1 -0
- package/dist/types/methods/oauth2-factory.d.ts +133 -0
- package/dist/types/methods/oauth2-factory.d.ts.map +1 -0
- package/dist/types/methods/oauth2-generic.d.ts +75 -0
- package/dist/types/methods/oauth2-generic.d.ts.map +1 -0
- package/dist/types/methods/oidc-generic.d.ts +26 -0
- package/dist/types/methods/oidc-generic.d.ts.map +1 -0
- package/dist/types/methods/passkey.d.ts +106 -0
- package/dist/types/methods/passkey.d.ts.map +1 -0
- package/dist/types/methods/password-hash.d.ts +25 -0
- package/dist/types/methods/password-hash.d.ts.map +1 -0
- package/dist/types/methods/password.d.ts +70 -0
- package/dist/types/methods/password.d.ts.map +1 -0
- package/dist/types/methods/providers/apple.d.ts +29 -0
- package/dist/types/methods/providers/apple.d.ts.map +1 -0
- package/dist/types/methods/providers/cognito.d.ts +36 -0
- package/dist/types/methods/providers/cognito.d.ts.map +1 -0
- package/dist/types/methods/providers/discord.d.ts +22 -0
- package/dist/types/methods/providers/discord.d.ts.map +1 -0
- package/dist/types/methods/providers/facebook.d.ts +29 -0
- package/dist/types/methods/providers/facebook.d.ts.map +1 -0
- package/dist/types/methods/providers/github.d.ts +25 -0
- package/dist/types/methods/providers/github.d.ts.map +1 -0
- package/dist/types/methods/providers/google.d.ts +28 -0
- package/dist/types/methods/providers/google.d.ts.map +1 -0
- package/dist/types/methods/providers/index.d.ts +24 -0
- package/dist/types/methods/providers/index.d.ts.map +1 -0
- package/dist/types/methods/providers/jumpcloud.d.ts +22 -0
- package/dist/types/methods/providers/jumpcloud.d.ts.map +1 -0
- package/dist/types/methods/providers/keycloak.d.ts +30 -0
- package/dist/types/methods/providers/keycloak.d.ts.map +1 -0
- package/dist/types/methods/providers/linkedin.d.ts +22 -0
- package/dist/types/methods/providers/linkedin.d.ts.map +1 -0
- package/dist/types/methods/providers/microsoft.d.ts +30 -0
- package/dist/types/methods/providers/microsoft.d.ts.map +1 -0
- package/dist/types/methods/providers/slack.d.ts +25 -0
- package/dist/types/methods/providers/slack.d.ts.map +1 -0
- package/dist/types/methods/providers/spotify.d.ts +22 -0
- package/dist/types/methods/providers/spotify.d.ts.map +1 -0
- package/dist/types/methods/providers/twitch.d.ts +23 -0
- package/dist/types/methods/providers/twitch.d.ts.map +1 -0
- package/dist/types/methods/providers/x.d.ts +25 -0
- package/dist/types/methods/providers/x.d.ts.map +1 -0
- package/dist/types/methods/providers/yahoo.d.ts +22 -0
- package/dist/types/methods/providers/yahoo.d.ts.map +1 -0
- package/dist/types/pkce.d.ts +1 -2
- package/dist/types/pkce.d.ts.map +1 -1
- package/dist/types/ports/audit-log.d.ts +166 -0
- package/dist/types/ports/audit-log.d.ts.map +1 -0
- package/dist/types/ports/config-store.d.ts +32 -0
- package/dist/types/ports/config-store.d.ts.map +1 -0
- package/dist/types/ports/key-store.d.ts +98 -0
- package/dist/types/ports/key-store.d.ts.map +1 -0
- package/dist/types/ports/method-store.d.ts +29 -0
- package/dist/types/ports/method-store.d.ts.map +1 -0
- package/dist/types/ports/session-store.d.ts +109 -0
- package/dist/types/ports/session-store.d.ts.map +1 -0
- package/dist/types/ports/token-store.d.ts +105 -0
- package/dist/types/ports/token-store.d.ts.map +1 -0
- package/dist/types/types/authorization.d.ts +75 -0
- package/dist/types/types/authorization.d.ts.map +1 -0
- package/dist/types/types/error.d.ts +101 -0
- package/dist/types/types/error.d.ts.map +1 -0
- package/dist/types/types/flow.d.ts +97 -0
- package/dist/types/types/flow.d.ts.map +1 -0
- package/dist/types/types/idp.d.ts +324 -0
- package/dist/types/types/idp.d.ts.map +1 -0
- package/dist/types/types/method.d.ts +256 -0
- package/dist/types/types/method.d.ts.map +1 -0
- package/dist/types/types/picker.d.ts +31 -0
- package/dist/types/types/picker.d.ts.map +1 -0
- package/dist/types/types/result.d.ts +29 -0
- package/dist/types/types/result.d.ts.map +1 -0
- package/dist/types/types/subject.d.ts +47 -0
- package/dist/types/types/subject.d.ts.map +1 -0
- package/dist/types/types/tenant.d.ts +276 -0
- package/dist/types/types/tenant.d.ts.map +1 -0
- package/dist/types/types/token.d.ts +231 -0
- package/dist/types/types/token.d.ts.map +1 -0
- package/dist/types/ui/forms.d.ts +35 -0
- package/dist/types/ui/forms.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +14 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/picker.d.ts +18 -0
- package/dist/types/ui/picker.d.ts.map +1 -0
- package/package.json +41 -6
- package/src/adapters/d1/audit-log.ts +32 -0
- package/src/adapters/d1/config-store.ts +67 -0
- package/src/adapters/d1/index.ts +41 -0
- package/src/adapters/d1/key-store.ts +218 -0
- package/src/adapters/d1/method-store.ts +103 -0
- package/src/adapters/d1/migrations.ts +89 -0
- package/src/adapters/d1/session-store.ts +230 -0
- package/src/adapters/d1/session.ts +38 -0
- package/src/adapters/d1/token-store.ts +251 -0
- package/src/adapters/d1/types.ts +53 -0
- package/src/adapters/durable-object/index.ts +23 -0
- package/src/adapters/durable-object/session-store.ts +227 -0
- package/src/adapters/durable-object/types.ts +25 -0
- package/src/adapters/dynamo/audit-log.ts +35 -0
- package/src/adapters/dynamo/client.ts +118 -0
- package/src/adapters/dynamo/config-store.ts +72 -0
- package/src/adapters/dynamo/index.ts +81 -0
- package/src/adapters/dynamo/key-store.ts +267 -0
- package/src/adapters/dynamo/method-store.ts +105 -0
- package/src/adapters/dynamo/passkey-credential-store.ts +132 -0
- package/src/adapters/dynamo/sdk.ts +189 -0
- package/src/adapters/dynamo/session-store.ts +229 -0
- package/src/adapters/dynamo/token-store.ts +248 -0
- package/src/adapters/kms/in-memory-backing.ts +36 -0
- package/src/adapters/kms/index.ts +39 -0
- package/src/adapters/kms/key-store.ts +176 -0
- package/src/adapters/kms/sdk.ts +39 -0
- package/src/adapters/kms/types.ts +61 -0
- package/src/adapters/kv/audit-log.ts +40 -0
- package/src/adapters/kv/config-store.ts +63 -0
- package/src/adapters/kv/index.ts +20 -0
- package/src/adapters/kv/method-store.ts +98 -0
- package/src/adapters/kv/types.ts +26 -0
- package/src/adapters/memory/audit-log.ts +28 -0
- package/src/adapters/memory/clock.ts +7 -0
- package/src/adapters/memory/config-store.ts +41 -0
- package/src/adapters/memory/index.ts +26 -0
- package/src/adapters/memory/key-store.ts +102 -0
- package/src/adapters/memory/method-store.ts +75 -0
- package/src/adapters/memory/passkey-credential-store.ts +97 -0
- package/src/adapters/memory/session-store.ts +171 -0
- package/src/adapters/memory/token-store.ts +181 -0
- package/src/adapters/postgres/audit-log.ts +34 -0
- package/src/adapters/postgres/config-store.ts +72 -0
- package/src/adapters/postgres/executor.ts +76 -0
- package/src/adapters/postgres/index.ts +60 -0
- package/src/adapters/postgres/key-store.ts +334 -0
- package/src/adapters/postgres/method-store.ts +104 -0
- package/src/adapters/postgres/migrations.ts +131 -0
- package/src/adapters/postgres/passkey-credential-store.ts +150 -0
- package/src/adapters/postgres/session-store.ts +216 -0
- package/src/adapters/postgres/token-store.ts +263 -0
- package/src/client.ts +82 -16
- package/src/domain/audit.ts +28 -0
- package/src/domain/authorize.ts +414 -0
- package/src/domain/callback.ts +268 -0
- package/src/domain/client-auth.ts +116 -0
- package/src/domain/client-credentials.ts +180 -0
- package/src/domain/crypto.ts +168 -0
- package/src/domain/discovery.ts +161 -0
- package/src/domain/dpop.ts +293 -0
- package/src/domain/id-token.ts +213 -0
- package/src/domain/introspect.ts +155 -0
- package/src/domain/jwt.ts +185 -0
- package/src/domain/logout.ts +180 -0
- package/src/domain/method-cache.ts +220 -0
- package/src/domain/method-dispatch.ts +95 -0
- package/src/domain/method-route.ts +213 -0
- package/src/domain/par.ts +141 -0
- package/src/domain/pkce.ts +37 -0
- package/src/domain/refresh.ts +210 -0
- package/src/domain/register.ts +168 -0
- package/src/domain/revoke.ts +161 -0
- package/src/domain/state-envelope.ts +142 -0
- package/src/domain/token-exchange.ts +243 -0
- package/src/domain/token.ts +483 -0
- package/src/domain/userinfo.ts +171 -0
- package/src/http/context.ts +90 -0
- package/src/http/cookies.ts +167 -0
- package/src/http/errors.ts +98 -0
- package/src/http/handlers/authorize.ts +362 -0
- package/src/http/handlers/callback.ts +77 -0
- package/src/http/handlers/end-session.ts +106 -0
- package/src/http/handlers/metadata.ts +49 -0
- package/src/http/handlers/method-route.ts +115 -0
- package/src/http/handlers/par.ts +84 -0
- package/src/http/handlers/register.ts +70 -0
- package/src/http/handlers/revocation.ts +151 -0
- package/src/http/handlers/token.ts +300 -0
- package/src/http/handlers/userinfo.ts +90 -0
- package/src/http/middleware/error.ts +26 -0
- package/src/http/middleware/tenant.ts +165 -0
- package/src/http/resolver.ts +34 -0
- package/src/http/router.ts +85 -0
- package/src/http/schemas/authorize.ts +85 -0
- package/src/http/schemas/end-session.ts +23 -0
- package/src/http/schemas/par.ts +23 -0
- package/src/http/schemas/register.ts +29 -0
- package/src/http/schemas/revocation.ts +23 -0
- package/src/http/schemas/token.ts +85 -0
- package/src/index.ts +283 -20
- package/src/methods/code.ts +359 -0
- package/src/methods/m2m.ts +82 -0
- package/src/methods/oauth2-factory.ts +151 -0
- package/src/methods/oauth2-generic.ts +360 -0
- package/src/methods/oidc-generic.ts +109 -0
- package/src/methods/passkey.ts +419 -0
- package/src/methods/password-hash.ts +134 -0
- package/src/methods/password.ts +298 -0
- package/src/methods/providers/apple.ts +42 -0
- package/src/methods/providers/cognito.ts +55 -0
- package/src/methods/providers/discord.ts +37 -0
- package/src/methods/providers/facebook.ts +54 -0
- package/src/methods/providers/github.ts +42 -0
- package/src/methods/providers/google.ts +43 -0
- package/src/methods/providers/index.ts +23 -0
- package/src/methods/providers/jumpcloud.ts +36 -0
- package/src/methods/providers/keycloak.ts +42 -0
- package/src/methods/providers/linkedin.ts +37 -0
- package/src/methods/providers/microsoft.ts +42 -0
- package/src/methods/providers/slack.ts +42 -0
- package/src/methods/providers/spotify.ts +37 -0
- package/src/methods/providers/twitch.ts +38 -0
- package/src/methods/providers/x.ts +40 -0
- package/src/methods/providers/yahoo.ts +36 -0
- package/src/pkce.ts +20 -21
- package/src/ports/CONSISTENCY.md +119 -0
- package/src/ports/audit-log.ts +177 -0
- package/src/ports/config-store.ts +34 -0
- package/src/ports/key-store.ts +106 -0
- package/src/ports/method-store.ts +41 -0
- package/src/ports/session-store.ts +131 -0
- package/src/ports/token-store.ts +116 -0
- package/src/types/authorization.ts +78 -0
- package/src/types/error.ts +146 -0
- package/src/types/flow.ts +99 -0
- package/src/types/idp.ts +365 -0
- package/src/types/method.ts +270 -0
- package/src/types/picker.ts +32 -0
- package/src/types/result.ts +23 -0
- package/src/types/subject.ts +50 -0
- package/src/types/tenant.ts +285 -0
- package/src/types/token.ts +236 -0
- package/src/ui/forms.ts +289 -0
- package/src/ui/index.ts +14 -0
- package/src/ui/picker.ts +63 -0
- package/dist/esm/issuer.js +0 -691
- package/dist/esm/jwt.js +0 -16
- package/dist/esm/keys.js +0 -113
- package/dist/esm/provider/apple.js +0 -28
- package/dist/esm/provider/arctic.js +0 -43
- package/dist/esm/provider/code.js +0 -58
- package/dist/esm/provider/cognito.js +0 -16
- package/dist/esm/provider/discord.js +0 -15
- package/dist/esm/provider/facebook.js +0 -24
- package/dist/esm/provider/github.js +0 -15
- package/dist/esm/provider/google.js +0 -25
- package/dist/esm/provider/index.js +0 -3
- package/dist/esm/provider/jumpcloud.js +0 -15
- package/dist/esm/provider/keycloak.js +0 -15
- package/dist/esm/provider/linkedin.js +0 -15
- package/dist/esm/provider/m2m.js +0 -16
- package/dist/esm/provider/microsoft.js +0 -24
- package/dist/esm/provider/oauth2.js +0 -119
- package/dist/esm/provider/oidc.js +0 -69
- package/dist/esm/provider/passkey.js +0 -315
- package/dist/esm/provider/password.js +0 -306
- package/dist/esm/provider/provider.js +0 -10
- package/dist/esm/provider/slack.js +0 -15
- package/dist/esm/provider/spotify.js +0 -15
- package/dist/esm/provider/twitch.js +0 -15
- package/dist/esm/provider/x.js +0 -16
- package/dist/esm/provider/yahoo.js +0 -15
- package/dist/esm/random.js +0 -27
- package/dist/esm/storage/aws.js +0 -39
- package/dist/esm/storage/cloudflare.js +0 -42
- package/dist/esm/storage/dynamo.js +0 -116
- package/dist/esm/storage/memory.js +0 -88
- package/dist/esm/storage/storage.js +0 -36
- package/dist/esm/subject.js +0 -7
- package/dist/esm/ui/base.js +0 -407
- package/dist/esm/ui/code.js +0 -151
- package/dist/esm/ui/form.js +0 -43
- package/dist/esm/ui/icon.js +0 -92
- package/dist/esm/ui/passkey.js +0 -329
- package/dist/esm/ui/password.js +0 -338
- package/dist/esm/ui/select.js +0 -187
- package/dist/esm/ui/theme.js +0 -115
- package/dist/esm/util.js +0 -54
- package/dist/types/issuer.d.ts +0 -607
- package/dist/types/issuer.d.ts.map +0 -1
- package/dist/types/jwt.d.ts +0 -6
- package/dist/types/jwt.d.ts.map +0 -1
- package/dist/types/keys.d.ts +0 -18
- package/dist/types/keys.d.ts.map +0 -1
- package/dist/types/provider/apple.d.ts +0 -108
- package/dist/types/provider/apple.d.ts.map +0 -1
- package/dist/types/provider/arctic.d.ts +0 -16
- package/dist/types/provider/arctic.d.ts.map +0 -1
- package/dist/types/provider/code.d.ts +0 -74
- package/dist/types/provider/code.d.ts.map +0 -1
- package/dist/types/provider/cognito.d.ts +0 -64
- package/dist/types/provider/cognito.d.ts.map +0 -1
- package/dist/types/provider/discord.d.ts +0 -38
- package/dist/types/provider/discord.d.ts.map +0 -1
- package/dist/types/provider/facebook.d.ts +0 -74
- package/dist/types/provider/facebook.d.ts.map +0 -1
- package/dist/types/provider/github.d.ts +0 -38
- package/dist/types/provider/github.d.ts.map +0 -1
- package/dist/types/provider/google.d.ts +0 -74
- package/dist/types/provider/google.d.ts.map +0 -1
- package/dist/types/provider/index.d.ts +0 -4
- package/dist/types/provider/index.d.ts.map +0 -1
- package/dist/types/provider/jumpcloud.d.ts +0 -38
- package/dist/types/provider/jumpcloud.d.ts.map +0 -1
- package/dist/types/provider/keycloak.d.ts +0 -67
- package/dist/types/provider/keycloak.d.ts.map +0 -1
- package/dist/types/provider/linkedin.d.ts +0 -6
- package/dist/types/provider/linkedin.d.ts.map +0 -1
- package/dist/types/provider/m2m.d.ts +0 -34
- package/dist/types/provider/m2m.d.ts.map +0 -1
- package/dist/types/provider/microsoft.d.ts +0 -89
- package/dist/types/provider/microsoft.d.ts.map +0 -1
- package/dist/types/provider/oauth2.d.ts +0 -133
- package/dist/types/provider/oauth2.d.ts.map +0 -1
- package/dist/types/provider/oidc.d.ts +0 -91
- package/dist/types/provider/oidc.d.ts.map +0 -1
- package/dist/types/provider/passkey.d.ts +0 -143
- package/dist/types/provider/passkey.d.ts.map +0 -1
- package/dist/types/provider/password.d.ts +0 -210
- package/dist/types/provider/password.d.ts.map +0 -1
- package/dist/types/provider/provider.d.ts +0 -29
- package/dist/types/provider/provider.d.ts.map +0 -1
- package/dist/types/provider/slack.d.ts +0 -59
- package/dist/types/provider/slack.d.ts.map +0 -1
- package/dist/types/provider/spotify.d.ts +0 -38
- package/dist/types/provider/spotify.d.ts.map +0 -1
- package/dist/types/provider/twitch.d.ts +0 -38
- package/dist/types/provider/twitch.d.ts.map +0 -1
- package/dist/types/provider/x.d.ts +0 -38
- package/dist/types/provider/x.d.ts.map +0 -1
- package/dist/types/provider/yahoo.d.ts +0 -38
- package/dist/types/provider/yahoo.d.ts.map +0 -1
- package/dist/types/random.d.ts +0 -3
- package/dist/types/random.d.ts.map +0 -1
- package/dist/types/storage/aws.d.ts +0 -4
- package/dist/types/storage/aws.d.ts.map +0 -1
- package/dist/types/storage/cloudflare.d.ts +0 -34
- package/dist/types/storage/cloudflare.d.ts.map +0 -1
- package/dist/types/storage/dynamo.d.ts +0 -65
- package/dist/types/storage/dynamo.d.ts.map +0 -1
- package/dist/types/storage/memory.d.ts +0 -49
- package/dist/types/storage/memory.d.ts.map +0 -1
- package/dist/types/storage/storage.d.ts +0 -15
- package/dist/types/storage/storage.d.ts.map +0 -1
- package/dist/types/subject.d.ts +0 -122
- package/dist/types/subject.d.ts.map +0 -1
- package/dist/types/ui/base.d.ts +0 -5
- package/dist/types/ui/base.d.ts.map +0 -1
- package/dist/types/ui/code.d.ts +0 -104
- package/dist/types/ui/code.d.ts.map +0 -1
- package/dist/types/ui/form.d.ts +0 -6
- package/dist/types/ui/form.d.ts.map +0 -1
- package/dist/types/ui/icon.d.ts +0 -6
- package/dist/types/ui/icon.d.ts.map +0 -1
- package/dist/types/ui/passkey.d.ts +0 -5
- package/dist/types/ui/passkey.d.ts.map +0 -1
- package/dist/types/ui/password.d.ts +0 -139
- package/dist/types/ui/password.d.ts.map +0 -1
- package/dist/types/ui/select.d.ts +0 -55
- package/dist/types/ui/select.d.ts.map +0 -1
- package/dist/types/ui/theme.d.ts +0 -207
- package/dist/types/ui/theme.d.ts.map +0 -1
- package/dist/types/util.d.ts +0 -8
- package/dist/types/util.d.ts.map +0 -1
- package/src/css.d.ts +0 -4
- package/src/issuer.ts +0 -1628
- package/src/jwt.ts +0 -17
- package/src/keys.ts +0 -139
- package/src/provider/apple.ts +0 -127
- package/src/provider/arctic.ts +0 -66
- package/src/provider/code.ts +0 -227
- package/src/provider/cognito.ts +0 -74
- package/src/provider/discord.ts +0 -45
- package/src/provider/facebook.ts +0 -84
- package/src/provider/github.ts +0 -45
- package/src/provider/google.ts +0 -85
- package/src/provider/index.ts +0 -3
- package/src/provider/jumpcloud.ts +0 -45
- package/src/provider/keycloak.ts +0 -75
- package/src/provider/linkedin.ts +0 -12
- package/src/provider/m2m.ts +0 -56
- package/src/provider/microsoft.ts +0 -100
- package/src/provider/oauth2.ts +0 -297
- package/src/provider/oidc.ts +0 -179
- package/src/provider/passkey.ts +0 -655
- package/src/provider/password.ts +0 -672
- package/src/provider/provider.ts +0 -33
- package/src/provider/slack.ts +0 -67
- package/src/provider/spotify.ts +0 -45
- package/src/provider/twitch.ts +0 -45
- package/src/provider/x.ts +0 -46
- package/src/provider/yahoo.ts +0 -45
- package/src/random.ts +0 -24
- package/src/storage/aws.ts +0 -59
- package/src/storage/cloudflare.ts +0 -77
- package/src/storage/dynamo.ts +0 -193
- package/src/storage/memory.ts +0 -135
- package/src/storage/storage.ts +0 -46
- package/src/subject.ts +0 -130
- package/src/ui/base.tsx +0 -118
- package/src/ui/code.tsx +0 -215
- package/src/ui/form.tsx +0 -40
- package/src/ui/icon.tsx +0 -95
- package/src/ui/passkey.tsx +0 -321
- package/src/ui/password.tsx +0 -405
- package/src/ui/select.tsx +0 -221
- package/src/ui/theme.ts +0 -319
- package/src/ui/ui.css +0 -252
- package/src/util.ts +0 -58
- /package/dist/esm/{css.d.js → adapters/d1/types.js} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `FlowRecord` — the single server-side source of truth for an in-flight
|
|
3
|
+
* authorization. Persisted in `SessionStore` between `/authorize` and the
|
|
4
|
+
* upstream provider's callback.
|
|
5
|
+
*
|
|
6
|
+
* The `state` envelope round-tripped through the upstream provider carries
|
|
7
|
+
* **only** `{ tenantId, flowId, nonce, kid }`. Sensitive data
|
|
8
|
+
* (`clientPkce`, `appRedirectUri`, scopes, audience, etc.) lives here and
|
|
9
|
+
* here only.
|
|
10
|
+
*
|
|
11
|
+
* Lifecycle:
|
|
12
|
+
* 1. Create — at `/authorize`, after schema validation + tenant resolve.
|
|
13
|
+
* 2. Update — when a method handler returns `{ kind: "challenge",
|
|
14
|
+
* saveMethodState }`, the framework merges `saveMethodState` into
|
|
15
|
+
* `methodState` and persists **before** sending the upstream redirect
|
|
16
|
+
* response.
|
|
17
|
+
* 3. Consume — on callback, atomically (`consumeFlow`) — single delete-on-read.
|
|
18
|
+
* 4. Snapshot + dispose — on `success`, the framework snapshots the fields
|
|
19
|
+
* needed at `/token` into the auth-code payload; `methodState` is
|
|
20
|
+
* dropped.
|
|
21
|
+
*/
|
|
22
|
+
import type { ClaimsRequest } from "./authorization"
|
|
23
|
+
import type { TenantId } from "./tenant"
|
|
24
|
+
|
|
25
|
+
export type FlowRecord = {
|
|
26
|
+
flowId: string
|
|
27
|
+
tenantId: TenantId
|
|
28
|
+
|
|
29
|
+
/** Tenant-local instance id (`MethodConfig.id`), e.g. `"google-workspace"`. */
|
|
30
|
+
methodId: string
|
|
31
|
+
/** Factory kind (`MethodConfig.kind`), e.g. `"google"`. */
|
|
32
|
+
methodKind: string
|
|
33
|
+
|
|
34
|
+
/** Relying party's registered client id. */
|
|
35
|
+
clientId: string
|
|
36
|
+
/** Final redirect to the relying party. */
|
|
37
|
+
appRedirectUri: string
|
|
38
|
+
/** Full expected request pathname for this specific flow on callback. */
|
|
39
|
+
callbackPath: string
|
|
40
|
+
/** Expected request host on callback. */
|
|
41
|
+
callbackHost: string
|
|
42
|
+
/** Relying party's `state` param, echoed back at success. */
|
|
43
|
+
appState: string | null
|
|
44
|
+
/** Scopes requested at `/authorize`. */
|
|
45
|
+
scopes: string[]
|
|
46
|
+
/**
|
|
47
|
+
* OAuth 2.1 — `code` only. Implicit (`response_type=token`) is removed; see
|
|
48
|
+
* plan §"OAuth 2.1 — `code` only".
|
|
49
|
+
*/
|
|
50
|
+
responseType: "code"
|
|
51
|
+
audience?: string
|
|
52
|
+
/** Standard OIDC prompt values (`none`, `login`, `consent`, …). */
|
|
53
|
+
prompt?: string[]
|
|
54
|
+
uiLocales?: string[]
|
|
55
|
+
/**
|
|
56
|
+
* Per-flow CSRF nonce stamped into the `state` envelope. Distinct from
|
|
57
|
+
* `appState`. Compared at callback against the consumed record.
|
|
58
|
+
*/
|
|
59
|
+
nonce: string
|
|
60
|
+
/**
|
|
61
|
+
* Relying party's OIDC `nonce` parameter (OIDC Core §3.1.2.1). Distinct
|
|
62
|
+
* from `nonce` (which is the framework's CSRF nonce for state-MAC
|
|
63
|
+
* binding). When present, must be echoed in the issued `id_token`
|
|
64
|
+
* (OIDC Core §2). Snapshotted into `CodePayload.appNonce` at success.
|
|
65
|
+
*/
|
|
66
|
+
appNonce?: string
|
|
67
|
+
/** OIDC Core §5.5 — RP-requested claims, parsed at `/authorize`. */
|
|
68
|
+
claimsRequest?: ClaimsRequest
|
|
69
|
+
/**
|
|
70
|
+
* Relying-party → IdP PKCE. The RP generates the verifier and sends the
|
|
71
|
+
* challenge to `/authorize`. Verified at `/token`.
|
|
72
|
+
* Required for public clients.
|
|
73
|
+
*/
|
|
74
|
+
clientPkce?: { challenge: string; method: "S256" }
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Method-private state — opaque to the framework, typed via the
|
|
78
|
+
* `AuthMethod<P, S>` generic on the owning method. Examples:
|
|
79
|
+
* - OAuth provider: `{ upstreamPkceVerifier, upstreamState }`
|
|
80
|
+
* - OIDC provider: `{ upstreamPkceVerifier, upstreamNonce }`
|
|
81
|
+
* - Passkey: `{ challenge, allowedCredentialIds }`
|
|
82
|
+
* - Password: typically `null` (no upstream callback)
|
|
83
|
+
*
|
|
84
|
+
* Methods do not write this directly; they request a merge via
|
|
85
|
+
* `MethodResult.challenge.saveMethodState`.
|
|
86
|
+
*/
|
|
87
|
+
methodState?: unknown
|
|
88
|
+
|
|
89
|
+
/** User's `requestContext` snapshot, if any. */
|
|
90
|
+
context?: Record<string, unknown>
|
|
91
|
+
|
|
92
|
+
createdAt: number
|
|
93
|
+
/**
|
|
94
|
+
* Pre-callback lifetime — covers upstream login, MFA, consent, mobile app
|
|
95
|
+
* switching, etc. Default 10 minutes. Distinct from the auth-code TTL
|
|
96
|
+
* (60 s) which covers the post-callback span.
|
|
97
|
+
*/
|
|
98
|
+
expiresAt: number
|
|
99
|
+
}
|
package/src/types/idp.ts
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public-surface types for `createIdP` — the user-facing options object,
|
|
3
|
+
* the returned handle, the `success` callback contract, and observation
|
|
4
|
+
* hook event shapes.
|
|
5
|
+
*/
|
|
6
|
+
import type { AuditLog } from "../ports/audit-log"
|
|
7
|
+
import type { ConfigStore } from "../ports/config-store"
|
|
8
|
+
import type { KeyStore } from "../ports/key-store"
|
|
9
|
+
import type { MethodStore } from "../ports/method-store"
|
|
10
|
+
import type { SessionStore } from "../ports/session-store"
|
|
11
|
+
import type { TokenStore } from "../ports/token-store"
|
|
12
|
+
|
|
13
|
+
import type { AuthError } from "./error"
|
|
14
|
+
import type { AnyAuthMethodFactory } from "./method"
|
|
15
|
+
import type { Result } from "./result"
|
|
16
|
+
import type { SubjectClaim, SubjectSchema } from "./subject"
|
|
17
|
+
import type {
|
|
18
|
+
ClientConfig,
|
|
19
|
+
StateKeyRing,
|
|
20
|
+
TenantContext,
|
|
21
|
+
TenantId,
|
|
22
|
+
ThemeConfig,
|
|
23
|
+
} from "./tenant"
|
|
24
|
+
import type { PickerContext, PickerMethod } from "./picker"
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Input handed to the user's `success` callback. The framework provides
|
|
28
|
+
* everything needed to map the upstream / credential result into the
|
|
29
|
+
* issued subject.
|
|
30
|
+
*
|
|
31
|
+
* `methodKind` tells you **which provider** produced the result (e.g.
|
|
32
|
+
* `"google"`); `methodId` tells you **which tenant-local instance** of
|
|
33
|
+
* that provider was used (e.g. `"google-workspace"` vs
|
|
34
|
+
* `"google-personal"`). Use `methodKind` for provider-specific branches;
|
|
35
|
+
* use `methodId` for instance-specific routing.
|
|
36
|
+
*/
|
|
37
|
+
export type SuccessMapInput = {
|
|
38
|
+
tenant: TenantContext
|
|
39
|
+
methodId: string
|
|
40
|
+
methodKind: string
|
|
41
|
+
/** Upstream system's stable identifier (from `MethodResult.success`). */
|
|
42
|
+
providerSubject: string
|
|
43
|
+
/** Typed per method via the factory's `P` generic at the call site. */
|
|
44
|
+
properties: unknown
|
|
45
|
+
context: Record<string, unknown> | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optional observation hook payload — fires after the subject claim has
|
|
50
|
+
* already been minted. **Does not** influence the issued subject; use it
|
|
51
|
+
* for audit, analytics, side effects only.
|
|
52
|
+
*/
|
|
53
|
+
export type SuccessEvent = SuccessMapInput & {
|
|
54
|
+
/** The final subject claim that became the JWT `sub`. */
|
|
55
|
+
claim: SubjectClaim
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Optional observation hook payload — fires on a failed auth attempt.
|
|
60
|
+
* Carries enough id information for operators to find the offending flow
|
|
61
|
+
* / config row without leaking secrets.
|
|
62
|
+
*/
|
|
63
|
+
export type FailureEvent = {
|
|
64
|
+
tenantId: TenantId | null
|
|
65
|
+
clientId: string | null
|
|
66
|
+
methodId?: string
|
|
67
|
+
methodKind?: string
|
|
68
|
+
flowId?: string
|
|
69
|
+
error: AuthError
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Optional hook called at `/token` time, after PKCE has succeeded and
|
|
74
|
+
* after the `success` callback has produced a `SubjectClaim`, but
|
|
75
|
+
* **before** the access/refresh response is returned. Use this when you
|
|
76
|
+
* prefer not to persist upstream tokens in the code payload itself (see
|
|
77
|
+
* the "alternative split" note in the plan §"Code payload
|
|
78
|
+
* confidentiality"). If it throws, the IdP responds with OAuth
|
|
79
|
+
* `server_error` and the token issuance is aborted.
|
|
80
|
+
*/
|
|
81
|
+
export type PersistUpstreamTokens = (input: {
|
|
82
|
+
tenant: TenantContext
|
|
83
|
+
methodId: string
|
|
84
|
+
methodKind: string
|
|
85
|
+
providerSubject: string
|
|
86
|
+
properties: unknown
|
|
87
|
+
subjectClaim: SubjectClaim
|
|
88
|
+
}) => Promise<void>
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Optional hook called for RFC 8693 token-exchange requests at
|
|
92
|
+
* `/token`. The host decides whether the authenticated subject can
|
|
93
|
+
* obtain a token scoped to `request.audience` (a new tenant), and
|
|
94
|
+
* returns either:
|
|
95
|
+
*
|
|
96
|
+
* - the `SubjectClaim` representing the subject's identity at the
|
|
97
|
+
* new audience (often the same shape but different `properties` —
|
|
98
|
+
* e.g. a different role), or
|
|
99
|
+
* - an `AuthError` (typically `authError.invalidTarget(...)` if the
|
|
100
|
+
* subject can't access that audience).
|
|
101
|
+
*
|
|
102
|
+
* If this hook is not supplied, token-exchange requests are rejected
|
|
103
|
+
* with `unsupported_grant_type`. This is the graceful-degradation
|
|
104
|
+
* default — the grant simply isn't enabled.
|
|
105
|
+
*
|
|
106
|
+
* The library does NOT inspect the audience string; it's an opaque
|
|
107
|
+
* `TenantId` that the host's `ConfigStore` must be able to resolve.
|
|
108
|
+
*/
|
|
109
|
+
export type ExchangeAudience = (
|
|
110
|
+
currentClaim: SubjectClaim,
|
|
111
|
+
request: {
|
|
112
|
+
/** The target tenant id (RFC 8693 `audience`). Opaque to the library. */
|
|
113
|
+
audience: string
|
|
114
|
+
/** Subset of subject_token scopes the caller asked for. */
|
|
115
|
+
requestedScopes?: string[]
|
|
116
|
+
/** The authenticated client doing the exchange. */
|
|
117
|
+
clientId: string
|
|
118
|
+
/** Tenant the subject_token came from. */
|
|
119
|
+
fromTenantId: string
|
|
120
|
+
},
|
|
121
|
+
) => Promise<SubjectClaim | AuthError>
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* RFC 7591 Dynamic Client Registration request body, normalized to the
|
|
125
|
+
* library's type system. The framework's `/register` handler parses the
|
|
126
|
+
* raw JSON, validates structure, then calls the host's `registerClient`
|
|
127
|
+
* hook with this shape. The host owns persistence — writing through its
|
|
128
|
+
* own `ConfigStore` — and returns the final `ClientConfig`.
|
|
129
|
+
*/
|
|
130
|
+
export type RegisterClientRequest = {
|
|
131
|
+
client_name?: string
|
|
132
|
+
redirect_uris: string[]
|
|
133
|
+
/** RFC 7591 §2 — defaults to `["authorization_code"]`. */
|
|
134
|
+
grant_types?: string[]
|
|
135
|
+
/** RFC 7591 §2 — defaults to `["code"]`. */
|
|
136
|
+
response_types?: string[]
|
|
137
|
+
/** RFC 7591 §2 — `"none"` = public client, otherwise confidential. */
|
|
138
|
+
token_endpoint_auth_method?:
|
|
139
|
+
| "none"
|
|
140
|
+
| "client_secret_basic"
|
|
141
|
+
| "client_secret_post"
|
|
142
|
+
scope?: string
|
|
143
|
+
/** OIDC RP-Initiated Logout 1.0 §2. */
|
|
144
|
+
post_logout_redirect_uris?: string[]
|
|
145
|
+
/** OIDC Core §8.1. */
|
|
146
|
+
sector_identifier_uri?: string
|
|
147
|
+
/** Free-form metadata the host may interpret. */
|
|
148
|
+
contacts?: string[]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* RFC 7591 §3.2.1 response body. Returned verbatim from `/register` when
|
|
153
|
+
* the host hook produces a `ClientConfig`. `client_secret` is included
|
|
154
|
+
* only for confidential clients; public clients omit it.
|
|
155
|
+
*/
|
|
156
|
+
export type RegisterClientResponse = {
|
|
157
|
+
client_id: string
|
|
158
|
+
client_secret?: string
|
|
159
|
+
client_id_issued_at: number
|
|
160
|
+
client_secret_expires_at?: number
|
|
161
|
+
redirect_uris: string[]
|
|
162
|
+
grant_types?: string[]
|
|
163
|
+
response_types?: string[]
|
|
164
|
+
token_endpoint_auth_method?: string
|
|
165
|
+
client_name?: string
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Optional Dynamic Client Registration hook. Hosts that want to expose
|
|
170
|
+
* RFC 7591 client provisioning supply this; the framework validates the
|
|
171
|
+
* wire format, then defers persistence to the host. If absent, the
|
|
172
|
+
* `/register` endpoint returns `invalid_request` so RPs receive a clear
|
|
173
|
+
* "not enabled" signal rather than a 404.
|
|
174
|
+
*
|
|
175
|
+
* The hook receives the parsed request, the resolved tenant, and the
|
|
176
|
+
* plaintext client secret (if any) the framework minted — hosts hash it
|
|
177
|
+
* with `hashClientSecret` before storing on `ClientConfig.secretHash`,
|
|
178
|
+
* then return the final `ClientConfig` along with the secret in the
|
|
179
|
+
* `RegisterClientResponse` so the RP can record it.
|
|
180
|
+
*/
|
|
181
|
+
export type RegisterClient = (input: {
|
|
182
|
+
tenant: TenantContext
|
|
183
|
+
request: RegisterClientRequest
|
|
184
|
+
}) => Promise<Result<{ client: ClientConfig; secret?: string }, AuthError>>
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Optional override for the default provider picker shown when an
|
|
188
|
+
* `/authorize` request has multiple enabled methods and no `method_id`.
|
|
189
|
+
*
|
|
190
|
+
* The library ships a minimal styled default (see `src/ui/picker.ts`);
|
|
191
|
+
* supply this to render a fully custom selection screen. The returned
|
|
192
|
+
* `Response` is sent as-is; the framework applies `cache-control: no-store`
|
|
193
|
+
* unless the response already sets a `Cache-Control` header.
|
|
194
|
+
*/
|
|
195
|
+
export type RenderPicker = (
|
|
196
|
+
methods: PickerMethod[],
|
|
197
|
+
ctx: PickerContext,
|
|
198
|
+
) => Response | Promise<Response>
|
|
199
|
+
|
|
200
|
+
export type IdPOptions = {
|
|
201
|
+
/**
|
|
202
|
+
* Tenant resolution for the first request in a flow. Not consulted on
|
|
203
|
+
* callbacks — the framework recovers `(tenantId, flowId)` from the
|
|
204
|
+
* MAC-bound state envelope, partitioned host, or `flowId`-in-URI
|
|
205
|
+
* mechanism (see plan §"Tenant Recovery Across Redirects").
|
|
206
|
+
*/
|
|
207
|
+
resolveTenant: (req: Request) => Promise<Result<TenantId, AuthError>>
|
|
208
|
+
|
|
209
|
+
/** Opt-in for partitioned callback hosts (recovery mechanism #2). */
|
|
210
|
+
callbackHostFor?: (tenantId: TenantId) => string
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* HMAC-SHA-256 key ring used to MAC the minimal state envelope. The
|
|
214
|
+
* envelope carries only `{ tenantId, flowId, nonce, kid }` — never
|
|
215
|
+
* sensitive data — so a global ring is acceptable and necessary
|
|
216
|
+
* (tenant config can't be loaded until we know the tenant). Operators
|
|
217
|
+
* who prefer storing the ring inside `KeyStore` can use the
|
|
218
|
+
* `loadStateKeyRingFromKeyStore` helper.
|
|
219
|
+
*
|
|
220
|
+
* REQUIRED.
|
|
221
|
+
*/
|
|
222
|
+
stateKeys: StateKeyRing
|
|
223
|
+
|
|
224
|
+
configStore: ConfigStore
|
|
225
|
+
tokenStore: TokenStore
|
|
226
|
+
keyStore: KeyStore
|
|
227
|
+
/** Required: flow records need strong CAS / atomic delete-on-read. */
|
|
228
|
+
sessionStore: SessionStore
|
|
229
|
+
/** Optional but recommended for any production deployment. */
|
|
230
|
+
auditLog?: AuditLog
|
|
231
|
+
/** Optional — falls back to `ConfigStore` for `MethodConfig` lookups. */
|
|
232
|
+
methodStore?: MethodStore
|
|
233
|
+
|
|
234
|
+
/** Issuer URL. Function form lets multi-tenant deployments derive it per request. */
|
|
235
|
+
issuerUrl: string | ((req: Request) => string)
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Available method factories. **The KEY of this record MUST equal
|
|
239
|
+
* `factory.kind`.** `createIdP` throws on construction if any key
|
|
240
|
+
* disagrees with its factory's declared `kind`, with a list of
|
|
241
|
+
* offending keys in the error message.
|
|
242
|
+
*/
|
|
243
|
+
methods: Record<string, AnyAuthMethodFactory>
|
|
244
|
+
|
|
245
|
+
subjects: SubjectSchema
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* REQUIRED. Maps method result → issued subject. Runs at `/token` time,
|
|
249
|
+
* after PKCE check, with the same conceptual role as the existing
|
|
250
|
+
* `auth.success` callback in `issuer.ts`.
|
|
251
|
+
*/
|
|
252
|
+
success: (input: SuccessMapInput) => Promise<SubjectClaim>
|
|
253
|
+
|
|
254
|
+
theme?: ThemeConfig
|
|
255
|
+
|
|
256
|
+
hooks?: {
|
|
257
|
+
/** Observation only — does NOT influence the subject. */
|
|
258
|
+
onSuccess?: (event: SuccessEvent) => Promise<void>
|
|
259
|
+
onFailure?: (event: FailureEvent) => Promise<void>
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Optional escape hatch for high-sensitivity deployments — see the
|
|
264
|
+
* `PersistUpstreamTokens` type doc.
|
|
265
|
+
*/
|
|
266
|
+
persistUpstreamTokens?: PersistUpstreamTokens
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Optional RFC 8693 token-exchange hook. If absent, exchange
|
|
270
|
+
* requests at `/token` return `unsupported_grant_type`. See the
|
|
271
|
+
* `ExchangeAudience` type doc for the contract.
|
|
272
|
+
*/
|
|
273
|
+
exchangeAudience?: ExchangeAudience
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Optional override for the default provider picker. See `RenderPicker`.
|
|
277
|
+
*/
|
|
278
|
+
renderPicker?: RenderPicker
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Optional RFC 7591 Dynamic Client Registration hook. See
|
|
282
|
+
* `RegisterClient` for the contract. When absent, `/register` rejects
|
|
283
|
+
* with `invalid_request: "dynamic client registration is not enabled"`.
|
|
284
|
+
*/
|
|
285
|
+
registerClient?: RegisterClient
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Optional hook that builds the `TenantContext.request.custom` blob for
|
|
289
|
+
* each request the framework processes (the initial `/authorize`, the
|
|
290
|
+
* `/cb/*` callback, and any subsequent direct token endpoint hit).
|
|
291
|
+
*
|
|
292
|
+
* The returned record flows through to methods' `MethodContext`, to the
|
|
293
|
+
* `success` callback's `SuccessMapInput.context`, and to authorize-time
|
|
294
|
+
* `FlowRecord.context` (which is then re-presented on the
|
|
295
|
+
* `/cb/*` side as the flow proceeds). Typical contents: a request id,
|
|
296
|
+
* decoded JWT claims from a host edge layer, mTLS cert info, geo
|
|
297
|
+
* hints — anything per-request the host wants methods or `success` to
|
|
298
|
+
* see.
|
|
299
|
+
*
|
|
300
|
+
* Without this hook, `tenant.request.custom` is `{}` and
|
|
301
|
+
* `SuccessMapInput.context` is `null`. There is no semantic difference
|
|
302
|
+
* between an absent hook and one that returns `{}`.
|
|
303
|
+
*/
|
|
304
|
+
buildCustomContext?: (
|
|
305
|
+
req: Request,
|
|
306
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Optional vendor scope → claim-names map. Merged on top of OIDC Core
|
|
310
|
+
* §5.4 when building the id_token + `/userinfo` response. Lets a host
|
|
311
|
+
* expose its own identity vocabulary (`tenant_id`, `org_role`, etc.)
|
|
312
|
+
* via custom scope names. The standard §5.4 mapping always wins on
|
|
313
|
+
* collision, so an entry for `email` is silently ignored.
|
|
314
|
+
*
|
|
315
|
+
* Per-client scope allowlist still applies — a client must list a
|
|
316
|
+
* custom scope in `ClientConfig.scopes` to be allowed to request it.
|
|
317
|
+
*
|
|
318
|
+
* ```ts
|
|
319
|
+
* customScopeClaims: {
|
|
320
|
+
* tenant: ["tenant_id", "tenant_role", "tenant_roles"],
|
|
321
|
+
* org: ["organization_id", "org_role"],
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
customScopeClaims?: Record<string, ReadonlyArray<string>>
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Optional override for the framework's `Set-Cookie` defaults.
|
|
329
|
+
*
|
|
330
|
+
* Production deployments should rely on the built-in defaults
|
|
331
|
+
* (`secure: true`, no domain, `path: "/"`). Local development over plain
|
|
332
|
+
* HTTP — where Chrome rejects `Secure` cookies — can pass
|
|
333
|
+
* `cookies: { secure: false }` so the `idp.flow` / `auth.*` cookies
|
|
334
|
+
* round-trip on `localhost`. `domain` and `path` are passed through to
|
|
335
|
+
* every framework-issued cookie that doesn't set them itself.
|
|
336
|
+
*/
|
|
337
|
+
cookies?: {
|
|
338
|
+
secure?: boolean
|
|
339
|
+
domain?: string
|
|
340
|
+
path?: string
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* The returned IdP handle. `handle(req)` is the single fetch-style
|
|
346
|
+
* entrypoint suitable for `export default { fetch: idp.handle }` on
|
|
347
|
+
* Cloudflare Workers; the per-endpoint primitives are exposed for
|
|
348
|
+
* embedding inside a larger app (e.g. mounting alongside admin routes).
|
|
349
|
+
*/
|
|
350
|
+
export type IdP = {
|
|
351
|
+
handle: (req: Request) => Promise<Response>
|
|
352
|
+
authorize: (req: Request) => Promise<Response>
|
|
353
|
+
token: (req: Request) => Promise<Response>
|
|
354
|
+
userinfo: (req: Request) => Promise<Response>
|
|
355
|
+
jwks: (req: Request) => Promise<Response>
|
|
356
|
+
discovery: (req: Request) => Promise<Response>
|
|
357
|
+
revoke: (req: Request) => Promise<Response>
|
|
358
|
+
introspect: (req: Request) => Promise<Response>
|
|
359
|
+
/** OIDC RP-Initiated Logout 1.0. */
|
|
360
|
+
endSession: (req: Request) => Promise<Response>
|
|
361
|
+
/** RFC 9126 Pushed Authorization Requests. */
|
|
362
|
+
par: (req: Request) => Promise<Response>
|
|
363
|
+
/** RFC 7591 Dynamic Client Registration. */
|
|
364
|
+
register: (req: Request) => Promise<Response>
|
|
365
|
+
}
|