@robelest/convex-auth 0.0.4-preview.18 → 0.0.4-preview.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/authorization/index.d.ts +46 -0
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +46 -0
- package/dist/authorization/index.js.map +1 -1
- package/dist/bin.cjs +21 -13
- package/dist/client/core/types.d.ts +20 -0
- package/dist/client/core/types.d.ts.map +1 -0
- package/dist/client/index.d.ts +2 -16
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +67 -565
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +40 -12
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +1306 -1344
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/client/core/types.d.ts +2 -0
- package/dist/component/client/index.d.ts +2 -2
- package/dist/component/model.d.ts +80 -80
- package/dist/component/model.d.ts.map +1 -1
- package/dist/component/model.js +5 -1
- package/dist/component/model.js.map +1 -1
- package/dist/component/providers/credentials.d.ts +3 -2
- package/dist/component/providers/credentials.d.ts.map +1 -1
- package/dist/component/providers/email.d.ts +30 -0
- package/dist/component/providers/email.d.ts.map +1 -1
- package/dist/component/providers/phone.d.ts +28 -0
- package/dist/component/providers/phone.d.ts.map +1 -1
- package/dist/component/public/enterprise/audit.d.ts +73 -0
- package/dist/component/public/enterprise/audit.d.ts.map +1 -0
- package/dist/component/public/enterprise/audit.js +108 -0
- package/dist/component/public/enterprise/audit.js.map +1 -0
- package/dist/component/public/enterprise/core.d.ts +176 -0
- package/dist/component/public/enterprise/core.d.ts.map +1 -0
- package/dist/component/public/enterprise/core.js +292 -0
- package/dist/component/public/enterprise/core.js.map +1 -0
- package/dist/component/public/enterprise/domains.d.ts +174 -0
- package/dist/component/public/enterprise/domains.d.ts.map +1 -0
- package/dist/component/public/enterprise/domains.js +271 -0
- package/dist/component/public/enterprise/domains.js.map +1 -0
- package/dist/component/public/enterprise/scim.d.ts +245 -0
- package/dist/component/public/enterprise/scim.d.ts.map +1 -0
- package/dist/component/public/enterprise/scim.js +344 -0
- package/dist/component/public/enterprise/scim.js.map +1 -0
- package/dist/component/public/enterprise/secrets.d.ts +78 -0
- package/dist/component/public/enterprise/secrets.d.ts.map +1 -0
- package/dist/component/public/enterprise/secrets.js +118 -0
- package/dist/component/public/enterprise/secrets.js.map +1 -0
- package/dist/component/public/enterprise/webhooks.d.ts +211 -0
- package/dist/component/public/enterprise/webhooks.d.ts.map +1 -0
- package/dist/component/public/enterprise/webhooks.js +300 -0
- package/dist/component/public/enterprise/webhooks.js.map +1 -0
- package/dist/component/public/factors/devices.d.ts +157 -0
- package/dist/component/public/factors/devices.d.ts.map +1 -0
- package/dist/component/public/factors/devices.js +216 -0
- package/dist/component/public/factors/devices.js.map +1 -0
- package/dist/component/public/factors/passkeys.d.ts +175 -0
- package/dist/component/public/factors/passkeys.d.ts.map +1 -0
- package/dist/component/public/factors/passkeys.js +238 -0
- package/dist/component/public/factors/passkeys.js.map +1 -0
- package/dist/component/public/factors/totp.d.ts +189 -0
- package/dist/component/public/factors/totp.d.ts.map +1 -0
- package/dist/component/public/factors/totp.js +254 -0
- package/dist/component/public/factors/totp.js.map +1 -0
- package/dist/component/public/groups/core.d.ts +137 -0
- package/dist/component/public/groups/core.d.ts.map +1 -0
- package/dist/component/public/groups/core.js +321 -0
- package/dist/component/public/groups/core.js.map +1 -0
- package/dist/component/public/groups/invites.d.ts +217 -0
- package/dist/component/public/groups/invites.d.ts.map +1 -0
- package/dist/component/public/groups/invites.js +457 -0
- package/dist/component/public/groups/invites.js.map +1 -0
- package/dist/component/public/groups/members.d.ts +204 -0
- package/dist/component/public/groups/members.d.ts.map +1 -0
- package/dist/component/public/groups/members.js +355 -0
- package/dist/component/public/groups/members.js.map +1 -0
- package/dist/component/public/identity/accounts.d.ts +147 -0
- package/dist/component/public/identity/accounts.d.ts.map +1 -0
- package/dist/component/public/identity/accounts.js +200 -0
- package/dist/component/public/identity/accounts.js.map +1 -0
- package/dist/component/public/identity/codes.d.ts +104 -0
- package/dist/component/public/identity/codes.d.ts.map +1 -0
- package/dist/component/public/identity/codes.js +140 -0
- package/dist/component/public/identity/codes.js.map +1 -0
- package/dist/component/public/identity/sessions.d.ts +128 -0
- package/dist/component/public/identity/sessions.d.ts.map +1 -0
- package/dist/component/public/identity/sessions.js +192 -0
- package/dist/component/public/identity/sessions.js.map +1 -0
- package/dist/component/public/identity/tokens.d.ts +169 -0
- package/dist/component/public/identity/tokens.d.ts.map +1 -0
- package/dist/component/public/identity/tokens.js +227 -0
- package/dist/component/public/identity/tokens.js.map +1 -0
- package/dist/component/public/identity/users.d.ts +212 -0
- package/dist/component/public/identity/users.d.ts.map +1 -0
- package/dist/component/public/identity/users.js +311 -0
- package/dist/component/public/identity/users.js.map +1 -0
- package/dist/component/public/identity/verifiers.d.ts +116 -0
- package/dist/component/public/identity/verifiers.d.ts.map +1 -0
- package/dist/component/public/identity/verifiers.js +154 -0
- package/dist/component/public/identity/verifiers.js.map +1 -0
- package/dist/component/public/security/keys.d.ts +209 -0
- package/dist/component/public/security/keys.d.ts.map +1 -0
- package/dist/component/public/security/keys.js +319 -0
- package/dist/component/public/security/keys.js.map +1 -0
- package/dist/component/public/security/limits.d.ts +114 -0
- package/dist/component/public/security/limits.d.ts.map +1 -0
- package/dist/component/public/security/limits.js +169 -0
- package/dist/component/public/security/limits.js.map +1 -0
- package/dist/component/public.d.ts +22 -7
- package/dist/component/public.js +21 -6
- package/dist/component/schema.d.ts +288 -288
- package/dist/component/server/auth.d.ts +212 -25
- package/dist/component/server/auth.d.ts.map +1 -1
- package/dist/component/server/auth.js +68 -4
- package/dist/component/server/auth.js.map +1 -1
- package/dist/component/server/authError.js +34 -0
- package/dist/component/server/authError.js.map +1 -0
- package/dist/component/server/{providers.js → config.js} +2 -2
- package/dist/component/server/config.js.map +1 -0
- package/dist/component/server/{domains/core.js → core.js} +107 -88
- package/dist/component/server/core.js.map +1 -0
- package/dist/component/server/{provider.js → crypto.js} +3 -3
- package/dist/component/server/crypto.js.map +1 -0
- package/dist/component/server/device.js +1 -1
- package/dist/component/server/device.js.map +1 -1
- package/dist/component/server/enterprise/config.js +46 -0
- package/dist/component/server/enterprise/config.js.map +1 -0
- package/dist/component/server/{domains/sso.js → enterprise/domain.js} +6 -5
- package/dist/component/server/enterprise/domain.js.map +1 -0
- package/dist/component/server/enterprise/http.js +766 -0
- package/dist/component/server/enterprise/http.js.map +1 -0
- package/dist/component/server/enterprise/oidc.js +248 -0
- package/dist/component/server/enterprise/oidc.js.map +1 -0
- package/dist/component/server/enterprise/policy.js +85 -0
- package/dist/component/server/enterprise/policy.js.map +1 -0
- package/dist/component/server/enterprise/saml.js +338 -0
- package/dist/component/server/enterprise/saml.js.map +1 -0
- package/dist/component/server/enterprise/scim.js +97 -0
- package/dist/component/server/enterprise/scim.js.map +1 -0
- package/dist/component/server/enterprise/shared.js +51 -0
- package/dist/component/server/enterprise/shared.js.map +1 -0
- package/dist/component/server/errors.js.map +1 -1
- package/dist/component/server/http.js +2 -1
- package/dist/component/server/http.js.map +1 -1
- package/dist/component/server/identity.js +1 -1
- package/dist/component/server/identity.js.map +1 -1
- package/dist/component/server/{ratelimit.js → limits.js} +3 -3
- package/dist/component/server/limits.js.map +1 -0
- package/dist/component/server/mutations/account.js +3 -3
- package/dist/component/server/mutations/account.js.map +1 -1
- package/dist/component/server/mutations/code.js +2 -2
- package/dist/component/server/mutations/code.js.map +1 -1
- package/dist/component/server/mutations/invalidate.js +1 -1
- package/dist/component/server/mutations/invalidate.js.map +1 -1
- package/dist/component/server/mutations/oauth.js +5 -3
- package/dist/component/server/mutations/oauth.js.map +1 -1
- package/dist/component/server/mutations/refresh.js +1 -1
- package/dist/component/server/mutations/refresh.js.map +1 -1
- package/dist/component/server/mutations/register.js +3 -3
- package/dist/component/server/mutations/register.js.map +1 -1
- package/dist/component/server/mutations/retrieve.js +4 -4
- package/dist/component/server/mutations/retrieve.js.map +1 -1
- package/dist/component/server/mutations/signature.js +2 -2
- package/dist/component/server/mutations/signature.js.map +1 -1
- package/dist/component/server/mutations/signin.js +1 -1
- package/dist/component/server/mutations/signin.js.map +1 -1
- package/dist/component/server/mutations/signout.js +1 -1
- package/dist/component/server/mutations/signout.js.map +1 -1
- package/dist/component/server/mutations/store/refs.js +15 -0
- package/dist/component/server/mutations/store/refs.js.map +1 -0
- package/dist/component/server/mutations/store.js +80 -10
- package/dist/component/server/mutations/store.js.map +1 -1
- package/dist/component/server/mutations/verifier.js +1 -1
- package/dist/component/server/mutations/verifier.js.map +1 -1
- package/dist/component/server/mutations/verify.js +4 -3
- package/dist/component/server/mutations/verify.js.map +1 -1
- package/dist/component/server/oauth.js +1 -1
- package/dist/component/server/oauth.js.map +1 -1
- package/dist/component/server/passkey.js +2 -1
- package/dist/component/server/passkey.js.map +1 -1
- package/dist/component/server/redirects.js +1 -1
- package/dist/component/server/redirects.js.map +1 -1
- package/dist/component/server/refresh.js +1 -1
- package/dist/component/server/refresh.js.map +1 -1
- package/dist/component/server/{factory.d.ts → runtime.d.ts} +2 -2
- package/dist/component/server/runtime.d.ts.map +1 -0
- package/dist/component/server/runtime.js +413 -0
- package/dist/component/server/runtime.js.map +1 -0
- package/dist/component/server/signin.js +2 -1
- package/dist/component/server/signin.js.map +1 -1
- package/dist/component/server/totp.js +2 -1
- package/dist/component/server/totp.js.map +1 -1
- package/dist/component/server/types.d.ts +225 -41
- package/dist/component/server/types.d.ts.map +1 -1
- package/dist/component/server/types.js.map +1 -1
- package/dist/component/server/users.js +1 -1
- package/dist/component/server/users.js.map +1 -1
- package/dist/component/server/utils.js +1 -1
- package/dist/component/server/utils.js.map +1 -1
- package/dist/core/types.d.ts +369 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/factors/device.js +105 -0
- package/dist/factors/device.js.map +1 -0
- package/dist/factors/passkey.js +181 -0
- package/dist/factors/passkey.js.map +1 -0
- package/dist/factors/totp.js +122 -0
- package/dist/factors/totp.js.map +1 -0
- package/dist/providers/credentials.d.ts +5 -2
- package/dist/providers/credentials.d.ts.map +1 -1
- package/dist/providers/credentials.js +2 -0
- package/dist/providers/credentials.js.map +1 -1
- package/dist/providers/email.d.ts +30 -0
- package/dist/providers/email.d.ts.map +1 -1
- package/dist/providers/email.js +24 -0
- package/dist/providers/email.js.map +1 -1
- package/dist/providers/phone.d.ts +28 -0
- package/dist/providers/phone.d.ts.map +1 -1
- package/dist/providers/phone.js +22 -0
- package/dist/providers/phone.js.map +1 -1
- package/dist/runtime/browser.js +68 -0
- package/dist/runtime/browser.js.map +1 -0
- package/dist/runtime/invite.js +51 -0
- package/dist/runtime/invite.js.map +1 -0
- package/dist/runtime/proxy.js +70 -0
- package/dist/runtime/proxy.js.map +1 -0
- package/dist/runtime/storage.js +37 -0
- package/dist/runtime/storage.js.map +1 -0
- package/dist/server/auth.d.ts +218 -28
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +68 -4
- package/dist/server/auth.js.map +1 -1
- package/dist/server/{fx.d.ts → authError.d.ts} +25 -15
- package/dist/server/authError.d.ts.map +1 -0
- package/dist/server/authError.js +34 -0
- package/dist/server/authError.js.map +1 -0
- package/dist/server/{providers.js → config.js} +2 -2
- package/dist/server/config.js.map +1 -0
- package/dist/server/core.d.ts +1436 -0
- package/dist/server/core.d.ts.map +1 -0
- package/dist/server/{domains/core.js → core.js} +107 -88
- package/dist/server/core.js.map +1 -0
- package/dist/server/{provider.d.ts → crypto.d.ts} +2 -2
- package/dist/server/crypto.d.ts.map +1 -0
- package/dist/server/{provider.js → crypto.js} +3 -3
- package/dist/{component/server/provider.js.map → server/crypto.js.map} +1 -1
- package/dist/server/device.js +1 -1
- package/dist/server/device.js.map +1 -1
- package/dist/server/enterprise/config.js +46 -0
- package/dist/server/enterprise/config.js.map +1 -0
- package/dist/server/{domains/sso.d.ts → enterprise/domain.d.ts} +4 -4
- package/dist/server/enterprise/domain.d.ts.map +1 -0
- package/dist/server/{domains/sso.js → enterprise/domain.js} +6 -5
- package/dist/server/enterprise/domain.js.map +1 -0
- package/dist/server/enterprise/http.d.ts +26 -0
- package/dist/server/enterprise/http.d.ts.map +1 -0
- package/dist/server/enterprise/http.js +766 -0
- package/dist/server/enterprise/http.js.map +1 -0
- package/dist/server/enterprise/oidc.js +248 -0
- package/dist/server/enterprise/oidc.js.map +1 -0
- package/dist/server/enterprise/policy.js +85 -0
- package/dist/server/enterprise/policy.js.map +1 -0
- package/dist/server/enterprise/saml.d.ts +1 -0
- package/dist/server/enterprise/saml.js +338 -0
- package/dist/server/enterprise/saml.js.map +1 -0
- package/dist/server/enterprise/scim.d.ts +1 -0
- package/dist/server/enterprise/scim.js +97 -0
- package/dist/server/enterprise/scim.js.map +1 -0
- package/dist/server/enterprise/shared.d.ts +5 -0
- package/dist/server/enterprise/shared.d.ts.map +1 -0
- package/dist/server/enterprise/shared.js +51 -0
- package/dist/server/enterprise/shared.js.map +1 -0
- package/dist/server/enterprise/validators.d.ts +1 -0
- package/dist/server/{enterpriseValidators.js → enterprise/validators.js} +2 -2
- package/dist/server/enterprise/validators.js.map +1 -0
- package/dist/server/errors.d.ts +2 -0
- package/dist/server/errors.d.ts.map +1 -1
- package/dist/server/errors.js +2 -0
- package/dist/server/errors.js.map +1 -1
- package/dist/server/http.d.ts +2 -2
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/http.js +2 -1
- package/dist/server/http.js.map +1 -1
- package/dist/server/identity.js +1 -1
- package/dist/server/identity.js.map +1 -1
- package/dist/server/index.d.ts +4 -705
- package/dist/server/index.js +4 -1367
- package/dist/server/limits.d.ts +1 -0
- package/dist/server/{ratelimit.js → limits.js} +3 -3
- package/dist/server/limits.js.map +1 -0
- package/dist/server/mounts.d.ts +647 -0
- package/dist/server/mounts.d.ts.map +1 -0
- package/dist/server/mounts.js +643 -0
- package/dist/server/mounts.js.map +1 -0
- package/dist/server/mutations/account.d.ts +8 -8
- package/dist/server/mutations/account.js +3 -3
- package/dist/server/mutations/account.js.map +1 -1
- package/dist/server/mutations/code.d.ts +13 -13
- package/dist/server/mutations/code.js +2 -2
- package/dist/server/mutations/code.js.map +1 -1
- package/dist/server/mutations/index.d.ts +8 -312
- package/dist/server/mutations/index.js +14 -84
- package/dist/server/mutations/invalidate.d.ts +5 -5
- package/dist/server/mutations/invalidate.d.ts.map +1 -1
- package/dist/server/mutations/invalidate.js +1 -1
- package/dist/server/mutations/invalidate.js.map +1 -1
- package/dist/server/mutations/oauth.d.ts +9 -9
- package/dist/server/mutations/oauth.d.ts.map +1 -1
- package/dist/server/mutations/oauth.js +5 -3
- package/dist/server/mutations/oauth.js.map +1 -1
- package/dist/server/mutations/refresh.d.ts +4 -4
- package/dist/server/mutations/refresh.js +1 -1
- package/dist/server/mutations/refresh.js.map +1 -1
- package/dist/server/mutations/register.d.ts +10 -10
- package/dist/server/mutations/register.d.ts.map +1 -1
- package/dist/server/mutations/register.js +3 -3
- package/dist/server/mutations/register.js.map +1 -1
- package/dist/server/mutations/retrieve.d.ts +8 -10
- package/dist/server/mutations/retrieve.d.ts.map +1 -1
- package/dist/server/mutations/retrieve.js +5 -7
- package/dist/server/mutations/retrieve.js.map +1 -1
- package/dist/server/mutations/signature.d.ts +6 -6
- package/dist/server/mutations/signature.d.ts.map +1 -1
- package/dist/server/mutations/signature.js +2 -2
- package/dist/server/mutations/signature.js.map +1 -1
- package/dist/server/mutations/signin.d.ts +1 -1
- package/dist/server/mutations/signin.js +1 -1
- package/dist/server/mutations/signin.js.map +1 -1
- package/dist/server/mutations/signout.d.ts +1 -1
- package/dist/server/mutations/signout.js +1 -1
- package/dist/server/mutations/signout.js.map +1 -1
- package/dist/server/mutations/store/refs.d.ts +12 -0
- package/dist/server/mutations/store/refs.d.ts.map +1 -0
- package/dist/server/mutations/store/refs.js +15 -0
- package/dist/server/mutations/store/refs.js.map +1 -0
- package/dist/server/mutations/store.d.ts +303 -9
- package/dist/server/mutations/store.d.ts.map +1 -1
- package/dist/server/mutations/store.js +80 -10
- package/dist/server/mutations/store.js.map +1 -1
- package/dist/server/mutations/verifier.d.ts +1 -1
- package/dist/server/mutations/verifier.js +1 -1
- package/dist/server/mutations/verifier.js.map +1 -1
- package/dist/server/mutations/verify.d.ts +8 -8
- package/dist/server/mutations/verify.d.ts.map +1 -1
- package/dist/server/mutations/verify.js +4 -3
- package/dist/server/mutations/verify.js.map +1 -1
- package/dist/server/oauth.js +1 -1
- package/dist/server/oauth.js.map +1 -1
- package/dist/server/passkey.d.ts +2 -2
- package/dist/server/passkey.d.ts.map +1 -1
- package/dist/server/passkey.js +3 -2
- package/dist/server/passkey.js.map +1 -1
- package/dist/server/redirects.js +1 -1
- package/dist/server/redirects.js.map +1 -1
- package/dist/server/refresh.js +1 -1
- package/dist/server/refresh.js.map +1 -1
- package/dist/server/{factory.d.ts → runtime.d.ts} +16 -16
- package/dist/server/runtime.d.ts.map +1 -0
- package/dist/server/runtime.js +413 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/signin.js +3 -2
- package/dist/server/signin.js.map +1 -1
- package/dist/server/ssr.d.ts +226 -0
- package/dist/server/ssr.d.ts.map +1 -0
- package/dist/server/ssr.js +786 -0
- package/dist/server/ssr.js.map +1 -0
- package/dist/server/totp.js +2 -1
- package/dist/server/totp.js.map +1 -1
- package/dist/server/types.d.ts +242 -42
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js +12 -1
- package/dist/server/types.js.map +1 -1
- package/dist/server/users.js +1 -1
- package/dist/server/users.js.map +1 -1
- package/dist/server/utils.js +1 -1
- package/dist/server/utils.js.map +1 -1
- package/package.json +3 -4
- package/src/authorization/index.ts +46 -0
- package/src/cli/index.ts +38 -20
- package/src/client/core/types.ts +437 -0
- package/src/client/factors/device.ts +160 -0
- package/src/client/factors/passkey.ts +282 -0
- package/src/client/factors/totp.ts +150 -0
- package/src/client/index.ts +133 -1267
- package/src/client/runtime/browser.ts +112 -0
- package/src/client/runtime/invite.ts +65 -0
- package/src/client/runtime/proxy.ts +111 -0
- package/src/client/runtime/storage.ts +79 -0
- package/src/component/_generated/api.ts +40 -12
- package/src/component/_generated/component.ts +1772 -1798
- package/src/component/model.ts +6 -0
- package/src/component/public/enterprise/audit.ts +120 -0
- package/src/component/public/enterprise/core.ts +354 -0
- package/src/component/public/enterprise/domains.ts +323 -0
- package/src/component/public/enterprise/scim.ts +396 -0
- package/src/component/public/enterprise/secrets.ts +132 -0
- package/src/component/public/enterprise/webhooks.ts +306 -0
- package/src/component/public/factors/devices.ts +223 -0
- package/src/component/public/factors/passkeys.ts +242 -0
- package/src/component/public/factors/totp.ts +258 -0
- package/src/component/public/groups/core.ts +481 -0
- package/src/component/public/groups/invites.ts +602 -0
- package/src/component/public/groups/members.ts +409 -0
- package/src/component/public/identity/accounts.ts +206 -0
- package/src/component/public/identity/codes.ts +148 -0
- package/src/component/public/identity/sessions.ts +209 -0
- package/src/component/public/identity/tokens.ts +250 -0
- package/src/component/public/identity/users.ts +354 -0
- package/src/component/public/identity/verifiers.ts +157 -0
- package/src/component/public/security/keys.ts +365 -0
- package/src/component/public/security/limits.ts +173 -0
- package/src/component/public.ts +27 -5
- package/src/providers/credentials.ts +4 -5
- package/src/providers/email.ts +30 -0
- package/src/providers/phone.ts +28 -0
- package/src/server/auth.ts +282 -28
- package/src/server/authError.ts +44 -0
- package/src/server/core.ts +2095 -0
- package/src/server/{provider.ts → crypto.ts} +1 -1
- package/src/server/device.ts +1 -1
- package/src/server/enterprise/config.ts +51 -0
- package/src/server/{domains/sso.ts → enterprise/domain.ts} +4 -2
- package/src/server/enterprise/http.ts +1324 -0
- package/src/server/enterprise/oidc.ts +500 -0
- package/src/server/enterprise/policy.ts +128 -0
- package/src/server/enterprise/saml.ts +578 -0
- package/src/server/enterprise/scim.ts +135 -0
- package/src/server/enterprise/shared.ts +134 -0
- package/src/server/errors.ts +2 -0
- package/src/server/http.ts +3 -1
- package/src/server/identity.ts +1 -1
- package/src/server/index.ts +32 -2605
- package/src/server/{ratelimit.ts → limits.ts} +1 -1
- package/src/server/mounts.ts +948 -0
- package/src/server/mutations/account.ts +4 -4
- package/src/server/mutations/code.ts +3 -3
- package/src/server/mutations/index.ts +8 -148
- package/src/server/mutations/invalidate.ts +2 -2
- package/src/server/mutations/oauth.ts +8 -6
- package/src/server/mutations/refresh.ts +3 -3
- package/src/server/mutations/register.ts +3 -3
- package/src/server/mutations/retrieve.ts +4 -8
- package/src/server/mutations/signature.ts +3 -3
- package/src/server/mutations/signin.ts +2 -2
- package/src/server/mutations/signout.ts +2 -2
- package/src/server/mutations/store/refs.ts +10 -0
- package/src/server/mutations/store.ts +137 -9
- package/src/server/mutations/verifier.ts +2 -2
- package/src/server/mutations/verify.ts +5 -5
- package/src/server/oauth.ts +1 -1
- package/src/server/passkey.ts +3 -4
- package/src/server/redirects.ts +1 -1
- package/src/server/refresh.ts +1 -1
- package/src/server/runtime.ts +880 -0
- package/src/server/signin.ts +3 -1
- package/src/server/ssr.ts +1764 -0
- package/src/server/totp.ts +3 -1
- package/src/server/types.ts +254 -43
- package/src/server/users.ts +1 -1
- package/src/server/utils.ts +1 -1
- package/src/test.ts +25 -0
- package/dist/component/public/enterprise.d.ts +0 -54
- package/dist/component/public/enterprise.d.ts.map +0 -1
- package/dist/component/public/enterprise.js +0 -515
- package/dist/component/public/enterprise.js.map +0 -1
- package/dist/component/public/factors.d.ts +0 -52
- package/dist/component/public/factors.d.ts.map +0 -1
- package/dist/component/public/factors.js +0 -285
- package/dist/component/public/factors.js.map +0 -1
- package/dist/component/public/groups.d.ts +0 -124
- package/dist/component/public/groups.d.ts.map +0 -1
- package/dist/component/public/groups.js +0 -680
- package/dist/component/public/groups.js.map +0 -1
- package/dist/component/public/identity.d.ts +0 -93
- package/dist/component/public/identity.d.ts.map +0 -1
- package/dist/component/public/identity.js +0 -426
- package/dist/component/public/identity.js.map +0 -1
- package/dist/component/public/keys.d.ts +0 -41
- package/dist/component/public/keys.d.ts.map +0 -1
- package/dist/component/public/keys.js +0 -157
- package/dist/component/public/keys.js.map +0 -1
- package/dist/component/public/shared.d.ts +0 -26
- package/dist/component/public/shared.d.ts.map +0 -1
- package/dist/component/public/shared.js +0 -32
- package/dist/component/public/shared.js.map +0 -1
- package/dist/component/server/domains/core.js.map +0 -1
- package/dist/component/server/domains/sso.js.map +0 -1
- package/dist/component/server/factory.d.ts.map +0 -1
- package/dist/component/server/factory.js +0 -1134
- package/dist/component/server/factory.js.map +0 -1
- package/dist/component/server/fx.js +0 -66
- package/dist/component/server/fx.js.map +0 -1
- package/dist/component/server/mutations/index.js +0 -85
- package/dist/component/server/mutations/index.js.map +0 -1
- package/dist/component/server/providers.js.map +0 -1
- package/dist/component/server/ratelimit.js.map +0 -1
- package/dist/component/server/sso.js +0 -830
- package/dist/component/server/sso.js.map +0 -1
- package/dist/server/domains/core.d.ts +0 -449
- package/dist/server/domains/core.d.ts.map +0 -1
- package/dist/server/domains/core.js.map +0 -1
- package/dist/server/domains/sso.d.ts.map +0 -1
- package/dist/server/domains/sso.js.map +0 -1
- package/dist/server/enterpriseValidators.js.map +0 -1
- package/dist/server/factory.d.ts.map +0 -1
- package/dist/server/factory.js +0 -1134
- package/dist/server/factory.js.map +0 -1
- package/dist/server/fx.d.ts.map +0 -1
- package/dist/server/fx.js +0 -66
- package/dist/server/fx.js.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/mutations/index.d.ts.map +0 -1
- package/dist/server/mutations/index.js.map +0 -1
- package/dist/server/provider.d.ts.map +0 -1
- package/dist/server/provider.js.map +0 -1
- package/dist/server/providers.js.map +0 -1
- package/dist/server/ratelimit.js.map +0 -1
- package/dist/server/sso.js +0 -830
- package/dist/server/sso.js.map +0 -1
- package/dist/server/version.d.ts +0 -5
- package/dist/server/version.d.ts.map +0 -1
- package/dist/server/version.js +0 -6
- package/dist/server/version.js.map +0 -1
- package/src/component/public/enterprise.ts +0 -753
- package/src/component/public/factors.ts +0 -333
- package/src/component/public/groups.ts +0 -1066
- package/src/component/public/identity.ts +0 -569
- package/src/component/public/keys.ts +0 -209
- package/src/component/public/shared.ts +0 -119
- package/src/server/domains/core.ts +0 -1096
- package/src/server/factory.ts +0 -2181
- package/src/server/fx.ts +0 -152
- package/src/server/sso.ts +0 -1516
- package/src/server/version.ts +0 -2
- /package/dist/server/{enterpriseValidators.d.ts → config.d.ts} +0 -0
- /package/dist/server/{providers.d.ts → enterprise/config.d.ts} +0 -0
- /package/dist/server/{ratelimit.d.ts → enterprise/oidc.d.ts} +0 -0
- /package/dist/server/{sso.d.ts → enterprise/policy.d.ts} +0 -0
- /package/src/server/{providers.ts → config.ts} +0 -0
- /package/src/server/{enterpriseValidators.ts → enterprise/validators.ts} +0 -0
|
@@ -3,12 +3,12 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import { GetProviderOrThrowFunc, hash } from "../
|
|
8
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import { GetProviderOrThrowFunc, hash } from "../crypto";
|
|
8
|
+
import * as Provider from "../crypto";
|
|
9
9
|
import { MutationCtx } from "../types";
|
|
10
10
|
import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
|
|
11
|
-
import { AUTH_STORE_REF } from "./store";
|
|
11
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
12
12
|
|
|
13
13
|
export const modifyAccountArgs = v.object({
|
|
14
14
|
provider: v.string(),
|
|
@@ -2,14 +2,14 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
2
2
|
import { GenericId, Infer, v } from "convex/values";
|
|
3
3
|
|
|
4
4
|
import { authDb } from "../db";
|
|
5
|
-
import { AuthError } from "../
|
|
6
|
-
import * as Provider from "../
|
|
5
|
+
import { AuthError } from "../authError";
|
|
6
|
+
import * as Provider from "../crypto";
|
|
7
7
|
import { getAuthSessionId } from "../sessions";
|
|
8
8
|
import { MutationCtx } from "../types";
|
|
9
9
|
import { EmailConfig, PhoneConfig } from "../types";
|
|
10
10
|
import { upsertUserAndAccount } from "../users";
|
|
11
11
|
import { LOG_LEVELS, logWithLevel, sha256 } from "../utils";
|
|
12
|
-
import { AUTH_STORE_REF } from "./store";
|
|
12
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
13
13
|
|
|
14
14
|
export const createVerificationCodeArgs = v.object({
|
|
15
15
|
accountId: v.optional(v.string()),
|
|
@@ -1,153 +1,13 @@
|
|
|
1
|
-
import { Fx } from "@robelest/fx";
|
|
2
|
-
import { Infer, v } from "convex/values";
|
|
3
|
-
|
|
4
|
-
import * as Provider from "../provider";
|
|
5
|
-
import { MutationCtx } from "../types";
|
|
6
|
-
import { LOG_LEVELS, logWithLevel } from "../utils";
|
|
7
|
-
import { modifyAccountArgs, modifyAccountImpl } from "./account";
|
|
8
|
-
import { createVerificationCodeArgs, createVerificationCodeImpl } from "./code";
|
|
9
|
-
import { invalidateSessionsArgs, invalidateSessionsImpl } from "./invalidate";
|
|
10
|
-
import { userOAuthArgs, userOAuthImpl } from "./oauth";
|
|
11
|
-
import { refreshSessionArgs, refreshSessionImpl } from "./refresh";
|
|
12
|
-
import {
|
|
13
|
-
createAccountFromCredentialsArgs,
|
|
14
|
-
createAccountFromCredentialsImpl,
|
|
15
|
-
} from "./register";
|
|
16
|
-
import {
|
|
17
|
-
retrieveAccountWithCredentialsArgs,
|
|
18
|
-
retrieveAccountWithCredentialsImpl,
|
|
19
|
-
} from "./retrieve";
|
|
20
|
-
import { verifierSignatureArgs, verifierSignatureImpl } from "./signature";
|
|
21
|
-
import { signInArgs, signInImpl } from "./signin";
|
|
22
|
-
import { signOutImpl } from "./signout";
|
|
23
|
-
import { verifierImpl } from "./verifier";
|
|
24
|
-
import { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from "./verify";
|
|
25
|
-
export { callInvalidateSessions } from "./invalidate";
|
|
26
1
|
export { callModifyAccount } from "./account";
|
|
27
|
-
export {
|
|
28
|
-
callRetrieveAccountWithCredentials,
|
|
29
|
-
callRetreiveAccountWithCredentials,
|
|
30
|
-
} from "./retrieve";
|
|
31
|
-
export { callCreateAccountFromCredentials } from "./register";
|
|
32
2
|
export { callCreateVerificationCode } from "./code";
|
|
3
|
+
export { callInvalidateSessions } from "./invalidate";
|
|
33
4
|
export { callUserOAuth } from "./oauth";
|
|
34
|
-
export { callVerifierSignature } from "./signature";
|
|
35
|
-
export { callVerifyCodeAndSignIn } from "./verify";
|
|
36
|
-
export { callVerifier } from "./verifier";
|
|
37
5
|
export { callRefreshSession } from "./refresh";
|
|
38
|
-
export {
|
|
6
|
+
export { callCreateAccountFromCredentials } from "./register";
|
|
7
|
+
export { callRetrieveAccountWithCredentials } from "./retrieve";
|
|
8
|
+
export { callVerifierSignature } from "./signature";
|
|
39
9
|
export { callSignIn } from "./signin";
|
|
40
|
-
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
type: v.literal("signIn"),
|
|
45
|
-
...signInArgs.fields,
|
|
46
|
-
}),
|
|
47
|
-
v.object({
|
|
48
|
-
type: v.literal("signOut"),
|
|
49
|
-
}),
|
|
50
|
-
v.object({
|
|
51
|
-
type: v.literal("refreshSession"),
|
|
52
|
-
...refreshSessionArgs.fields,
|
|
53
|
-
}),
|
|
54
|
-
v.object({
|
|
55
|
-
type: v.literal("verifyCodeAndSignIn"),
|
|
56
|
-
...verifyCodeAndSignInArgs.fields,
|
|
57
|
-
}),
|
|
58
|
-
v.object({
|
|
59
|
-
type: v.literal("verifier"),
|
|
60
|
-
}),
|
|
61
|
-
v.object({
|
|
62
|
-
type: v.literal("verifierSignature"),
|
|
63
|
-
...verifierSignatureArgs.fields,
|
|
64
|
-
}),
|
|
65
|
-
v.object({
|
|
66
|
-
type: v.literal("userOAuth"),
|
|
67
|
-
...userOAuthArgs.fields,
|
|
68
|
-
}),
|
|
69
|
-
v.object({
|
|
70
|
-
type: v.literal("createVerificationCode"),
|
|
71
|
-
...createVerificationCodeArgs.fields,
|
|
72
|
-
}),
|
|
73
|
-
v.object({
|
|
74
|
-
type: v.literal("createAccountFromCredentials"),
|
|
75
|
-
...createAccountFromCredentialsArgs.fields,
|
|
76
|
-
}),
|
|
77
|
-
v.object({
|
|
78
|
-
type: v.literal("retrieveAccountWithCredentials"),
|
|
79
|
-
...retrieveAccountWithCredentialsArgs.fields,
|
|
80
|
-
}),
|
|
81
|
-
v.object({
|
|
82
|
-
type: v.literal("modifyAccount"),
|
|
83
|
-
...modifyAccountArgs.fields,
|
|
84
|
-
}),
|
|
85
|
-
v.object({
|
|
86
|
-
type: v.literal("invalidateSessions"),
|
|
87
|
-
...invalidateSessionsArgs.fields,
|
|
88
|
-
}),
|
|
89
|
-
),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export const storeImpl = async (
|
|
93
|
-
ctx: MutationCtx,
|
|
94
|
-
fnArgs: Infer<typeof storeArgs>,
|
|
95
|
-
getProviderOrThrow: Provider.GetProviderOrThrowFunc,
|
|
96
|
-
config: Provider.Config,
|
|
97
|
-
) => {
|
|
98
|
-
const args = fnArgs.args;
|
|
99
|
-
logWithLevel(LOG_LEVELS.INFO, `\`auth:store\` type: ${args.type}`);
|
|
100
|
-
return Fx.run(
|
|
101
|
-
Fx.match(args, args.type, {
|
|
102
|
-
signIn: (a) =>
|
|
103
|
-
Fx.from({
|
|
104
|
-
ok: () => signInImpl(ctx, a, config),
|
|
105
|
-
err: (e) => e as never,
|
|
106
|
-
}),
|
|
107
|
-
signOut: () => signOutImpl(ctx, config),
|
|
108
|
-
refreshSession: (a) =>
|
|
109
|
-
Fx.from({
|
|
110
|
-
ok: () => refreshSessionImpl(ctx, a, getProviderOrThrow, config),
|
|
111
|
-
err: (e) => e as never,
|
|
112
|
-
}),
|
|
113
|
-
verifyCodeAndSignIn: (a) =>
|
|
114
|
-
Fx.from({
|
|
115
|
-
ok: () => verifyCodeAndSignInImpl(ctx, a, getProviderOrThrow, config),
|
|
116
|
-
err: (e) => e as never,
|
|
117
|
-
}),
|
|
118
|
-
verifier: () => verifierImpl(ctx, config),
|
|
119
|
-
verifierSignature: (a) =>
|
|
120
|
-
verifierSignatureImpl(ctx, a, config).pipe(
|
|
121
|
-
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
122
|
-
),
|
|
123
|
-
userOAuth: (a) =>
|
|
124
|
-
userOAuthImpl(ctx, a, getProviderOrThrow, config).pipe(
|
|
125
|
-
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
126
|
-
),
|
|
127
|
-
createVerificationCode: (a) =>
|
|
128
|
-
Fx.from({
|
|
129
|
-
ok: () =>
|
|
130
|
-
createVerificationCodeImpl(ctx, a, getProviderOrThrow, config),
|
|
131
|
-
err: (e) => e as never,
|
|
132
|
-
}),
|
|
133
|
-
createAccountFromCredentials: (a) =>
|
|
134
|
-
Fx.from({
|
|
135
|
-
ok: () =>
|
|
136
|
-
createAccountFromCredentialsImpl(
|
|
137
|
-
ctx,
|
|
138
|
-
a,
|
|
139
|
-
getProviderOrThrow,
|
|
140
|
-
config,
|
|
141
|
-
),
|
|
142
|
-
err: (e) => e as never,
|
|
143
|
-
}),
|
|
144
|
-
retrieveAccountWithCredentials: (a) =>
|
|
145
|
-
retrieveAccountWithCredentialsImpl(ctx, a, getProviderOrThrow, config),
|
|
146
|
-
modifyAccount: (a) =>
|
|
147
|
-
modifyAccountImpl(ctx, a, getProviderOrThrow, config).pipe(
|
|
148
|
-
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
149
|
-
),
|
|
150
|
-
invalidateSessions: (a) => invalidateSessionsImpl(ctx, a, config),
|
|
151
|
-
}),
|
|
152
|
-
);
|
|
153
|
-
};
|
|
10
|
+
export { callSignOut } from "./signout";
|
|
11
|
+
export { storeArgs, storeImpl } from "./store";
|
|
12
|
+
export { callVerifier } from "./verifier";
|
|
13
|
+
export { callVerifyCodeAndSignIn } from "./verify";
|
|
@@ -3,11 +3,11 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { GenericId, Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import * as Provider from "../
|
|
6
|
+
import * as Provider from "../crypto";
|
|
7
7
|
import { deleteSession } from "../sessions";
|
|
8
8
|
import { Doc, MutationCtx } from "../types";
|
|
9
9
|
import { LOG_LEVELS, logWithLevel } from "../utils";
|
|
10
|
-
import { AUTH_STORE_REF } from "./store";
|
|
10
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
11
11
|
|
|
12
12
|
export const invalidateSessionsArgs = v.object({
|
|
13
13
|
userId: v.string(),
|
|
@@ -3,20 +3,22 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import * as Provider from "../crypto";
|
|
8
|
+
import {
|
|
9
|
+
createSyntheticOAuthMaterializedConfig,
|
|
10
|
+
} from "../enterprise/oidc";
|
|
11
|
+
import { normalizeEnterprisePolicy } from "../enterprise/policy";
|
|
8
12
|
import {
|
|
9
13
|
ENTERPRISE_OIDC_PROVIDER_PREFIX,
|
|
10
14
|
ENTERPRISE_SAML_PROVIDER_PREFIX,
|
|
11
|
-
createSyntheticOAuthMaterializedConfig,
|
|
12
15
|
isEnterpriseProviderId,
|
|
13
|
-
|
|
14
|
-
} from "../sso";
|
|
16
|
+
} from "../enterprise/shared";
|
|
15
17
|
import { MutationCtx } from "../types";
|
|
16
18
|
import type { AuthProviderMaterializedConfig } from "../types";
|
|
17
19
|
import { upsertUserAndAccount } from "../users";
|
|
18
20
|
import { generateRandomString, logWithLevel, sha256 } from "../utils";
|
|
19
|
-
import { AUTH_STORE_REF } from "./store";
|
|
21
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
20
22
|
|
|
21
23
|
const OAUTH_SIGN_IN_EXPIRATION_MS = 1000 * 60 * 2; // 2 minutes
|
|
22
24
|
|
|
@@ -3,8 +3,8 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import * as Provider from "../crypto";
|
|
8
8
|
import {
|
|
9
9
|
invalidateRefreshTokensInSubtree,
|
|
10
10
|
parseRefreshToken,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { generateTokensForSession } from "../sessions";
|
|
15
15
|
import { MutationCtx } from "../types";
|
|
16
16
|
import { logWithLevel, maybeRedact } from "../utils";
|
|
17
|
-
import { AUTH_STORE_REF } from "./store";
|
|
17
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
18
18
|
|
|
19
19
|
export const refreshSessionArgs = v.object({
|
|
20
20
|
refreshToken: v.string(),
|
|
@@ -3,14 +3,14 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import * as Provider from "../crypto";
|
|
8
8
|
import { getAuthSessionId } from "../sessions";
|
|
9
9
|
import { Doc, MutationCtx } from "../types";
|
|
10
10
|
import { ConvexCredentialsConfig } from "../types";
|
|
11
11
|
import { upsertUserAndAccount } from "../users";
|
|
12
12
|
import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
|
|
13
|
-
import { AUTH_STORE_REF } from "./store";
|
|
13
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
14
14
|
|
|
15
15
|
export const createAccountFromCredentialsArgs = v.object({
|
|
16
16
|
provider: v.string(),
|
|
@@ -3,16 +3,16 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import * as Provider from "../crypto";
|
|
8
8
|
import {
|
|
9
9
|
isSignInRateLimited,
|
|
10
10
|
recordFailedSignIn,
|
|
11
11
|
resetSignInRateLimit,
|
|
12
|
-
} from "../
|
|
12
|
+
} from "../limits";
|
|
13
13
|
import { Doc, MutationCtx } from "../types";
|
|
14
14
|
import { LOG_LEVELS, logWithLevel, maybeRedact } from "../utils";
|
|
15
|
-
import { AUTH_STORE_REF } from "./store";
|
|
15
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
16
16
|
|
|
17
17
|
export const retrieveAccountWithCredentialsArgs = v.object({
|
|
18
18
|
provider: v.string(),
|
|
@@ -107,7 +107,3 @@ export const callRetrieveAccountWithCredentials = async <
|
|
|
107
107
|
},
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
|
-
|
|
111
|
-
/** @deprecated Typo kept for backward compatibility. */
|
|
112
|
-
export const callRetreiveAccountWithCredentials =
|
|
113
|
-
callRetrieveAccountWithCredentials;
|
|
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { GenericId, Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import { AuthError } from "../
|
|
7
|
-
import * as Provider from "../
|
|
6
|
+
import { AuthError } from "../authError";
|
|
7
|
+
import * as Provider from "../crypto";
|
|
8
8
|
import { MutationCtx } from "../types";
|
|
9
|
-
import { AUTH_STORE_REF } from "./store";
|
|
9
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
10
10
|
|
|
11
11
|
export const verifierSignatureArgs = v.object({
|
|
12
12
|
verifier: v.string(),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
2
2
|
import { GenericId, Infer, v } from "convex/values";
|
|
3
3
|
|
|
4
|
-
import * as Provider from "../
|
|
4
|
+
import * as Provider from "../crypto";
|
|
5
5
|
import {
|
|
6
6
|
createNewAndDeleteExistingSession,
|
|
7
7
|
maybeGenerateTokensForSession,
|
|
8
8
|
} from "../sessions";
|
|
9
9
|
import { MutationCtx, SessionInfo } from "../types";
|
|
10
10
|
import { LOG_LEVELS, logWithLevel } from "../utils";
|
|
11
|
-
import { AUTH_STORE_REF } from "./store";
|
|
11
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
12
12
|
|
|
13
13
|
export const signInArgs = v.object({
|
|
14
14
|
userId: v.string(),
|
|
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { GenericId } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import * as Provider from "../
|
|
6
|
+
import * as Provider from "../crypto";
|
|
7
7
|
import { deleteSession, getAuthSessionId } from "../sessions";
|
|
8
8
|
import { MutationCtx } from "../types";
|
|
9
|
-
import { AUTH_STORE_REF } from "./store";
|
|
9
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
10
10
|
|
|
11
11
|
type ReturnType = {
|
|
12
12
|
userId: GenericId<"User">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { makeFunctionReference } from "convex/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Internal function reference for the library's store dispatch mutation.
|
|
5
|
+
*
|
|
6
|
+
* The package cannot import the consumer app's generated `api` module,
|
|
7
|
+
* so it uses a canonical function reference name that matches the app-level
|
|
8
|
+
* `export const { store } = auth` surface.
|
|
9
|
+
*/
|
|
10
|
+
export const AUTH_STORE_REF = makeFunctionReference("auth:store") as any;
|
|
@@ -1,10 +1,138 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fx } from "@robelest/fx";
|
|
2
|
+
import { Infer, v } from "convex/values";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import * as Provider from "../crypto";
|
|
5
|
+
import { MutationCtx } from "../types";
|
|
6
|
+
import { LOG_LEVELS, logWithLevel } from "../utils";
|
|
7
|
+
import { modifyAccountArgs, modifyAccountImpl } from "./account";
|
|
8
|
+
import { createVerificationCodeArgs, createVerificationCodeImpl } from "./code";
|
|
9
|
+
import { invalidateSessionsArgs, invalidateSessionsImpl } from "./invalidate";
|
|
10
|
+
import { userOAuthArgs, userOAuthImpl } from "./oauth";
|
|
11
|
+
import { refreshSessionArgs, refreshSessionImpl } from "./refresh";
|
|
12
|
+
import {
|
|
13
|
+
createAccountFromCredentialsArgs,
|
|
14
|
+
createAccountFromCredentialsImpl,
|
|
15
|
+
} from "./register";
|
|
16
|
+
import {
|
|
17
|
+
retrieveAccountWithCredentialsArgs,
|
|
18
|
+
retrieveAccountWithCredentialsImpl,
|
|
19
|
+
} from "./retrieve";
|
|
20
|
+
import { verifierSignatureArgs, verifierSignatureImpl } from "./signature";
|
|
21
|
+
import { signInArgs, signInImpl } from "./signin";
|
|
22
|
+
import { signOutImpl } from "./signout";
|
|
23
|
+
import { verifierImpl } from "./verifier";
|
|
24
|
+
import { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from "./verify";
|
|
25
|
+
|
|
26
|
+
export const storeArgs = v.object({
|
|
27
|
+
args: v.union(
|
|
28
|
+
v.object({
|
|
29
|
+
type: v.literal("signIn"),
|
|
30
|
+
...signInArgs.fields,
|
|
31
|
+
}),
|
|
32
|
+
v.object({
|
|
33
|
+
type: v.literal("signOut"),
|
|
34
|
+
}),
|
|
35
|
+
v.object({
|
|
36
|
+
type: v.literal("refreshSession"),
|
|
37
|
+
...refreshSessionArgs.fields,
|
|
38
|
+
}),
|
|
39
|
+
v.object({
|
|
40
|
+
type: v.literal("verifyCodeAndSignIn"),
|
|
41
|
+
...verifyCodeAndSignInArgs.fields,
|
|
42
|
+
}),
|
|
43
|
+
v.object({
|
|
44
|
+
type: v.literal("verifier"),
|
|
45
|
+
}),
|
|
46
|
+
v.object({
|
|
47
|
+
type: v.literal("verifierSignature"),
|
|
48
|
+
...verifierSignatureArgs.fields,
|
|
49
|
+
}),
|
|
50
|
+
v.object({
|
|
51
|
+
type: v.literal("userOAuth"),
|
|
52
|
+
...userOAuthArgs.fields,
|
|
53
|
+
}),
|
|
54
|
+
v.object({
|
|
55
|
+
type: v.literal("createVerificationCode"),
|
|
56
|
+
...createVerificationCodeArgs.fields,
|
|
57
|
+
}),
|
|
58
|
+
v.object({
|
|
59
|
+
type: v.literal("createAccountFromCredentials"),
|
|
60
|
+
...createAccountFromCredentialsArgs.fields,
|
|
61
|
+
}),
|
|
62
|
+
v.object({
|
|
63
|
+
type: v.literal("retrieveAccountWithCredentials"),
|
|
64
|
+
...retrieveAccountWithCredentialsArgs.fields,
|
|
65
|
+
}),
|
|
66
|
+
v.object({
|
|
67
|
+
type: v.literal("modifyAccount"),
|
|
68
|
+
...modifyAccountArgs.fields,
|
|
69
|
+
}),
|
|
70
|
+
v.object({
|
|
71
|
+
type: v.literal("invalidateSessions"),
|
|
72
|
+
...invalidateSessionsArgs.fields,
|
|
73
|
+
}),
|
|
74
|
+
),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const storeImpl = async (
|
|
78
|
+
ctx: MutationCtx,
|
|
79
|
+
fnArgs: Infer<typeof storeArgs>,
|
|
80
|
+
getProviderOrThrow: Provider.GetProviderOrThrowFunc,
|
|
81
|
+
config: Provider.Config,
|
|
82
|
+
) => {
|
|
83
|
+
const args = fnArgs.args;
|
|
84
|
+
logWithLevel(LOG_LEVELS.INFO, `\`auth:store\` type: ${args.type}`);
|
|
85
|
+
return Fx.run(
|
|
86
|
+
Fx.match(args, args.type, {
|
|
87
|
+
signIn: (a) =>
|
|
88
|
+
Fx.from({
|
|
89
|
+
ok: () => signInImpl(ctx, a, config),
|
|
90
|
+
err: (e) => e as never,
|
|
91
|
+
}),
|
|
92
|
+
signOut: () => signOutImpl(ctx, config),
|
|
93
|
+
refreshSession: (a) =>
|
|
94
|
+
Fx.from({
|
|
95
|
+
ok: () => refreshSessionImpl(ctx, a, getProviderOrThrow, config),
|
|
96
|
+
err: (e) => e as never,
|
|
97
|
+
}),
|
|
98
|
+
verifyCodeAndSignIn: (a) =>
|
|
99
|
+
Fx.from({
|
|
100
|
+
ok: () => verifyCodeAndSignInImpl(ctx, a, getProviderOrThrow, config),
|
|
101
|
+
err: (e) => e as never,
|
|
102
|
+
}),
|
|
103
|
+
verifier: () => verifierImpl(ctx, config),
|
|
104
|
+
verifierSignature: (a) =>
|
|
105
|
+
verifierSignatureImpl(ctx, a, config).pipe(
|
|
106
|
+
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
107
|
+
),
|
|
108
|
+
userOAuth: (a) =>
|
|
109
|
+
userOAuthImpl(ctx, a, getProviderOrThrow, config).pipe(
|
|
110
|
+
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
111
|
+
),
|
|
112
|
+
createVerificationCode: (a) =>
|
|
113
|
+
Fx.from({
|
|
114
|
+
ok: () =>
|
|
115
|
+
createVerificationCodeImpl(ctx, a, getProviderOrThrow, config),
|
|
116
|
+
err: (e) => e as never,
|
|
117
|
+
}),
|
|
118
|
+
createAccountFromCredentials: (a) =>
|
|
119
|
+
Fx.from({
|
|
120
|
+
ok: () =>
|
|
121
|
+
createAccountFromCredentialsImpl(
|
|
122
|
+
ctx,
|
|
123
|
+
a,
|
|
124
|
+
getProviderOrThrow,
|
|
125
|
+
config,
|
|
126
|
+
),
|
|
127
|
+
err: (e) => e as never,
|
|
128
|
+
}),
|
|
129
|
+
retrieveAccountWithCredentials: (a) =>
|
|
130
|
+
retrieveAccountWithCredentialsImpl(ctx, a, getProviderOrThrow, config),
|
|
131
|
+
modifyAccount: (a) =>
|
|
132
|
+
modifyAccountImpl(ctx, a, getProviderOrThrow, config).pipe(
|
|
133
|
+
Fx.recover((e) => Fx.fatal(e.toConvexError())),
|
|
134
|
+
),
|
|
135
|
+
invalidateSessions: (a) => invalidateSessionsImpl(ctx, a, config),
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
};
|
|
@@ -3,10 +3,10 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { GenericId } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import * as Provider from "../
|
|
6
|
+
import * as Provider from "../crypto";
|
|
7
7
|
import { getAuthSessionId } from "../sessions";
|
|
8
8
|
import { MutationCtx } from "../types";
|
|
9
|
-
import { AUTH_STORE_REF } from "./store";
|
|
9
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
10
10
|
|
|
11
11
|
type ReturnType = GenericId<"AuthVerifier">;
|
|
12
12
|
|
|
@@ -3,12 +3,12 @@ import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
|
3
3
|
import { Infer, v } from "convex/values";
|
|
4
4
|
|
|
5
5
|
import { authDb } from "../db";
|
|
6
|
-
import * as Provider from "../
|
|
6
|
+
import * as Provider from "../crypto";
|
|
7
7
|
import {
|
|
8
8
|
isSignInRateLimited,
|
|
9
9
|
recordFailedSignIn,
|
|
10
10
|
resetSignInRateLimit,
|
|
11
|
-
} from "../
|
|
11
|
+
} from "../limits";
|
|
12
12
|
import {
|
|
13
13
|
createNewAndDeleteExistingSession,
|
|
14
14
|
getAuthSessionId,
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
} from "../sessions";
|
|
17
17
|
import {
|
|
18
18
|
createSyntheticOAuthMaterializedConfig,
|
|
19
|
-
|
|
20
|
-
} from "../
|
|
19
|
+
} from "../enterprise/oidc";
|
|
20
|
+
import { isEnterpriseProviderId } from "../enterprise/shared";
|
|
21
21
|
import { MutationCtx, SessionInfo } from "../types";
|
|
22
22
|
import { upsertUserAndAccount } from "../users";
|
|
23
23
|
import { LOG_LEVELS, logWithLevel, sha256 } from "../utils";
|
|
24
24
|
import { requireEnv } from "../utils";
|
|
25
|
-
import { AUTH_STORE_REF } from "./store";
|
|
25
|
+
import { AUTH_STORE_REF } from "./store/refs";
|
|
26
26
|
|
|
27
27
|
export const verifyCodeAndSignInArgs = v.object({
|
|
28
28
|
params: v.any(),
|
package/src/server/oauth.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { Fx } from "@robelest/fx";
|
|
|
13
13
|
import * as arctic from "arctic";
|
|
14
14
|
|
|
15
15
|
import { SHARED_COOKIE_OPTIONS } from "./cookies";
|
|
16
|
-
import { AuthError } from "./
|
|
16
|
+
import { AuthError } from "./authError";
|
|
17
17
|
import type { OAuthProfile } from "./types";
|
|
18
18
|
import { logWithLevel } from "./utils";
|
|
19
19
|
import { isLocalHost } from "./utils";
|
package/src/server/passkey.ts
CHANGED
|
@@ -45,7 +45,9 @@ import {
|
|
|
45
45
|
import type { Fx as FxType } from "@robelest/fx";
|
|
46
46
|
|
|
47
47
|
import { authDb } from "./db";
|
|
48
|
-
import {
|
|
48
|
+
import { Fx } from "@robelest/fx";
|
|
49
|
+
|
|
50
|
+
import { AuthError } from "./authError";
|
|
49
51
|
import { userIdFromIdentitySubject } from "./identity";
|
|
50
52
|
import { callSignIn, callVerifier } from "./mutations/index";
|
|
51
53
|
import { callVerifierSignature } from "./mutations/signature";
|
|
@@ -780,6 +782,3 @@ export function handlePasskeyFx(
|
|
|
780
782
|
}),
|
|
781
783
|
);
|
|
782
784
|
}
|
|
783
|
-
|
|
784
|
-
// Keep backward-compatible export name — callers can migrate to handlePasskeyFx
|
|
785
|
-
export { handlePasskeyFx as handlePasskey };
|
package/src/server/redirects.ts
CHANGED
package/src/server/refresh.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Fx } from "@robelest/fx";
|
|
|
2
2
|
import { GenericId } from "convex/values";
|
|
3
3
|
|
|
4
4
|
import { authDb } from "./db";
|
|
5
|
-
import { AuthError } from "./
|
|
5
|
+
import { AuthError } from "./authError";
|
|
6
6
|
import { Doc, MutationCtx } from "./types";
|
|
7
7
|
import { ConvexAuthConfig } from "./types";
|
|
8
8
|
import {
|