@effect-auth/core 0.1.0-alpha.15 → 0.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +332 -131
- package/dist/AbuseProtection.d.ts +100 -0
- package/dist/AbuseProtection.d.ts.map +1 -0
- package/dist/AbuseProtection.js +71 -0
- package/dist/AbuseProtection.js.map +1 -0
- package/dist/AccessGrant.d.ts +344 -0
- package/dist/AccessGrant.d.ts.map +1 -0
- package/dist/AccessGrant.js +687 -0
- package/dist/AccessGrant.js.map +1 -0
- package/dist/ApiKey.d.ts +2 -14
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +36 -27
- package/dist/ApiKey.js.map +1 -1
- package/dist/Assurance.d.ts +415 -0
- package/dist/Assurance.d.ts.map +1 -0
- package/dist/Assurance.js +764 -0
- package/dist/Assurance.js.map +1 -0
- package/dist/AtomicPlanExecutor.d.ts +28 -0
- package/dist/AtomicPlanExecutor.d.ts.map +1 -0
- package/dist/AtomicPlanExecutor.js +5 -0
- package/dist/AtomicPlanExecutor.js.map +1 -0
- package/dist/AuditLog.d.ts +2314 -52
- package/dist/AuditLog.d.ts.map +1 -1
- package/dist/AuditLog.js +511 -33
- package/dist/AuditLog.js.map +1 -1
- package/dist/AuthConfig.d.ts.map +1 -1
- package/dist/AuthConfig.js.map +1 -1
- package/dist/AuthFlow.d.ts +326 -220
- package/dist/AuthFlow.d.ts.map +1 -1
- package/dist/AuthFlow.js +611 -263
- package/dist/AuthFlow.js.map +1 -1
- package/dist/AuthKernel.d.ts +1 -1
- package/dist/AuthRateLimit.d.ts +96 -0
- package/dist/AuthRateLimit.d.ts.map +1 -0
- package/dist/AuthRateLimit.js +212 -0
- package/dist/AuthRateLimit.js.map +1 -0
- package/dist/Challenge.d.ts +0 -3
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +1 -4
- package/dist/Challenge.js.map +1 -1
- package/dist/Client.d.ts +205 -10
- package/dist/Client.d.ts.map +1 -1
- package/dist/Client.js +397 -16
- package/dist/Client.js.map +1 -1
- package/dist/CloudflareTurnstile.d.ts +28 -0
- package/dist/CloudflareTurnstile.d.ts.map +1 -0
- package/dist/CloudflareTurnstile.js +205 -0
- package/dist/CloudflareTurnstile.js.map +1 -0
- package/dist/Crypto.d.ts +0 -3
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +5 -7
- package/dist/Crypto.js.map +1 -1
- package/dist/DelegatedAccessStorageMigrations.d.ts +7 -0
- package/dist/DelegatedAccessStorageMigrations.d.ts.map +1 -0
- package/dist/DelegatedAccessStorageMigrations.js +159 -0
- package/dist/DelegatedAccessStorageMigrations.js.map +1 -0
- package/dist/DisposableEmailDomains.d.ts +19 -0
- package/dist/DisposableEmailDomains.d.ts.map +1 -0
- package/dist/DisposableEmailDomains.js +85 -0
- package/dist/DisposableEmailDomains.js.map +1 -0
- package/dist/DomainVerification.d.ts +0 -9
- package/dist/DomainVerification.d.ts.map +1 -1
- package/dist/DomainVerification.js +36 -22
- package/dist/DomainVerification.js.map +1 -1
- package/dist/DrizzleBunSqliteStorage.d.ts +18 -0
- package/dist/DrizzleBunSqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleBunSqliteStorage.js +11 -0
- package/dist/DrizzleBunSqliteStorage.js.map +1 -0
- package/dist/DrizzleD1SqliteStorage.d.ts +28 -0
- package/dist/DrizzleD1SqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleD1SqliteStorage.js +10 -0
- package/dist/DrizzleD1SqliteStorage.js.map +1 -0
- package/dist/DrizzleDurableObjectSqliteStorage.d.ts +19 -0
- package/dist/DrizzleDurableObjectSqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleDurableObjectSqliteStorage.js +14 -0
- package/dist/DrizzleDurableObjectSqliteStorage.js.map +1 -0
- package/dist/DrizzleEffectSqliteStorage.d.ts +31 -0
- package/dist/DrizzleEffectSqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleEffectSqliteStorage.js +108 -0
- package/dist/DrizzleEffectSqliteStorage.js.map +1 -0
- package/dist/DrizzleNodeSqliteStorage.d.ts +18 -0
- package/dist/DrizzleNodeSqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleNodeSqliteStorage.js +11 -0
- package/dist/DrizzleNodeSqliteStorage.js.map +1 -0
- package/dist/DrizzleWasmSqliteStorage.d.ts +23 -0
- package/dist/DrizzleWasmSqliteStorage.d.ts.map +1 -0
- package/dist/DrizzleWasmSqliteStorage.js +15 -0
- package/dist/DrizzleWasmSqliteStorage.js.map +1 -0
- package/dist/EffectQbPostgresDelegatedAccessStorage.d.ts +34 -0
- package/dist/EffectQbPostgresDelegatedAccessStorage.d.ts.map +1 -0
- package/dist/EffectQbPostgresDelegatedAccessStorage.js +499 -0
- package/dist/EffectQbPostgresDelegatedAccessStorage.js.map +1 -0
- package/dist/EffectQbPostgresStorage.d.ts +171 -0
- package/dist/EffectQbPostgresStorage.d.ts.map +1 -0
- package/dist/EffectQbPostgresStorage.js +4280 -0
- package/dist/EffectQbPostgresStorage.js.map +1 -0
- package/dist/EffectQbSqliteDelegatedAccessStorage.d.ts +112 -0
- package/dist/EffectQbSqliteDelegatedAccessStorage.d.ts.map +1 -0
- package/dist/EffectQbSqliteDelegatedAccessStorage.js +602 -0
- package/dist/EffectQbSqliteDelegatedAccessStorage.js.map +1 -0
- package/dist/EffectQbSqliteStorage.d.ts +184 -27
- package/dist/EffectQbSqliteStorage.d.ts.map +1 -1
- package/dist/EffectQbSqliteStorage.js +1729 -135
- package/dist/EffectQbSqliteStorage.js.map +1 -1
- package/dist/EmailAuth.d.ts +65 -0
- package/dist/EmailAuth.d.ts.map +1 -0
- package/dist/EmailAuth.js +171 -0
- package/dist/EmailAuth.js.map +1 -0
- package/dist/EmailIdentityAuth.d.ts +30 -0
- package/dist/EmailIdentityAuth.d.ts.map +1 -0
- package/dist/EmailIdentityAuth.js +142 -0
- package/dist/EmailIdentityAuth.js.map +1 -0
- package/dist/EmailOtp.d.ts +10 -11
- package/dist/EmailOtp.d.ts.map +1 -1
- package/dist/EmailOtp.js +44 -81
- package/dist/EmailOtp.js.map +1 -1
- package/dist/EmailRisk.d.ts +48 -0
- package/dist/EmailRisk.d.ts.map +1 -0
- package/dist/EmailRisk.js +33 -0
- package/dist/EmailRisk.js.map +1 -0
- package/dist/EmailVerification.d.ts +10 -16
- package/dist/EmailVerification.d.ts.map +1 -1
- package/dist/EmailVerification.js +85 -42
- package/dist/EmailVerification.js.map +1 -1
- package/dist/Guard.d.ts +11 -0
- package/dist/Guard.d.ts.map +1 -0
- package/dist/Guard.js +11 -0
- package/dist/Guard.js.map +1 -0
- package/dist/HibpPwnedPasswords.d.ts +56 -0
- package/dist/HibpPwnedPasswords.d.ts.map +1 -0
- package/dist/HibpPwnedPasswords.js +232 -0
- package/dist/HibpPwnedPasswords.js.map +1 -0
- package/dist/HttpApi/AdminPermissionDefinition.d.ts +4 -0
- package/dist/HttpApi/AdminPermissionDefinition.d.ts.map +1 -0
- package/dist/HttpApi/AdminPermissionDefinition.js +4 -0
- package/dist/HttpApi/AdminPermissionDefinition.js.map +1 -0
- package/dist/HttpApi/AdminSecurityTimeline.d.ts +4 -0
- package/dist/HttpApi/AdminSecurityTimeline.d.ts.map +1 -0
- package/dist/HttpApi/AdminSecurityTimeline.js +4 -0
- package/dist/HttpApi/AdminSecurityTimeline.js.map +1 -0
- package/dist/HttpApi/AdminSession.d.ts +4 -0
- package/dist/HttpApi/AdminSession.d.ts.map +1 -0
- package/dist/HttpApi/AdminSession.js +4 -0
- package/dist/HttpApi/AdminSession.js.map +1 -0
- package/dist/HttpApi/AdminTrustedDevice.d.ts +4 -0
- package/dist/HttpApi/AdminTrustedDevice.d.ts.map +1 -0
- package/dist/HttpApi/AdminTrustedDevice.js +4 -0
- package/dist/HttpApi/AdminTrustedDevice.js.map +1 -0
- package/dist/HttpApi/Api.d.ts +1172 -1172
- package/dist/HttpApi/Api.d.ts.map +1 -1
- package/dist/HttpApi/Api.js +2160 -896
- package/dist/HttpApi/Api.js.map +1 -1
- package/dist/HttpApi/ApiKey.d.ts +4 -0
- package/dist/HttpApi/ApiKey.d.ts.map +1 -0
- package/dist/HttpApi/ApiKey.js +4 -0
- package/dist/HttpApi/ApiKey.js.map +1 -0
- package/dist/HttpApi/Audit.d.ts +6 -0
- package/dist/HttpApi/Audit.d.ts.map +1 -0
- package/dist/HttpApi/Audit.js +10 -0
- package/dist/HttpApi/Audit.js.map +1 -0
- package/dist/HttpApi/ClientApi.d.ts +917 -0
- package/dist/HttpApi/ClientApi.d.ts.map +1 -0
- package/dist/HttpApi/ClientApi.js +101 -0
- package/dist/HttpApi/ClientApi.js.map +1 -0
- package/dist/HttpApi/EmailAuth.d.ts +6 -0
- package/dist/HttpApi/EmailAuth.d.ts.map +1 -0
- package/dist/HttpApi/EmailAuth.js +6 -0
- package/dist/HttpApi/EmailAuth.js.map +1 -0
- package/dist/HttpApi/EmailGuards.d.ts +115 -0
- package/dist/HttpApi/EmailGuards.d.ts.map +1 -0
- package/dist/HttpApi/EmailGuards.js +191 -0
- package/dist/HttpApi/EmailGuards.js.map +1 -0
- package/dist/HttpApi/EmailOtp.d.ts +6 -0
- package/dist/HttpApi/EmailOtp.d.ts.map +1 -0
- package/dist/HttpApi/EmailOtp.js +6 -0
- package/dist/HttpApi/EmailOtp.js.map +1 -0
- package/dist/HttpApi/EmailVerification.d.ts +6 -0
- package/dist/HttpApi/EmailVerification.d.ts.map +1 -0
- package/dist/HttpApi/EmailVerification.js +6 -0
- package/dist/HttpApi/EmailVerification.js.map +1 -0
- package/dist/HttpApi/Endpoints.d.ts +629 -301
- package/dist/HttpApi/Endpoints.d.ts.map +1 -1
- package/dist/HttpApi/Endpoints.js +178 -120
- package/dist/HttpApi/Endpoints.js.map +1 -1
- package/dist/HttpApi/Errors.d.ts +26 -7
- package/dist/HttpApi/Errors.d.ts.map +1 -1
- package/dist/HttpApi/Errors.js +26 -4
- package/dist/HttpApi/Errors.js.map +1 -1
- package/dist/HttpApi/Identity.d.ts +6 -0
- package/dist/HttpApi/Identity.d.ts.map +1 -0
- package/dist/HttpApi/Identity.js +6 -0
- package/dist/HttpApi/Identity.js.map +1 -0
- package/dist/HttpApi/IdentityGuards.d.ts +31 -0
- package/dist/HttpApi/IdentityGuards.d.ts.map +1 -0
- package/dist/HttpApi/IdentityGuards.js +33 -0
- package/dist/HttpApi/IdentityGuards.js.map +1 -0
- package/dist/HttpApi/Jwt.d.ts +4 -0
- package/dist/HttpApi/Jwt.d.ts.map +1 -0
- package/dist/HttpApi/Jwt.js +4 -0
- package/dist/HttpApi/Jwt.js.map +1 -0
- package/dist/HttpApi/JwtDiscovery.d.ts +4 -0
- package/dist/HttpApi/JwtDiscovery.d.ts.map +1 -0
- package/dist/HttpApi/JwtDiscovery.js +4 -0
- package/dist/HttpApi/JwtDiscovery.js.map +1 -0
- package/dist/HttpApi/LoginApproval.d.ts +5 -0
- package/dist/HttpApi/LoginApproval.d.ts.map +1 -0
- package/dist/HttpApi/LoginApproval.js +5 -0
- package/dist/HttpApi/LoginApproval.js.map +1 -0
- package/dist/HttpApi/LoginNotification.d.ts +5 -0
- package/dist/HttpApi/LoginNotification.d.ts.map +1 -0
- package/dist/HttpApi/LoginNotification.js +5 -0
- package/dist/HttpApi/LoginNotification.js.map +1 -0
- package/dist/HttpApi/MagicLink.d.ts +6 -0
- package/dist/HttpApi/MagicLink.d.ts.map +1 -0
- package/dist/HttpApi/MagicLink.js +6 -0
- package/dist/HttpApi/MagicLink.js.map +1 -0
- package/dist/HttpApi/Mfa.d.ts +5 -0
- package/dist/HttpApi/Mfa.d.ts.map +1 -0
- package/dist/HttpApi/Mfa.js +5 -0
- package/dist/HttpApi/Mfa.js.map +1 -0
- package/dist/HttpApi/Middleware.d.ts +14 -0
- package/dist/HttpApi/Middleware.d.ts.map +1 -0
- package/dist/HttpApi/Middleware.js +5 -0
- package/dist/HttpApi/Middleware.js.map +1 -0
- package/dist/HttpApi/OAuth.d.ts +4 -0
- package/dist/HttpApi/OAuth.d.ts.map +1 -0
- package/dist/HttpApi/OAuth.js +4 -0
- package/dist/HttpApi/OAuth.js.map +1 -0
- package/dist/HttpApi/OAuthProviderAuthorization.d.ts +4 -0
- package/dist/HttpApi/OAuthProviderAuthorization.d.ts.map +1 -0
- package/dist/HttpApi/OAuthProviderAuthorization.js +4 -0
- package/dist/HttpApi/OAuthProviderAuthorization.js.map +1 -0
- package/dist/HttpApi/OAuthToken.d.ts +4 -0
- package/dist/HttpApi/OAuthToken.d.ts.map +1 -0
- package/dist/HttpApi/OAuthToken.js +4 -0
- package/dist/HttpApi/OAuthToken.js.map +1 -0
- package/dist/HttpApi/OidcDiscovery.d.ts +4 -0
- package/dist/HttpApi/OidcDiscovery.d.ts.map +1 -0
- package/dist/HttpApi/OidcDiscovery.js +4 -0
- package/dist/HttpApi/OidcDiscovery.js.map +1 -0
- package/dist/HttpApi/Operations/AdminPermissionDefinition.d.ts +28 -0
- package/dist/HttpApi/Operations/AdminPermissionDefinition.d.ts.map +1 -0
- package/dist/HttpApi/Operations/AdminPermissionDefinition.js +5 -0
- package/dist/HttpApi/Operations/AdminPermissionDefinition.js.map +1 -0
- package/dist/HttpApi/Operations/AdminSession.d.ts +16 -0
- package/dist/HttpApi/Operations/AdminSession.d.ts.map +1 -0
- package/dist/HttpApi/Operations/AdminSession.js +5 -0
- package/dist/HttpApi/Operations/AdminSession.js.map +1 -0
- package/dist/HttpApi/Operations/ApiKey.d.ts +16 -0
- package/dist/HttpApi/Operations/ApiKey.d.ts.map +1 -0
- package/dist/HttpApi/Operations/ApiKey.js +5 -0
- package/dist/HttpApi/Operations/ApiKey.js.map +1 -0
- package/dist/HttpApi/Operations/Discovery.d.ts +19 -0
- package/dist/HttpApi/Operations/Discovery.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Discovery.js +7 -0
- package/dist/HttpApi/Operations/Discovery.js.map +1 -0
- package/dist/HttpApi/Operations/EmailAuth.d.ts +12 -0
- package/dist/HttpApi/Operations/EmailAuth.d.ts.map +1 -0
- package/dist/HttpApi/Operations/EmailAuth.js +5 -0
- package/dist/HttpApi/Operations/EmailAuth.js.map +1 -0
- package/dist/HttpApi/Operations/EmailOtp.d.ts +14 -0
- package/dist/HttpApi/Operations/EmailOtp.d.ts.map +1 -0
- package/dist/HttpApi/Operations/EmailOtp.js +5 -0
- package/dist/HttpApi/Operations/EmailOtp.js.map +1 -0
- package/dist/HttpApi/Operations/EmailVerification.d.ts +14 -0
- package/dist/HttpApi/Operations/EmailVerification.d.ts.map +1 -0
- package/dist/HttpApi/Operations/EmailVerification.js +5 -0
- package/dist/HttpApi/Operations/EmailVerification.js.map +1 -0
- package/dist/HttpApi/Operations/HttpOperation.d.ts +4 -0
- package/dist/HttpApi/Operations/HttpOperation.d.ts.map +1 -0
- package/dist/HttpApi/Operations/HttpOperation.js +2 -0
- package/dist/HttpApi/Operations/HttpOperation.js.map +1 -0
- package/dist/HttpApi/Operations/Identity.d.ts +22 -0
- package/dist/HttpApi/Operations/Identity.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Identity.js +5 -0
- package/dist/HttpApi/Operations/Identity.js.map +1 -0
- package/dist/HttpApi/Operations/Jwt.d.ts +14 -0
- package/dist/HttpApi/Operations/Jwt.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Jwt.js +5 -0
- package/dist/HttpApi/Operations/Jwt.js.map +1 -0
- package/dist/HttpApi/Operations/LoginApproval.d.ts +16 -0
- package/dist/HttpApi/Operations/LoginApproval.d.ts.map +1 -0
- package/dist/HttpApi/Operations/LoginApproval.js +5 -0
- package/dist/HttpApi/Operations/LoginApproval.js.map +1 -0
- package/dist/HttpApi/Operations/MagicLink.d.ts +14 -0
- package/dist/HttpApi/Operations/MagicLink.d.ts.map +1 -0
- package/dist/HttpApi/Operations/MagicLink.js +5 -0
- package/dist/HttpApi/Operations/MagicLink.js.map +1 -0
- package/dist/HttpApi/Operations/Mfa.d.ts +24 -0
- package/dist/HttpApi/Operations/Mfa.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Mfa.js +5 -0
- package/dist/HttpApi/Operations/Mfa.js.map +1 -0
- package/dist/HttpApi/Operations/OAuth.d.ts +20 -0
- package/dist/HttpApi/Operations/OAuth.d.ts.map +1 -0
- package/dist/HttpApi/Operations/OAuth.js +5 -0
- package/dist/HttpApi/Operations/OAuth.js.map +1 -0
- package/dist/HttpApi/Operations/OAuthProviderAuthorization.d.ts +12 -0
- package/dist/HttpApi/Operations/OAuthProviderAuthorization.d.ts.map +1 -0
- package/dist/HttpApi/Operations/OAuthProviderAuthorization.js +5 -0
- package/dist/HttpApi/Operations/OAuthProviderAuthorization.js.map +1 -0
- package/dist/HttpApi/Operations/OAuthToken.d.ts +16 -0
- package/dist/HttpApi/Operations/OAuthToken.d.ts.map +1 -0
- package/dist/HttpApi/Operations/OAuthToken.js +5 -0
- package/dist/HttpApi/Operations/OAuthToken.js.map +1 -0
- package/dist/HttpApi/Operations/Passkey.d.ts +22 -0
- package/dist/HttpApi/Operations/Passkey.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Passkey.js +5 -0
- package/dist/HttpApi/Operations/Passkey.js.map +1 -0
- package/dist/HttpApi/Operations/Password.d.ts +22 -0
- package/dist/HttpApi/Operations/Password.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Password.js +5 -0
- package/dist/HttpApi/Operations/Password.js.map +1 -0
- package/dist/HttpApi/Operations/RecoveryCodes.d.ts +20 -0
- package/dist/HttpApi/Operations/RecoveryCodes.d.ts.map +1 -0
- package/dist/HttpApi/Operations/RecoveryCodes.js +5 -0
- package/dist/HttpApi/Operations/RecoveryCodes.js.map +1 -0
- package/dist/HttpApi/Operations/RefreshToken.d.ts +12 -0
- package/dist/HttpApi/Operations/RefreshToken.d.ts.map +1 -0
- package/dist/HttpApi/Operations/RefreshToken.js +5 -0
- package/dist/HttpApi/Operations/RefreshToken.js.map +1 -0
- package/dist/HttpApi/Operations/Security.d.ts +12 -0
- package/dist/HttpApi/Operations/Security.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Security.js +5 -0
- package/dist/HttpApi/Operations/Security.js.map +1 -0
- package/dist/HttpApi/Operations/SecurityTimeline.d.ts +19 -0
- package/dist/HttpApi/Operations/SecurityTimeline.d.ts.map +1 -0
- package/dist/HttpApi/Operations/SecurityTimeline.js +7 -0
- package/dist/HttpApi/Operations/SecurityTimeline.js.map +1 -0
- package/dist/HttpApi/Operations/Session.d.ts +22 -0
- package/dist/HttpApi/Operations/Session.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Session.js +5 -0
- package/dist/HttpApi/Operations/Session.js.map +1 -0
- package/dist/HttpApi/Operations/StepUp.d.ts +22 -0
- package/dist/HttpApi/Operations/StepUp.d.ts.map +1 -0
- package/dist/HttpApi/Operations/StepUp.js +5 -0
- package/dist/HttpApi/Operations/StepUp.js.map +1 -0
- package/dist/HttpApi/Operations/Totp.d.ts +20 -0
- package/dist/HttpApi/Operations/Totp.d.ts.map +1 -0
- package/dist/HttpApi/Operations/Totp.js +5 -0
- package/dist/HttpApi/Operations/Totp.js.map +1 -0
- package/dist/HttpApi/Operations/TrustedDevice.d.ts +23 -0
- package/dist/HttpApi/Operations/TrustedDevice.d.ts.map +1 -0
- package/dist/HttpApi/Operations/TrustedDevice.js +7 -0
- package/dist/HttpApi/Operations/TrustedDevice.js.map +1 -0
- package/dist/HttpApi/Operations/index.d.ts +27 -0
- package/dist/HttpApi/Operations/index.d.ts.map +1 -0
- package/dist/HttpApi/Operations/index.js +27 -0
- package/dist/HttpApi/Operations/index.js.map +1 -0
- package/dist/HttpApi/Passkey.d.ts +5 -0
- package/dist/HttpApi/Passkey.d.ts.map +1 -0
- package/dist/HttpApi/Passkey.js +5 -0
- package/dist/HttpApi/Passkey.js.map +1 -0
- package/dist/HttpApi/Password.d.ts +220 -0
- package/dist/HttpApi/Password.d.ts.map +1 -0
- package/dist/HttpApi/Password.js +237 -0
- package/dist/HttpApi/Password.js.map +1 -0
- package/dist/HttpApi/PasswordContract.d.ts +307 -0
- package/dist/HttpApi/PasswordContract.d.ts.map +1 -0
- package/dist/HttpApi/PasswordContract.js +63 -0
- package/dist/HttpApi/PasswordContract.js.map +1 -0
- package/dist/HttpApi/PasswordGuards.d.ts +82 -0
- package/dist/HttpApi/PasswordGuards.d.ts.map +1 -0
- package/dist/HttpApi/PasswordGuards.js +179 -0
- package/dist/HttpApi/PasswordGuards.js.map +1 -0
- package/dist/HttpApi/RecoveryCodes.d.ts +5 -0
- package/dist/HttpApi/RecoveryCodes.d.ts.map +1 -0
- package/dist/HttpApi/RecoveryCodes.js +5 -0
- package/dist/HttpApi/RecoveryCodes.js.map +1 -0
- package/dist/HttpApi/RefreshToken.d.ts +4 -0
- package/dist/HttpApi/RefreshToken.d.ts.map +1 -0
- package/dist/HttpApi/RefreshToken.js +4 -0
- package/dist/HttpApi/RefreshToken.js.map +1 -0
- package/dist/HttpApi/RequestGuards.d.ts +42 -0
- package/dist/HttpApi/RequestGuards.d.ts.map +1 -0
- package/dist/HttpApi/RequestGuards.js +194 -0
- package/dist/HttpApi/RequestGuards.js.map +1 -0
- package/dist/HttpApi/Schemas.d.ts +361 -84
- package/dist/HttpApi/Schemas.d.ts.map +1 -1
- package/dist/HttpApi/Schemas.js +190 -27
- package/dist/HttpApi/Schemas.js.map +1 -1
- package/dist/HttpApi/Security.d.ts +12 -93
- package/dist/HttpApi/Security.d.ts.map +1 -1
- package/dist/HttpApi/Security.js +65 -356
- package/dist/HttpApi/Security.js.map +1 -1
- package/dist/HttpApi/SecurityTimeline.d.ts +4 -0
- package/dist/HttpApi/SecurityTimeline.d.ts.map +1 -0
- package/dist/HttpApi/SecurityTimeline.js +4 -0
- package/dist/HttpApi/SecurityTimeline.js.map +1 -0
- package/dist/HttpApi/Session.d.ts +5 -0
- package/dist/HttpApi/Session.d.ts.map +1 -0
- package/dist/HttpApi/Session.js +5 -0
- package/dist/HttpApi/Session.js.map +1 -0
- package/dist/HttpApi/SessionGuards.d.ts +15 -0
- package/dist/HttpApi/SessionGuards.d.ts.map +1 -0
- package/dist/HttpApi/SessionGuards.js +37 -0
- package/dist/HttpApi/SessionGuards.js.map +1 -0
- package/dist/HttpApi/StepUp.d.ts +5 -0
- package/dist/HttpApi/StepUp.d.ts.map +1 -0
- package/dist/HttpApi/StepUp.js +5 -0
- package/dist/HttpApi/StepUp.js.map +1 -0
- package/dist/HttpApi/Totp.d.ts +5 -0
- package/dist/HttpApi/Totp.d.ts.map +1 -0
- package/dist/HttpApi/Totp.js +5 -0
- package/dist/HttpApi/Totp.js.map +1 -0
- package/dist/HttpApi/Transport.d.ts +4 -6
- package/dist/HttpApi/Transport.d.ts.map +1 -1
- package/dist/HttpApi/Transport.js +62 -36
- package/dist/HttpApi/Transport.js.map +1 -1
- package/dist/HttpApi/TrustedDevice.d.ts +4 -0
- package/dist/HttpApi/TrustedDevice.d.ts.map +1 -0
- package/dist/HttpApi/TrustedDevice.js +4 -0
- package/dist/HttpApi/TrustedDevice.js.map +1 -0
- package/dist/HttpApi/index.d.ts +9 -3
- package/dist/HttpApi/index.d.ts.map +1 -1
- package/dist/HttpApi/index.js +8 -2
- package/dist/HttpApi/index.js.map +1 -1
- package/dist/Identity.d.ts +138 -0
- package/dist/Identity.d.ts.map +1 -0
- package/dist/Identity.js +105 -0
- package/dist/Identity.js.map +1 -0
- package/dist/IdentityManagement.d.ts +189 -0
- package/dist/IdentityManagement.d.ts.map +1 -0
- package/dist/IdentityManagement.js +317 -0
- package/dist/IdentityManagement.js.map +1 -0
- package/dist/IncidentAction.d.ts +1 -4
- package/dist/IncidentAction.d.ts.map +1 -1
- package/dist/IncidentAction.js +15 -9
- package/dist/IncidentAction.js.map +1 -1
- package/dist/Internal.d.ts +2 -0
- package/dist/Internal.d.ts.map +1 -1
- package/dist/Internal.js +30 -0
- package/dist/Internal.js.map +1 -1
- package/dist/Invitation.d.ts +362 -0
- package/dist/Invitation.d.ts.map +1 -0
- package/dist/Invitation.js +633 -0
- package/dist/Invitation.js.map +1 -0
- package/dist/IpQualityScore.d.ts +38 -0
- package/dist/IpQualityScore.d.ts.map +1 -0
- package/dist/IpQualityScore.js +215 -0
- package/dist/IpQualityScore.js.map +1 -0
- package/dist/Jwt.d.ts +9 -30
- package/dist/Jwt.d.ts.map +1 -1
- package/dist/Jwt.js +72 -60
- package/dist/Jwt.js.map +1 -1
- package/dist/LoginApproval.d.ts +16 -31
- package/dist/LoginApproval.d.ts.map +1 -1
- package/dist/LoginApproval.js +47 -41
- package/dist/LoginApproval.js.map +1 -1
- package/dist/LoginNotification.d.ts +8 -12
- package/dist/LoginNotification.d.ts.map +1 -1
- package/dist/LoginNotification.js +30 -17
- package/dist/LoginNotification.js.map +1 -1
- package/dist/LoginRisk.d.ts +11 -13
- package/dist/LoginRisk.d.ts.map +1 -1
- package/dist/LoginRisk.js +66 -26
- package/dist/LoginRisk.js.map +1 -1
- package/dist/LoginRiskEnrichment.d.ts +145 -0
- package/dist/LoginRiskEnrichment.d.ts.map +1 -0
- package/dist/LoginRiskEnrichment.js +220 -0
- package/dist/LoginRiskEnrichment.js.map +1 -0
- package/dist/MachineAuth.d.ts.map +1 -1
- package/dist/MachineAuth.js.map +1 -1
- package/dist/MagicLink.d.ts +9 -8
- package/dist/MagicLink.d.ts.map +1 -1
- package/dist/MagicLink.js +40 -73
- package/dist/MagicLink.js.map +1 -1
- package/dist/Mailer.d.ts +20 -13
- package/dist/Mailer.d.ts.map +1 -1
- package/dist/Mailer.js +10 -12
- package/dist/Mailer.js.map +1 -1
- package/dist/OAuth.d.ts +100 -103
- package/dist/OAuth.d.ts.map +1 -1
- package/dist/OAuth.js +404 -217
- package/dist/OAuth.js.map +1 -1
- package/dist/Passkey.d.ts +17 -19
- package/dist/Passkey.d.ts.map +1 -1
- package/dist/Passkey.js +86 -39
- package/dist/Passkey.js.map +1 -1
- package/dist/PasskeyBrowser.d.ts +39 -0
- package/dist/PasskeyBrowser.d.ts.map +1 -0
- package/dist/PasskeyBrowser.js +206 -0
- package/dist/PasskeyBrowser.js.map +1 -0
- package/dist/PasskeySimpleWebAuthn.d.ts.map +1 -1
- package/dist/PasskeySimpleWebAuthn.js +19 -7
- package/dist/PasskeySimpleWebAuthn.js.map +1 -1
- package/dist/Password.d.ts +71 -37
- package/dist/Password.d.ts.map +1 -1
- package/dist/Password.js +296 -82
- package/dist/Password.js.map +1 -1
- package/dist/PasswordRisk.d.ts +63 -0
- package/dist/PasswordRisk.d.ts.map +1 -0
- package/dist/PasswordRisk.js +37 -0
- package/dist/PasswordRisk.js.map +1 -0
- package/dist/Permission.d.ts +308 -0
- package/dist/Permission.d.ts.map +1 -0
- package/dist/Permission.js +827 -0
- package/dist/Permission.js.map +1 -0
- package/dist/Policy.d.ts +31 -18
- package/dist/Policy.d.ts.map +1 -1
- package/dist/Policy.js +58 -14
- package/dist/Policy.js.map +1 -1
- package/dist/PostgresDelegatedAccessStorageMigrations.d.ts +7 -0
- package/dist/PostgresDelegatedAccessStorageMigrations.d.ts.map +1 -0
- package/dist/PostgresDelegatedAccessStorageMigrations.js +119 -0
- package/dist/PostgresDelegatedAccessStorageMigrations.js.map +1 -0
- package/dist/PostgresStorageMigrations.d.ts +15 -0
- package/dist/PostgresStorageMigrations.d.ts.map +1 -0
- package/dist/PostgresStorageMigrations.js +620 -0
- package/dist/PostgresStorageMigrations.js.map +1 -0
- package/dist/Privacy.d.ts +0 -3
- package/dist/Privacy.d.ts.map +1 -1
- package/dist/Privacy.js +2 -5
- package/dist/Privacy.js.map +1 -1
- package/dist/RateLimiter.d.ts +0 -3
- package/dist/RateLimiter.d.ts.map +1 -1
- package/dist/RateLimiter.js +1 -4
- package/dist/RateLimiter.js.map +1 -1
- package/dist/RecoveryCode.d.ts +84 -12
- package/dist/RecoveryCode.d.ts.map +1 -1
- package/dist/RecoveryCode.js +273 -75
- package/dist/RecoveryCode.js.map +1 -1
- package/dist/RecoveryPolicy.d.ts +81 -0
- package/dist/RecoveryPolicy.d.ts.map +1 -0
- package/dist/RecoveryPolicy.js +119 -0
- package/dist/RecoveryPolicy.js.map +1 -0
- package/dist/RefreshToken.d.ts +1 -10
- package/dist/RefreshToken.d.ts.map +1 -1
- package/dist/RefreshToken.js +31 -22
- package/dist/RefreshToken.js.map +1 -1
- package/dist/Retention.d.ts.map +1 -1
- package/dist/Retention.js.map +1 -1
- package/dist/SecurityTimeline.d.ts +1 -4
- package/dist/SecurityTimeline.d.ts.map +1 -1
- package/dist/SecurityTimeline.js +110 -17
- package/dist/SecurityTimeline.js.map +1 -1
- package/dist/Sessions.d.ts +124 -29
- package/dist/Sessions.d.ts.map +1 -1
- package/dist/Sessions.js +626 -94
- package/dist/Sessions.js.map +1 -1
- package/dist/StepUp.d.ts +132 -11
- package/dist/StepUp.d.ts.map +1 -1
- package/dist/StepUp.js +387 -19
- package/dist/StepUp.js.map +1 -1
- package/dist/Storage.d.ts +89 -23
- package/dist/Storage.d.ts.map +1 -1
- package/dist/Storage.js +10 -12
- package/dist/Storage.js.map +1 -1
- package/dist/StorageMigrations.d.ts +6 -1
- package/dist/StorageMigrations.d.ts.map +1 -1
- package/dist/StorageMigrations.js +224 -0
- package/dist/StorageMigrations.js.map +1 -1
- package/dist/StorageSchemaGenerator.d.ts +486 -0
- package/dist/StorageSchemaGenerator.d.ts.map +1 -0
- package/dist/StorageSchemaGenerator.js +1022 -0
- package/dist/StorageSchemaGenerator.js.map +1 -0
- package/dist/StrongFactor.d.ts +64 -0
- package/dist/StrongFactor.d.ts.map +1 -0
- package/dist/StrongFactor.js +100 -0
- package/dist/StrongFactor.js.map +1 -0
- package/dist/Testing.d.ts +1 -1
- package/dist/Testing.js +2 -2
- package/dist/Testing.js.map +1 -1
- package/dist/Totp.d.ts +88 -13
- package/dist/Totp.d.ts.map +1 -1
- package/dist/Totp.js +194 -36
- package/dist/Totp.js.map +1 -1
- package/dist/TrustedDevice.d.ts +0 -9
- package/dist/TrustedDevice.d.ts.map +1 -1
- package/dist/TrustedDevice.js +15 -17
- package/dist/TrustedDevice.js.map +1 -1
- package/dist/WaitUntil.d.ts +0 -3
- package/dist/WaitUntil.d.ts.map +1 -1
- package/dist/WaitUntil.js +1 -4
- package/dist/WaitUntil.js.map +1 -1
- package/dist/Webhook.d.ts +42 -12
- package/dist/Webhook.d.ts.map +1 -1
- package/dist/Webhook.js +165 -26
- package/dist/Webhook.js.map +1 -1
- package/dist/alchemy/cloudflare/Email.d.ts +4 -4
- package/dist/alchemy/cloudflare/Email.d.ts.map +1 -1
- package/dist/alchemy/cloudflare/Email.js +10 -5
- package/dist/alchemy/cloudflare/Email.js.map +1 -1
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts +4 -4
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts.map +1 -1
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js +5 -4
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js.map +1 -1
- package/dist/cloudflare/Email.d.ts.map +1 -1
- package/dist/cloudflare/Email.js +1 -1
- package/dist/cloudflare/Email.js.map +1 -1
- package/dist/cloudflare/RateLimitDurableObject.d.ts +6 -5
- package/dist/cloudflare/RateLimitDurableObject.d.ts.map +1 -1
- package/dist/cloudflare/RateLimitDurableObject.js.map +1 -1
- package/dist/cloudflare/RequestMetadata.d.ts +49 -0
- package/dist/cloudflare/RequestMetadata.d.ts.map +1 -0
- package/dist/cloudflare/RequestMetadata.js +71 -0
- package/dist/cloudflare/RequestMetadata.js.map +1 -0
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/AuthFlowFinalizer.d.ts +31 -0
- package/dist/internal/AuthFlowFinalizer.d.ts.map +1 -0
- package/dist/internal/AuthFlowFinalizer.js +182 -0
- package/dist/internal/AuthFlowFinalizer.js.map +1 -0
- package/dist/internal/RateLimitDurableObject.d.ts.map +1 -1
- package/dist/internal/RateLimitDurableObject.js +3 -0
- package/dist/internal/RateLimitDurableObject.js.map +1 -1
- package/migrations/0001_auth_storage.sql +1 -0
- package/migrations/0006_auth_totp_factor.sql +1 -0
- package/migrations/0024_auth_permission.sql +39 -0
- package/migrations/0025_auth_permission_definition.sql +19 -0
- package/migrations/0026_auth_user_identity.sql +59 -0
- package/migrations/0027_auth_audit_log_storage_order.sql +46 -0
- package/migrations/0028_auth_oauth_client_secret_key.sql +39 -0
- package/migrations/delegated-access/0001_auth_delegated_access.sql +152 -0
- package/migrations/postgres/0001_auth_core.sql +77 -0
- package/migrations/postgres/0002_auth_security_oauth.sql +65 -0
- package/migrations/postgres/0003_auth_credentials_tokens.sql +43 -0
- package/migrations/postgres/0004_auth_security_history.sql +103 -0
- package/migrations/postgres/0005_auth_webhooks.sql +29 -0
- package/migrations/postgres/0006_auth_domain_timeline.sql +50 -0
- package/migrations/postgres/0007_auth_oauth_clients.sql +85 -0
- package/migrations/postgres/0008_auth_oauth_tokens.sql +63 -0
- package/migrations/postgres/0009_auth_permissions.sql +66 -0
- package/migrations/postgres/delegated-access/0001_auth_delegated_access.sql +112 -0
- package/package.json +309 -2
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
export const postgresAuthStorageMigration001 = {
|
|
2
|
+
id: "0001_auth_core",
|
|
3
|
+
sql: `create table auth_user (
|
|
4
|
+
id text constraint auth_user_pkey primary key,
|
|
5
|
+
created_at bigint not null,
|
|
6
|
+
updated_at bigint not null,
|
|
7
|
+
disabled_at bigint,
|
|
8
|
+
metadata jsonb
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
create table auth_user_identity (
|
|
12
|
+
id text constraint auth_user_identity_pkey primary key,
|
|
13
|
+
user_id text not null,
|
|
14
|
+
scope_type text not null,
|
|
15
|
+
scope_id text not null,
|
|
16
|
+
kind text not null,
|
|
17
|
+
value text not null,
|
|
18
|
+
normalized_value text not null,
|
|
19
|
+
verified_at bigint,
|
|
20
|
+
is_primary_login boolean not null default false,
|
|
21
|
+
created_at bigint not null,
|
|
22
|
+
updated_at bigint not null,
|
|
23
|
+
revoked_at bigint,
|
|
24
|
+
replaced_by_id text,
|
|
25
|
+
metadata jsonb
|
|
26
|
+
);
|
|
27
|
+
create unique index auth_user_identity_active_value_idx
|
|
28
|
+
on auth_user_identity (scope_type, scope_id, kind, normalized_value)
|
|
29
|
+
where revoked_at is null;
|
|
30
|
+
create unique index auth_user_identity_active_primary_idx
|
|
31
|
+
on auth_user_identity (user_id) where revoked_at is null and is_primary_login;
|
|
32
|
+
create index auth_user_identity_user_id_idx on auth_user_identity (user_id);
|
|
33
|
+
create index auth_user_identity_replaced_by_id_idx on auth_user_identity (replaced_by_id);
|
|
34
|
+
|
|
35
|
+
create table auth_credential (
|
|
36
|
+
id text constraint auth_credential_pkey primary key,
|
|
37
|
+
user_id text not null,
|
|
38
|
+
type text not null,
|
|
39
|
+
password_hash text,
|
|
40
|
+
created_at bigint not null,
|
|
41
|
+
updated_at bigint not null,
|
|
42
|
+
revoked_at bigint,
|
|
43
|
+
metadata jsonb,
|
|
44
|
+
constraint auth_credential_user_type_key unique (user_id, type)
|
|
45
|
+
);
|
|
46
|
+
create index auth_credential_user_id_idx on auth_credential (user_id);
|
|
47
|
+
|
|
48
|
+
create table auth_session (
|
|
49
|
+
id text constraint auth_session_pkey primary key,
|
|
50
|
+
user_id text not null,
|
|
51
|
+
secret_hash text not null,
|
|
52
|
+
created_at bigint not null,
|
|
53
|
+
expires_at bigint not null,
|
|
54
|
+
auth_time bigint not null,
|
|
55
|
+
authentication_events jsonb not null,
|
|
56
|
+
aal text not null,
|
|
57
|
+
amr jsonb not null,
|
|
58
|
+
claims jsonb,
|
|
59
|
+
mfa_verified_at bigint,
|
|
60
|
+
metadata jsonb,
|
|
61
|
+
revoked_at bigint,
|
|
62
|
+
last_seen_at bigint,
|
|
63
|
+
rotated_at bigint
|
|
64
|
+
);
|
|
65
|
+
create index auth_session_user_id_idx on auth_session (user_id);
|
|
66
|
+
create index auth_session_expires_at_idx on auth_session (expires_at);
|
|
67
|
+
|
|
68
|
+
create table auth_verification (
|
|
69
|
+
id text constraint auth_verification_pkey primary key,
|
|
70
|
+
type text not null,
|
|
71
|
+
subject text not null,
|
|
72
|
+
secret_hash text,
|
|
73
|
+
created_at bigint not null,
|
|
74
|
+
expires_at bigint not null,
|
|
75
|
+
metadata jsonb,
|
|
76
|
+
consumed_at bigint
|
|
77
|
+
);
|
|
78
|
+
create index auth_verification_type_subject_idx on auth_verification (type, subject);
|
|
79
|
+
create index auth_verification_expires_at_idx on auth_verification (expires_at);`,
|
|
80
|
+
};
|
|
81
|
+
export const postgresAuthStorageMigration002 = {
|
|
82
|
+
id: "0002_auth_security_oauth",
|
|
83
|
+
sql: `create table auth_totp_factor (
|
|
84
|
+
id text constraint auth_totp_factor_pkey primary key,
|
|
85
|
+
user_id text not null,
|
|
86
|
+
secret text not null,
|
|
87
|
+
algorithm text not null,
|
|
88
|
+
digits integer not null,
|
|
89
|
+
period integer not null,
|
|
90
|
+
created_at bigint not null,
|
|
91
|
+
confirmed_at bigint,
|
|
92
|
+
last_used_at bigint,
|
|
93
|
+
last_accepted_counter bigint,
|
|
94
|
+
revoked_at bigint,
|
|
95
|
+
metadata jsonb
|
|
96
|
+
);
|
|
97
|
+
create index auth_totp_factor_user_id_idx on auth_totp_factor (user_id);
|
|
98
|
+
create index auth_totp_factor_active_idx on auth_totp_factor (user_id, created_at, id)
|
|
99
|
+
where revoked_at is null and confirmed_at is not null;
|
|
100
|
+
|
|
101
|
+
create table auth_recovery_code (
|
|
102
|
+
id text constraint auth_recovery_code_pkey primary key,
|
|
103
|
+
user_id text not null,
|
|
104
|
+
code_hash text not null,
|
|
105
|
+
created_at bigint not null,
|
|
106
|
+
used_at bigint,
|
|
107
|
+
revoked_at bigint,
|
|
108
|
+
metadata jsonb
|
|
109
|
+
);
|
|
110
|
+
create index auth_recovery_code_user_id_idx on auth_recovery_code (user_id);
|
|
111
|
+
create index auth_recovery_code_active_idx on auth_recovery_code (user_id, created_at, id)
|
|
112
|
+
where used_at is null and revoked_at is null;
|
|
113
|
+
|
|
114
|
+
create table auth_refresh_token (
|
|
115
|
+
id text constraint auth_refresh_token_pkey primary key,
|
|
116
|
+
family_id text not null,
|
|
117
|
+
user_id text not null,
|
|
118
|
+
secret_hash text not null,
|
|
119
|
+
created_at bigint not null,
|
|
120
|
+
expires_at bigint not null,
|
|
121
|
+
last_used_at bigint,
|
|
122
|
+
rotated_at bigint,
|
|
123
|
+
replaced_by_id text,
|
|
124
|
+
revoked_at bigint,
|
|
125
|
+
reuse_detected_at bigint,
|
|
126
|
+
metadata jsonb,
|
|
127
|
+
constraint auth_refresh_token_secret_hash_key unique (secret_hash)
|
|
128
|
+
);
|
|
129
|
+
create index auth_refresh_token_family_id_idx on auth_refresh_token (family_id, created_at, id);
|
|
130
|
+
create index auth_refresh_token_user_id_idx on auth_refresh_token (user_id, created_at, id);
|
|
131
|
+
create index auth_refresh_token_expires_at_idx on auth_refresh_token (expires_at);
|
|
132
|
+
|
|
133
|
+
create table auth_oauth_account (
|
|
134
|
+
id text constraint auth_oauth_account_pkey primary key,
|
|
135
|
+
provider_id text not null,
|
|
136
|
+
provider_account_id text not null,
|
|
137
|
+
user_id text not null,
|
|
138
|
+
email text,
|
|
139
|
+
email_verified boolean,
|
|
140
|
+
created_at bigint not null,
|
|
141
|
+
updated_at bigint not null,
|
|
142
|
+
unlinked_at bigint,
|
|
143
|
+
metadata jsonb,
|
|
144
|
+
constraint auth_oauth_account_provider_account_key unique (provider_id, provider_account_id)
|
|
145
|
+
);
|
|
146
|
+
create index auth_oauth_account_user_id_idx on auth_oauth_account (user_id, created_at, id);
|
|
147
|
+
create index auth_oauth_account_unlinked_at_idx on auth_oauth_account (unlinked_at);`,
|
|
148
|
+
};
|
|
149
|
+
export const postgresAuthStorageMigration003 = {
|
|
150
|
+
id: "0003_auth_credentials_tokens",
|
|
151
|
+
sql: `create table auth_passkey_credential (
|
|
152
|
+
id text constraint auth_passkey_credential_pkey primary key,
|
|
153
|
+
user_id text not null,
|
|
154
|
+
credential_id text not null,
|
|
155
|
+
public_key text not null,
|
|
156
|
+
sign_count bigint not null,
|
|
157
|
+
transports jsonb,
|
|
158
|
+
backed_up boolean,
|
|
159
|
+
created_at bigint not null,
|
|
160
|
+
last_used_at bigint,
|
|
161
|
+
revoked_at bigint,
|
|
162
|
+
metadata jsonb,
|
|
163
|
+
constraint auth_passkey_credential_credential_id_key unique (credential_id)
|
|
164
|
+
);
|
|
165
|
+
create index auth_passkey_credential_user_id_idx
|
|
166
|
+
on auth_passkey_credential (user_id, created_at, id);
|
|
167
|
+
create index auth_passkey_credential_revoked_at_idx
|
|
168
|
+
on auth_passkey_credential (revoked_at);
|
|
169
|
+
|
|
170
|
+
create table auth_api_key (
|
|
171
|
+
id text constraint auth_api_key_pkey primary key,
|
|
172
|
+
user_id text not null,
|
|
173
|
+
prefix text not null,
|
|
174
|
+
secret_hash text not null,
|
|
175
|
+
scopes jsonb not null,
|
|
176
|
+
created_at bigint not null,
|
|
177
|
+
expires_at bigint,
|
|
178
|
+
last_used_at bigint,
|
|
179
|
+
revoked_at bigint,
|
|
180
|
+
metadata jsonb,
|
|
181
|
+
constraint auth_api_key_prefix_key unique (prefix)
|
|
182
|
+
);
|
|
183
|
+
create index auth_api_key_user_id_idx on auth_api_key (user_id, created_at, id);
|
|
184
|
+
create index auth_api_key_expires_at_idx on auth_api_key (expires_at);
|
|
185
|
+
create index auth_api_key_revoked_at_idx on auth_api_key (revoked_at);
|
|
186
|
+
|
|
187
|
+
create table auth_jwt_revocation (
|
|
188
|
+
jwt_id text constraint auth_jwt_revocation_pkey primary key,
|
|
189
|
+
revoked_at bigint not null,
|
|
190
|
+
expires_at bigint,
|
|
191
|
+
reason text
|
|
192
|
+
);
|
|
193
|
+
create index auth_jwt_revocation_expires_at_idx on auth_jwt_revocation (expires_at);`,
|
|
194
|
+
};
|
|
195
|
+
export const postgresAuthStorageMigration004 = {
|
|
196
|
+
id: "0004_auth_security_history",
|
|
197
|
+
sql: `create table auth_audit_log (
|
|
198
|
+
storage_id bigint generated always as identity constraint auth_audit_log_pkey primary key,
|
|
199
|
+
id text,
|
|
200
|
+
type text not null,
|
|
201
|
+
user_id text,
|
|
202
|
+
actor_user_id text,
|
|
203
|
+
occurred_at bigint not null,
|
|
204
|
+
request_ip_hash text,
|
|
205
|
+
request_user_agent_hash text,
|
|
206
|
+
event jsonb not null,
|
|
207
|
+
created_at bigint not null
|
|
208
|
+
);
|
|
209
|
+
create index auth_audit_log_id_idx on auth_audit_log (id);
|
|
210
|
+
create index auth_audit_log_user_occurred_at_idx
|
|
211
|
+
on auth_audit_log (user_id, occurred_at, id);
|
|
212
|
+
create index auth_audit_log_actor_user_occurred_at_idx
|
|
213
|
+
on auth_audit_log (actor_user_id, occurred_at, id);
|
|
214
|
+
create index auth_audit_log_type_occurred_at_idx
|
|
215
|
+
on auth_audit_log (type, occurred_at, id);
|
|
216
|
+
create index auth_audit_log_occurred_at_idx
|
|
217
|
+
on auth_audit_log (occurred_at, id);
|
|
218
|
+
|
|
219
|
+
create table auth_login_approval_review (
|
|
220
|
+
approval_challenge_id text constraint auth_login_approval_review_pkey primary key,
|
|
221
|
+
flow_id text not null,
|
|
222
|
+
user_id text not null,
|
|
223
|
+
channel text not null,
|
|
224
|
+
reason text not null,
|
|
225
|
+
session_binding text not null,
|
|
226
|
+
same_device_required boolean not null,
|
|
227
|
+
status text not null,
|
|
228
|
+
created_at bigint not null,
|
|
229
|
+
expires_at bigint not null,
|
|
230
|
+
reviewed_at bigint,
|
|
231
|
+
reviewed_by text,
|
|
232
|
+
denied_reason text,
|
|
233
|
+
risk jsonb,
|
|
234
|
+
metadata jsonb,
|
|
235
|
+
review_metadata jsonb,
|
|
236
|
+
constraint auth_login_approval_review_session_binding_check
|
|
237
|
+
check (session_binding in ('originating-device', 'approval-device', 'none')),
|
|
238
|
+
constraint auth_login_approval_review_status_check
|
|
239
|
+
check (status in ('pending', 'approved', 'denied'))
|
|
240
|
+
);
|
|
241
|
+
create index auth_login_approval_review_flow_id_idx
|
|
242
|
+
on auth_login_approval_review (flow_id);
|
|
243
|
+
create index auth_login_approval_review_user_id_idx
|
|
244
|
+
on auth_login_approval_review (user_id);
|
|
245
|
+
create index auth_login_approval_review_status_expires_at_idx
|
|
246
|
+
on auth_login_approval_review (status, expires_at);
|
|
247
|
+
|
|
248
|
+
create table auth_login_risk_history (
|
|
249
|
+
id text constraint auth_login_risk_history_pkey primary key,
|
|
250
|
+
user_id text not null,
|
|
251
|
+
occurred_at bigint not null,
|
|
252
|
+
outcome text not null,
|
|
253
|
+
method text not null,
|
|
254
|
+
amr jsonb not null,
|
|
255
|
+
aal text not null,
|
|
256
|
+
device_status text not null,
|
|
257
|
+
device_key text,
|
|
258
|
+
location_key text,
|
|
259
|
+
country text,
|
|
260
|
+
region text,
|
|
261
|
+
latitude_micro bigint,
|
|
262
|
+
longitude_micro bigint,
|
|
263
|
+
risk_level text,
|
|
264
|
+
created_at bigint not null,
|
|
265
|
+
constraint auth_login_risk_history_outcome_check
|
|
266
|
+
check (outcome in ('success', 'failure')),
|
|
267
|
+
constraint auth_login_risk_history_aal_check
|
|
268
|
+
check (aal in ('aal1', 'aal2', 'aal3')),
|
|
269
|
+
constraint auth_login_risk_history_device_status_check
|
|
270
|
+
check (device_status in ('known', 'new', 'unknown')),
|
|
271
|
+
constraint auth_login_risk_history_risk_level_check
|
|
272
|
+
check (risk_level is null or risk_level in ('unknown', 'low', 'medium', 'high', 'critical')),
|
|
273
|
+
constraint auth_login_risk_history_latitude_check
|
|
274
|
+
check (latitude_micro is null or latitude_micro between -90000000 and 90000000),
|
|
275
|
+
constraint auth_login_risk_history_longitude_check
|
|
276
|
+
check (longitude_micro is null or longitude_micro between -180000000 and 180000000)
|
|
277
|
+
);
|
|
278
|
+
create index auth_login_risk_history_user_occurred_at_idx
|
|
279
|
+
on auth_login_risk_history (user_id, occurred_at, id);
|
|
280
|
+
create index auth_login_risk_history_user_device_key_idx
|
|
281
|
+
on auth_login_risk_history (user_id, device_key);
|
|
282
|
+
create index auth_login_risk_history_user_location_key_idx
|
|
283
|
+
on auth_login_risk_history (user_id, location_key);
|
|
284
|
+
create index auth_login_risk_history_occurred_at_idx
|
|
285
|
+
on auth_login_risk_history (occurred_at, id);
|
|
286
|
+
|
|
287
|
+
create table auth_trusted_device (
|
|
288
|
+
user_id text not null,
|
|
289
|
+
token_hash text not null,
|
|
290
|
+
created_at bigint not null,
|
|
291
|
+
last_seen_at bigint not null,
|
|
292
|
+
expires_at bigint not null,
|
|
293
|
+
metadata jsonb,
|
|
294
|
+
constraint auth_trusted_device_pkey primary key (user_id, token_hash)
|
|
295
|
+
);
|
|
296
|
+
create index auth_trusted_device_user_id_idx
|
|
297
|
+
on auth_trusted_device (user_id, last_seen_at, token_hash);
|
|
298
|
+
create index auth_trusted_device_expires_at_idx
|
|
299
|
+
on auth_trusted_device (expires_at);`,
|
|
300
|
+
};
|
|
301
|
+
export const postgresAuthStorageMigration005 = {
|
|
302
|
+
id: "0005_auth_webhooks",
|
|
303
|
+
sql: `create table auth_webhook_outbox (
|
|
304
|
+
id text constraint auth_webhook_outbox_pkey primary key,
|
|
305
|
+
endpoint_key text not null,
|
|
306
|
+
event jsonb not null,
|
|
307
|
+
status text not null,
|
|
308
|
+
attempts integer not null,
|
|
309
|
+
next_attempt_at bigint not null,
|
|
310
|
+
created_at bigint not null,
|
|
311
|
+
updated_at bigint not null,
|
|
312
|
+
delivered_at bigint,
|
|
313
|
+
last_error text,
|
|
314
|
+
constraint auth_webhook_outbox_status_check
|
|
315
|
+
check (status in ('pending', 'failed', 'delivered', 'dead_lettered')),
|
|
316
|
+
constraint auth_webhook_outbox_attempts_check check (attempts >= 0)
|
|
317
|
+
);
|
|
318
|
+
create index auth_webhook_outbox_due_idx
|
|
319
|
+
on auth_webhook_outbox (next_attempt_at, status);
|
|
320
|
+
create index auth_webhook_outbox_endpoint_due_idx
|
|
321
|
+
on auth_webhook_outbox (endpoint_key, next_attempt_at);
|
|
322
|
+
create index auth_webhook_outbox_status_idx
|
|
323
|
+
on auth_webhook_outbox (status);
|
|
324
|
+
|
|
325
|
+
create table auth_webhook_replay (
|
|
326
|
+
id text constraint auth_webhook_replay_pkey primary key,
|
|
327
|
+
expires_at bigint not null,
|
|
328
|
+
created_at bigint not null
|
|
329
|
+
);
|
|
330
|
+
create index auth_webhook_replay_expires_at_idx
|
|
331
|
+
on auth_webhook_replay (expires_at);`,
|
|
332
|
+
};
|
|
333
|
+
export const postgresAuthStorageMigration006 = {
|
|
334
|
+
id: "0006_auth_domain_timeline",
|
|
335
|
+
sql: `create table auth_domain_verification (
|
|
336
|
+
id text constraint auth_domain_verification_pkey primary key,
|
|
337
|
+
owner_id text not null,
|
|
338
|
+
domain text not null,
|
|
339
|
+
proof_method text not null,
|
|
340
|
+
proof_token text not null,
|
|
341
|
+
status text not null,
|
|
342
|
+
created_at bigint not null,
|
|
343
|
+
expires_at bigint not null,
|
|
344
|
+
verified_at bigint,
|
|
345
|
+
revoked_at bigint,
|
|
346
|
+
last_checked_at bigint,
|
|
347
|
+
metadata jsonb,
|
|
348
|
+
constraint auth_domain_verification_owner_domain_key unique (owner_id, domain),
|
|
349
|
+
constraint auth_domain_verification_proof_method_check
|
|
350
|
+
check (proof_method in ('dns-txt', 'http-file', 'meta-tag')),
|
|
351
|
+
constraint auth_domain_verification_status_check
|
|
352
|
+
check (status in ('pending', 'verified', 'revoked'))
|
|
353
|
+
);
|
|
354
|
+
create index auth_domain_verification_domain_idx
|
|
355
|
+
on auth_domain_verification (domain);
|
|
356
|
+
create index auth_domain_verification_status_expires_at_idx
|
|
357
|
+
on auth_domain_verification (status, expires_at);
|
|
358
|
+
create index auth_domain_verification_owner_created_at_idx
|
|
359
|
+
on auth_domain_verification (owner_id, created_at, id collate "C");
|
|
360
|
+
|
|
361
|
+
create table auth_security_timeline (
|
|
362
|
+
id text constraint auth_security_timeline_pkey primary key,
|
|
363
|
+
user_id text not null,
|
|
364
|
+
type text not null,
|
|
365
|
+
category text not null,
|
|
366
|
+
severity text not null,
|
|
367
|
+
occurred_at bigint not null,
|
|
368
|
+
summary text not null,
|
|
369
|
+
actor jsonb,
|
|
370
|
+
request jsonb,
|
|
371
|
+
metadata jsonb,
|
|
372
|
+
constraint auth_security_timeline_category_check
|
|
373
|
+
check (category in ('api_key', 'auth', 'authorization', 'incident', 'identity', 'jwt', 'mfa', 'oauth', 'policy', 'refresh_token', 'risk', 'session')),
|
|
374
|
+
constraint auth_security_timeline_severity_check
|
|
375
|
+
check (severity in ('info', 'warning', 'critical'))
|
|
376
|
+
);
|
|
377
|
+
create index auth_security_timeline_user_occurred_at_idx
|
|
378
|
+
on auth_security_timeline (user_id, occurred_at, id collate "C");
|
|
379
|
+
create index auth_security_timeline_occurred_at_idx
|
|
380
|
+
on auth_security_timeline (occurred_at, id collate "C");
|
|
381
|
+
create index auth_security_timeline_user_type_idx
|
|
382
|
+
on auth_security_timeline (user_id, type, occurred_at, id collate "C");
|
|
383
|
+
create index auth_security_timeline_user_category_idx
|
|
384
|
+
on auth_security_timeline (user_id, category, occurred_at, id collate "C");`,
|
|
385
|
+
};
|
|
386
|
+
export const postgresAuthStorageMigration007 = {
|
|
387
|
+
id: "0007_auth_oauth_clients",
|
|
388
|
+
sql: `create table auth_oauth_client (
|
|
389
|
+
id text constraint auth_oauth_client_pkey primary key,
|
|
390
|
+
type text not null,
|
|
391
|
+
status text not null,
|
|
392
|
+
name text,
|
|
393
|
+
redirect_uris jsonb not null,
|
|
394
|
+
allowed_grant_types jsonb not null,
|
|
395
|
+
allowed_response_types jsonb not null,
|
|
396
|
+
allowed_scopes jsonb,
|
|
397
|
+
created_at bigint,
|
|
398
|
+
updated_at bigint,
|
|
399
|
+
metadata jsonb,
|
|
400
|
+
constraint auth_oauth_client_type_check
|
|
401
|
+
check (type in ('public', 'confidential')),
|
|
402
|
+
constraint auth_oauth_client_status_check
|
|
403
|
+
check (status in ('active', 'disabled')),
|
|
404
|
+
constraint auth_oauth_client_redirect_uris_check
|
|
405
|
+
check (jsonb_typeof(redirect_uris) = 'array' and not jsonb_path_exists(redirect_uris, '$[*] ? (@.type() != "string")')),
|
|
406
|
+
constraint auth_oauth_client_allowed_grant_types_check
|
|
407
|
+
check (jsonb_typeof(allowed_grant_types) = 'array' and not jsonb_path_exists(allowed_grant_types, '$[*] ? (@.type() != "string" || (@ != "authorization_code" && @ != "refresh_token" && @ != "client_credentials"))')),
|
|
408
|
+
constraint auth_oauth_client_allowed_response_types_check
|
|
409
|
+
check (jsonb_typeof(allowed_response_types) = 'array' and not jsonb_path_exists(allowed_response_types, '$[*] ? (@.type() != "string" || @ != "code")')),
|
|
410
|
+
constraint auth_oauth_client_allowed_scopes_check
|
|
411
|
+
check (allowed_scopes is null or (jsonb_typeof(allowed_scopes) = 'array' and not jsonb_path_exists(allowed_scopes, '$[*] ? (@.type() != "string")')))
|
|
412
|
+
);
|
|
413
|
+
create index auth_oauth_client_status_idx
|
|
414
|
+
on auth_oauth_client (status, id collate "C");
|
|
415
|
+
|
|
416
|
+
create table auth_oauth_consent (
|
|
417
|
+
user_id text not null,
|
|
418
|
+
client_id text not null,
|
|
419
|
+
scopes jsonb not null,
|
|
420
|
+
granted_at bigint not null,
|
|
421
|
+
expires_at bigint,
|
|
422
|
+
revoked_at bigint,
|
|
423
|
+
metadata jsonb,
|
|
424
|
+
constraint auth_oauth_consent_user_client_key unique (user_id, client_id),
|
|
425
|
+
constraint auth_oauth_consent_scopes_check
|
|
426
|
+
check (jsonb_typeof(scopes) = 'array' and not jsonb_path_exists(scopes, '$[*] ? (@.type() != "string")'))
|
|
427
|
+
);
|
|
428
|
+
create index auth_oauth_consent_user_id_idx
|
|
429
|
+
on auth_oauth_consent (user_id, granted_at, client_id collate "C");
|
|
430
|
+
create index auth_oauth_consent_expires_at_idx
|
|
431
|
+
on auth_oauth_consent (expires_at);
|
|
432
|
+
create index auth_oauth_consent_revoked_at_idx
|
|
433
|
+
on auth_oauth_consent (revoked_at);
|
|
434
|
+
|
|
435
|
+
create table auth_oauth_authorization_code (
|
|
436
|
+
code_hash text constraint auth_oauth_authorization_code_pkey primary key,
|
|
437
|
+
client_id text not null,
|
|
438
|
+
subject text not null,
|
|
439
|
+
redirect_uri text not null,
|
|
440
|
+
scopes jsonb not null,
|
|
441
|
+
code_challenge text,
|
|
442
|
+
code_challenge_method text,
|
|
443
|
+
issued_at bigint not null,
|
|
444
|
+
expires_at bigint not null,
|
|
445
|
+
consumed_at bigint,
|
|
446
|
+
metadata jsonb,
|
|
447
|
+
constraint auth_oauth_authorization_code_scopes_check
|
|
448
|
+
check (jsonb_typeof(scopes) = 'array' and not jsonb_path_exists(scopes, '$[*] ? (@.type() != "string")')),
|
|
449
|
+
constraint auth_oauth_authorization_code_challenge_method_check
|
|
450
|
+
check (code_challenge_method is null or code_challenge_method = 'S256')
|
|
451
|
+
);
|
|
452
|
+
create index auth_oauth_authorization_code_client_expires_at_idx
|
|
453
|
+
on auth_oauth_authorization_code (client_id, expires_at);
|
|
454
|
+
create index auth_oauth_authorization_code_expires_at_idx
|
|
455
|
+
on auth_oauth_authorization_code (expires_at);
|
|
456
|
+
create index auth_oauth_authorization_code_consumed_at_idx
|
|
457
|
+
on auth_oauth_authorization_code (consumed_at);
|
|
458
|
+
|
|
459
|
+
create table auth_oauth_client_secret (
|
|
460
|
+
prefix text collate "C" not null,
|
|
461
|
+
client_id text not null,
|
|
462
|
+
secret_hash text not null,
|
|
463
|
+
authentication_methods jsonb not null,
|
|
464
|
+
created_at bigint not null,
|
|
465
|
+
expires_at bigint,
|
|
466
|
+
last_used_at bigint,
|
|
467
|
+
revoked_at bigint,
|
|
468
|
+
metadata jsonb,
|
|
469
|
+
constraint auth_oauth_client_secret_pkey primary key (client_id, prefix),
|
|
470
|
+
constraint auth_oauth_client_secret_authentication_methods_check
|
|
471
|
+
check (jsonb_typeof(authentication_methods) = 'array' and not jsonb_path_exists(authentication_methods, '$[*] ? (@.type() != "string" || (@ != "client_secret_basic" && @ != "client_secret_post"))'))
|
|
472
|
+
);`,
|
|
473
|
+
};
|
|
474
|
+
export const postgresAuthStorageMigration008 = {
|
|
475
|
+
id: "0008_auth_oauth_tokens",
|
|
476
|
+
sql: `create table auth_oauth_provider_mode_token (
|
|
477
|
+
token_hash text constraint auth_oauth_provider_mode_token_pkey primary key,
|
|
478
|
+
token_type text not null,
|
|
479
|
+
client_id text not null,
|
|
480
|
+
subject text not null,
|
|
481
|
+
scopes jsonb not null,
|
|
482
|
+
issued_at bigint not null,
|
|
483
|
+
expires_at bigint not null,
|
|
484
|
+
issuer text,
|
|
485
|
+
audience jsonb,
|
|
486
|
+
jwt_id text,
|
|
487
|
+
revoked_at bigint,
|
|
488
|
+
revocation_reason text,
|
|
489
|
+
rotated_at bigint,
|
|
490
|
+
replaced_by_token_hash text,
|
|
491
|
+
metadata jsonb,
|
|
492
|
+
constraint auth_oauth_provider_mode_token_type_check
|
|
493
|
+
check (token_type in ('access_token', 'refresh_token')),
|
|
494
|
+
constraint auth_oauth_provider_mode_token_scopes_check
|
|
495
|
+
check (jsonb_typeof(scopes) = 'array' and not jsonb_path_exists(scopes, '$[*] ? (@.type() != "string")')),
|
|
496
|
+
constraint auth_oauth_provider_mode_token_audience_check
|
|
497
|
+
check (audience is null or jsonb_typeof(audience) = 'string' or (jsonb_typeof(audience) = 'array' and not jsonb_path_exists(audience, '$[*] ? (@.type() != "string")'))),
|
|
498
|
+
constraint auth_oauth_provider_mode_token_metadata_check
|
|
499
|
+
check (metadata is null or jsonb_typeof(metadata) = 'object')
|
|
500
|
+
);
|
|
501
|
+
create index auth_oauth_provider_mode_token_client_expires_at_idx
|
|
502
|
+
on auth_oauth_provider_mode_token (client_id, expires_at);
|
|
503
|
+
create index auth_oauth_provider_mode_token_subject_idx
|
|
504
|
+
on auth_oauth_provider_mode_token (subject);
|
|
505
|
+
create index auth_oauth_provider_mode_token_expires_at_idx
|
|
506
|
+
on auth_oauth_provider_mode_token (expires_at);
|
|
507
|
+
create index auth_oauth_provider_mode_token_revoked_at_idx
|
|
508
|
+
on auth_oauth_provider_mode_token (revoked_at);
|
|
509
|
+
create index auth_oauth_provider_mode_token_rotated_at_idx
|
|
510
|
+
on auth_oauth_provider_mode_token (rotated_at);
|
|
511
|
+
create index auth_oauth_provider_mode_token_jwt_id_idx
|
|
512
|
+
on auth_oauth_provider_mode_token (jwt_id);
|
|
513
|
+
|
|
514
|
+
create table auth_oauth_provider_token_vault (
|
|
515
|
+
account_id text constraint auth_oauth_provider_token_vault_pkey primary key,
|
|
516
|
+
user_id text not null,
|
|
517
|
+
provider_id text not null,
|
|
518
|
+
provider_account_id text not null,
|
|
519
|
+
access_token_ciphertext text not null,
|
|
520
|
+
refresh_token_ciphertext text,
|
|
521
|
+
id_token_ciphertext text,
|
|
522
|
+
token_type text not null,
|
|
523
|
+
scopes jsonb,
|
|
524
|
+
expires_at bigint,
|
|
525
|
+
updated_at bigint not null,
|
|
526
|
+
revoked_at bigint,
|
|
527
|
+
revocation_reason text,
|
|
528
|
+
constraint auth_oauth_provider_token_vault_scopes_check
|
|
529
|
+
check (scopes is null or (jsonb_typeof(scopes) = 'array' and not jsonb_path_exists(scopes, '$[*] ? (@.type() != "string")')))
|
|
530
|
+
);
|
|
531
|
+
create index auth_oauth_provider_token_vault_user_id_idx
|
|
532
|
+
on auth_oauth_provider_token_vault (user_id);
|
|
533
|
+
create index auth_oauth_provider_token_vault_provider_account_idx
|
|
534
|
+
on auth_oauth_provider_token_vault (provider_id, provider_account_id);
|
|
535
|
+
create index auth_oauth_provider_token_vault_expires_at_idx
|
|
536
|
+
on auth_oauth_provider_token_vault (expires_at);
|
|
537
|
+
create index auth_oauth_provider_token_vault_revoked_at_idx
|
|
538
|
+
on auth_oauth_provider_token_vault (revoked_at);`,
|
|
539
|
+
};
|
|
540
|
+
export const postgresAuthStorageMigration009 = {
|
|
541
|
+
id: "0009_auth_permissions",
|
|
542
|
+
sql: `create table auth_permission_definition (
|
|
543
|
+
id text collate "C" constraint auth_permission_definition_pkey primary key,
|
|
544
|
+
description text,
|
|
545
|
+
scope_type_present boolean not null,
|
|
546
|
+
scope_type text not null,
|
|
547
|
+
created_at bigint not null,
|
|
548
|
+
updated_at bigint not null,
|
|
549
|
+
disabled_at bigint,
|
|
550
|
+
deleted_at bigint
|
|
551
|
+
);
|
|
552
|
+
create index auth_permission_definition_status_idx
|
|
553
|
+
on auth_permission_definition (disabled_at, deleted_at, id);
|
|
554
|
+
|
|
555
|
+
create table auth_role_definition (
|
|
556
|
+
id text constraint auth_role_definition_pkey primary key,
|
|
557
|
+
description text,
|
|
558
|
+
created_at bigint not null,
|
|
559
|
+
updated_at bigint not null,
|
|
560
|
+
disabled_at bigint,
|
|
561
|
+
deleted_at bigint
|
|
562
|
+
);
|
|
563
|
+
create index auth_role_definition_status_idx
|
|
564
|
+
on auth_role_definition (disabled_at, deleted_at, id collate "C");
|
|
565
|
+
|
|
566
|
+
create table auth_permission_grant (
|
|
567
|
+
subject_type text not null,
|
|
568
|
+
subject_id text not null,
|
|
569
|
+
permission_id text not null,
|
|
570
|
+
scope_type text not null,
|
|
571
|
+
scope_id_present boolean not null,
|
|
572
|
+
scope_id text not null,
|
|
573
|
+
expires_at bigint,
|
|
574
|
+
metadata jsonb,
|
|
575
|
+
revoked_at bigint,
|
|
576
|
+
constraint auth_permission_grant_pkey primary key
|
|
577
|
+
(subject_type, subject_id, permission_id, scope_type, scope_id_present, scope_id)
|
|
578
|
+
);
|
|
579
|
+
create index auth_permission_grant_check_idx
|
|
580
|
+
on auth_permission_grant (subject_type, subject_id, permission_id, revoked_at, expires_at);
|
|
581
|
+
|
|
582
|
+
create table auth_role_grant (
|
|
583
|
+
subject_type text not null,
|
|
584
|
+
subject_id text not null,
|
|
585
|
+
role_id text not null,
|
|
586
|
+
scope_type text not null,
|
|
587
|
+
scope_id_present boolean not null,
|
|
588
|
+
scope_id text not null,
|
|
589
|
+
expires_at bigint,
|
|
590
|
+
metadata jsonb,
|
|
591
|
+
revoked_at bigint,
|
|
592
|
+
constraint auth_role_grant_pkey primary key
|
|
593
|
+
(subject_type, subject_id, role_id, scope_type, scope_id_present, scope_id)
|
|
594
|
+
);
|
|
595
|
+
create index auth_role_grant_check_idx
|
|
596
|
+
on auth_role_grant (subject_type, subject_id, role_id, revoked_at, expires_at);
|
|
597
|
+
|
|
598
|
+
create table auth_role_permission (
|
|
599
|
+
role_id text not null,
|
|
600
|
+
permission_id text not null,
|
|
601
|
+
scope_type_present boolean not null,
|
|
602
|
+
scope_type text not null,
|
|
603
|
+
constraint auth_role_permission_pkey primary key
|
|
604
|
+
(role_id, permission_id, scope_type_present, scope_type)
|
|
605
|
+
);
|
|
606
|
+
create index auth_role_permission_check_idx
|
|
607
|
+
on auth_role_permission (permission_id, role_id, scope_type_present, scope_type);`,
|
|
608
|
+
};
|
|
609
|
+
export const postgresAuthStorageMigrations = [
|
|
610
|
+
postgresAuthStorageMigration001,
|
|
611
|
+
postgresAuthStorageMigration002,
|
|
612
|
+
postgresAuthStorageMigration003,
|
|
613
|
+
postgresAuthStorageMigration004,
|
|
614
|
+
postgresAuthStorageMigration005,
|
|
615
|
+
postgresAuthStorageMigration006,
|
|
616
|
+
postgresAuthStorageMigration007,
|
|
617
|
+
postgresAuthStorageMigration008,
|
|
618
|
+
postgresAuthStorageMigration009,
|
|
619
|
+
];
|
|
620
|
+
//# sourceMappingURL=PostgresStorageMigrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostgresStorageMigrations.js","sourceRoot":"","sources":["../src/PostgresStorageMigrations.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,gBAAgB;IACpB,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFA4E0E;CAChF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,0BAA0B;IAC9B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qFAgE8E;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,8BAA8B;IAClC,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qFA0C8E;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,4BAA4B;IAChC,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAsGgC;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,oBAAoB;IACxB,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA4BgC;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,2BAA2B;IAC/B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8EAiDuE;CAC7E,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,yBAAyB;IAC7B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFJ;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,wBAAwB;IAC5B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDA8D4C;CAClD,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IAC3E,EAAE,EAAE,uBAAuB;IAC3B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oFAiE6E;CACnF,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;IAC/B,+BAA+B;CACvB,CAAC"}
|
package/dist/Privacy.d.ts
CHANGED
|
@@ -22,9 +22,6 @@ export interface PrivacyService {
|
|
|
22
22
|
declare const Privacy_base: Context.ServiceClass<Privacy, "auth/Privacy", PrivacyService>;
|
|
23
23
|
export declare class Privacy extends Privacy_base {
|
|
24
24
|
}
|
|
25
|
-
export declare namespace Privacy {
|
|
26
|
-
const make: (service: PrivacyService) => PrivacyService;
|
|
27
|
-
}
|
|
28
25
|
export interface PrivacyOptions {
|
|
29
26
|
readonly secret: CryptoKey;
|
|
30
27
|
readonly normalizeEmail?: (email: Email) => string;
|
package/dist/Privacy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privacy.d.ts","sourceRoot":"","sources":["../src/Privacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAqB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,iBAAiB,CAAC;;;;AAE5E,qBAAa,YAAa,SAAQ,kBAAiC;IACjE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;CAAG;AAEL,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC7E,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxE,QAAQ,CAAC,aAAa,EAAE,CACtB,SAAS,EAAE,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;CACjD;;AAED,qBAAa,OAAQ,SAAQ,YAE5B;CAAG;AAEJ,
|
|
1
|
+
{"version":3,"file":"Privacy.d.ts","sourceRoot":"","sources":["../src/Privacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAqB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,iBAAiB,CAAC;;;;AAE5E,qBAAa,YAAa,SAAQ,kBAAiC;IACjE,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;CAAG;AAEL,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC7E,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxE,QAAQ,CAAC,aAAa,EAAE,CACtB,SAAS,EAAE,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;CACjD;;AAED,qBAAa,OAAQ,SAAQ,YAE5B;CAAG;AAEJ,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,MAAM,CAAC;IACjD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC;AAmDD,eAAO,MAAM,eAAe,iBACZ,mBAAmB,KAChC,cA6CF,CAAC;AAEF,wBAAgB,WAAW,CACzB,OAAO,EAAE,cAAc,GACtB,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACvC,wBAAgB,WAAW,IAAI,KAAK,CAAC,KAAK,CACxC,OAAO,EACP,KAAK,EACL,MAAM,GAAG,WAAW,CACrB,CAAC;AAoBF,eAAO,MAAM,eAAe,oCAO3B,CAAC"}
|
package/dist/Privacy.js
CHANGED
|
@@ -6,9 +6,6 @@ export class PrivacyError extends Data.TaggedError("PrivacyError") {
|
|
|
6
6
|
}
|
|
7
7
|
export class Privacy extends Context.Service()("auth/Privacy") {
|
|
8
8
|
}
|
|
9
|
-
(function (Privacy) {
|
|
10
|
-
Privacy.make = (service) => Privacy.of(service);
|
|
11
|
-
})(Privacy || (Privacy = {}));
|
|
12
9
|
const hmacNamespace = "auth.privacy.v1";
|
|
13
10
|
const normalizeEmail = (email) => String(email).trim().toLowerCase();
|
|
14
11
|
const normalizeIp = (ip) => String(ip).trim();
|
|
@@ -35,7 +32,7 @@ export const makeHmacPrivacy = (dependencies) => {
|
|
|
35
32
|
const emailNormalizer = dependencies.normalizeEmail ?? normalizeEmail;
|
|
36
33
|
const ipNormalizer = dependencies.normalizeIp ?? normalizeIp;
|
|
37
34
|
const userAgentNormalizer = dependencies.normalizeUserAgent ?? normalizeUserAgent;
|
|
38
|
-
return Privacy.
|
|
35
|
+
return Privacy.of({
|
|
39
36
|
emailHash: Effect.fn("auth.privacy.email_hash")(function* (email) {
|
|
40
37
|
const normalized = yield* normalizeInput("email-hash", emailNormalizer, email);
|
|
41
38
|
return yield* hmacHash(dependencies, "email-hash", "email", normalized, EmailHash);
|
|
@@ -64,7 +61,7 @@ export function PrivacyLive(options) {
|
|
|
64
61
|
});
|
|
65
62
|
}));
|
|
66
63
|
}
|
|
67
|
-
export const PrivacyTestLive = Layer.succeed(Privacy)(Privacy.
|
|
64
|
+
export const PrivacyTestLive = Layer.succeed(Privacy)(Privacy.of({
|
|
68
65
|
emailHash: (email) => Effect.succeed(EmailHash(`test:email:${email}`)),
|
|
69
66
|
ipHash: (ip) => Effect.succeed(IpHash(`test:ip:${ip}`)),
|
|
70
67
|
userAgentHash: (userAgent) => Effect.succeed(UserAgentHash(`test:user-agent:${userAgent}`)),
|