@effect-auth/core 0.1.0-alpha.16 → 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 +308 -133
- 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 +0 -12
- 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/AuthFlow.d.ts +128 -38
- package/dist/AuthFlow.d.ts.map +1 -1
- package/dist/AuthFlow.js +611 -263
- package/dist/AuthFlow.js.map +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 +1 -4
- 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 +4 -4
- package/dist/DrizzleD1SqliteStorage.d.ts.map +1 -1
- package/dist/DrizzleD1SqliteStorage.js +5 -5
- package/dist/DrizzleD1SqliteStorage.js.map +1 -1
- 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 +13 -4
- package/dist/DrizzleEffectSqliteStorage.d.ts.map +1 -1
- package/dist/DrizzleEffectSqliteStorage.js +71 -4
- package/dist/DrizzleEffectSqliteStorage.js.map +1 -1
- 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 +181 -23
- package/dist/EffectQbSqliteStorage.d.ts.map +1 -1
- package/dist/EffectQbSqliteStorage.js +1728 -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 +879 -877
- 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 +8 -29
- package/dist/Jwt.d.ts.map +1 -1
- package/dist/Jwt.js +67 -56
- package/dist/Jwt.js.map +1 -1
- package/dist/LoginApproval.d.ts +15 -30
- 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 +7 -11
- 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/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 +19 -12
- 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 +93 -96
- 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 +15 -17
- 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 +295 -81
- 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 +83 -11
- 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 +0 -9
- package/dist/RefreshToken.d.ts.map +1 -1
- package/dist/RefreshToken.js +31 -22
- package/dist/RefreshToken.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.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 +192 -34
- 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.map +1 -1
- package/dist/alchemy/cloudflare/Email.js +9 -4
- package/dist/alchemy/cloudflare/Email.js.map +1 -1
- package/dist/cloudflare/Email.js +1 -1
- package/dist/cloudflare/Email.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/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 +301 -2
package/dist/Client.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import { Effect, Layer, ManagedRuntime, Schema } from "effect";
|
|
2
2
|
import { FetchHttpClient, HttpClient } from "effect/unstable/http";
|
|
3
|
-
import { HttpApiClient } from "effect/unstable/httpapi";
|
|
4
|
-
import {
|
|
3
|
+
import { HttpApi, HttpApiClient, HttpApiGroup } from "effect/unstable/httpapi";
|
|
4
|
+
import { AuthClientProtocolApi } from "./HttpApi/ClientApi.js";
|
|
5
|
+
import { AuthHttpError, AuthUnauthenticatedError } from "./HttpApi/Errors.js";
|
|
6
|
+
import { AdminSecurityTimelineListQuery, AdminPermissionDefinitionCreateBody, AdminPermissionDefinitionGetQuery, AdminPermissionDefinitionHttpBody, AdminPermissionDefinitionListQuery, AdminPermissionDefinitionMutationBody, AdminPermissionDefinitionsHttpBody, AdminPermissionDefinitionUpdateBody, AdminSessionListQuery, AdminSessionRevokeAllBody, AdminSessionRevokeBody, AdminSessionsHttpBody, AdminTrustedDeviceListQuery, AdminTrustedDeviceRevokeBody, ActiveSessionsHttpBody, ApiKeyCreateBody, ApiKeyCreatedBody, ApiKeysBody, ApiKeyRevokeBody, AuthenticatedHttpBody, CurrentSessionHttpBody, IdentitiesBody, IdentityAddBody, IdentityAvailabilityBody, IdentityAvailabilityResultBody, IdentityHttpBody, IdentityPrimaryBody, IdentityReplaceBody, IdentityRevokeBody, EmailAuthStartedBody, EmailAuthStartBody, EmailOtpStartedBody, EmailOtpStartBody, EmailOtpVerifyBody, EmailVerificationStartBody, EmailVerificationVerifyBody, LoginApprovalApproveBody, LoginApprovalFinalizeBody, LoginNotificationReportBody, LoginApprovalReviewStatusBody, LoginApprovalReviewStatusHttpBody, JwtIntrospectBody, JwtIntrospectionBody, JwtJwksBody, JwtRevokeBody, MagicLinkStartedBody, MagicLinkStartBody, MagicLinkVerifyBody, MfaAuthSuccess, MfaOptionsBody, MfaOptionsResultBody, OAuthAccountUnlinkBody, OAuthAccountUnlinkResolutionBody, OAuthAuthorizationStartedBody, OAuthAuthorizationStartBody, OAuthLinkConfirmationConfirmBody, OAuthLinkConfirmationConfirmedBody, OAuthLinkConfirmationInspectBody, OAuthLinkConfirmationPendingBody, OAuthLinkConfirmationStartBody, OAuthLinkConfirmationStartedBody, OidcDiscoveryMetadataBody, PasskeyAuthenticationFinishBody, PasskeyAuthenticationStartBody, PasskeyAuthenticationStartedBody, PasskeyCredentialRevokeBody, PasskeyCredentialsBody, PasskeyMfaStartBody, PasskeyMfaVerifyBody, PasskeyRegisteredBody, PasskeyRegistrationFinishBody, PasskeyRegistrationStartBody, PasskeyRegistrationStartedBody, PasswordChangeBody, PrimaryAuthSuccess, PasswordResetStartBody, PasswordResetVerifyBody, PasswordSetBody, SessionRevokeBody, PasswordSignInBody, PasswordSignUpBody, RecoveryCodeGenerateBody, RecoveryCodeRegenerateBody, RecoveryCodeMfaVerifyBody, RecoveryCodeMfaVerifyForFlowBody, RefreshTokenRefreshBody, RefreshTokenRefreshedBody, RecoveryCodeRevokeBody, RecoveryCodesBody, RecoveryCodesGeneratedBody, RecoveryCodeVerifyBody, RecoveryCodeVerifyResultBody, SecurityTimelineEventsBody, SecurityTimelineListQuery, StepUpOptionsResultBody, StepUpPasskeyStartBody, StepUpPasskeyVerifyBody, StepUpPasswordVerifyBody, StepUpRecoveryCodeVerifyBody, StepUpTotpVerifyBody, TrustedDeviceRevokeBody, TrustedDevicesBody, TotpEnrollmentConfirmBody, TotpEnrollmentStartedBody, TotpEnrollmentStartBody, TotpFactorHttpBody, TotpFactorRevokeBody, TotpFactorsBody, TotpMfaVerifyBody, TotpMfaVerifyForFlowBody, TotpVerifyBody, TotpVerifyResultBody, } from "./HttpApi/Schemas.js";
|
|
7
|
+
import { createPasskeyCredential, getPasskeyCredential, isPasskeySupported, } from "./PasskeyBrowser.js";
|
|
8
|
+
export const makeAuthHttpClient = (options = {}) => HttpApiClient.make(AuthClientProtocolApi, { baseUrl: options.baseUrl });
|
|
9
|
+
const AuthHttpApiExtensionTypeId = Symbol.for("@effect-auth/core/Client/AuthHttpApiExtension");
|
|
10
|
+
export const defineAuthHttpApiExtension = (api, make) => ({
|
|
11
|
+
[AuthHttpApiExtensionTypeId]: (runtime) => {
|
|
12
|
+
const clientEffect = HttpApiClient.make(api, {
|
|
13
|
+
baseUrl: runtime.baseUrl,
|
|
14
|
+
});
|
|
15
|
+
return make({
|
|
16
|
+
run: (use, options) => runtime.run(Effect.flatMap(clientEffect, use), options),
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
5
20
|
const defaultRequestInit = { credentials: "include" };
|
|
21
|
+
const defaultEmailAuthPrefix = "/auth/email";
|
|
22
|
+
const defaultEmailAuthClientPaths = {
|
|
23
|
+
start: "/start",
|
|
24
|
+
};
|
|
6
25
|
const defaultPasskeyPrefix = "/auth/passkey";
|
|
7
26
|
const defaultPasskeyClientPaths = {
|
|
8
27
|
registrationStart: "/register/start",
|
|
@@ -12,6 +31,15 @@ const defaultPasskeyClientPaths = {
|
|
|
12
31
|
credentialList: "/credentials",
|
|
13
32
|
credentialRevoke: "/credentials/revoke",
|
|
14
33
|
};
|
|
34
|
+
const defaultIdentityPrefix = "/auth/identities";
|
|
35
|
+
const defaultIdentityClientPaths = {
|
|
36
|
+
availability: "/availability",
|
|
37
|
+
list: "/",
|
|
38
|
+
add: "/add",
|
|
39
|
+
replace: "/replace",
|
|
40
|
+
revoke: "/revoke",
|
|
41
|
+
primary: "/primary",
|
|
42
|
+
};
|
|
15
43
|
const defaultTotpPrefix = "/auth/totp";
|
|
16
44
|
const defaultTotpClientPaths = {
|
|
17
45
|
enrollmentStart: "/enroll/start",
|
|
@@ -23,6 +51,7 @@ const defaultTotpClientPaths = {
|
|
|
23
51
|
const defaultRecoveryCodePrefix = "/auth/recovery-codes";
|
|
24
52
|
const defaultRecoveryCodeClientPaths = {
|
|
25
53
|
generate: "/generate",
|
|
54
|
+
regenerate: "/regenerate",
|
|
26
55
|
verify: "/verify",
|
|
27
56
|
list: "/codes",
|
|
28
57
|
revoke: "/codes/revoke",
|
|
@@ -61,6 +90,7 @@ const defaultStepUpPrefix = "/auth/step-up";
|
|
|
61
90
|
const defaultStepUpClientPaths = {
|
|
62
91
|
options: "/options",
|
|
63
92
|
totpVerify: "/totp/verify",
|
|
93
|
+
passwordVerify: "/password/verify",
|
|
64
94
|
recoveryCodeVerify: "/recovery-code/verify",
|
|
65
95
|
passkeyStart: "/passkey/start",
|
|
66
96
|
passkeyVerify: "/passkey/verify",
|
|
@@ -79,6 +109,16 @@ const defaultAdminSessionClientPaths = {
|
|
|
79
109
|
revoke: "/revoke",
|
|
80
110
|
revokeAll: "/revoke-all",
|
|
81
111
|
};
|
|
112
|
+
const defaultAdminPermissionDefinitionPrefix = "/auth/admin/permission-definitions";
|
|
113
|
+
const defaultAdminPermissionDefinitionClientPaths = {
|
|
114
|
+
create: "/",
|
|
115
|
+
get: "/get",
|
|
116
|
+
list: "/",
|
|
117
|
+
update: "/update",
|
|
118
|
+
disable: "/disable",
|
|
119
|
+
enable: "/enable",
|
|
120
|
+
delete: "/delete",
|
|
121
|
+
};
|
|
82
122
|
const defaultTrustedDevicePrefix = "/auth/trusted-devices";
|
|
83
123
|
const defaultTrustedDeviceClientPaths = {
|
|
84
124
|
list: "/",
|
|
@@ -110,7 +150,7 @@ const joinPath = (prefix, path) => {
|
|
|
110
150
|
? `/${normalizedPath}`
|
|
111
151
|
: `${normalizedPrefix}/${normalizedPath}`;
|
|
112
152
|
};
|
|
113
|
-
const clientUrl = (baseUrl, path) =>
|
|
153
|
+
const clientUrl = (baseUrl, path) => baseUrl === undefined ? path : String(new URL(path, baseUrl));
|
|
114
154
|
const pathWithSearch = (path, searchParams) => {
|
|
115
155
|
const search = searchParams.toString();
|
|
116
156
|
if (search.length === 0) {
|
|
@@ -132,10 +172,10 @@ const responseJson = async (response) => {
|
|
|
132
172
|
};
|
|
133
173
|
const throwFailedResponse = async (response) => {
|
|
134
174
|
const body = await responseJson(response);
|
|
135
|
-
throw body ?? {
|
|
175
|
+
throw (body ?? {
|
|
136
176
|
code: `http_${response.status}`,
|
|
137
177
|
message: response.statusText || "Request failed",
|
|
138
|
-
};
|
|
178
|
+
});
|
|
139
179
|
};
|
|
140
180
|
const requestHeaders = (requestInit, body) => {
|
|
141
181
|
const headers = new Headers(requestInit.headers);
|
|
@@ -157,6 +197,110 @@ export const authClientErrorMessage = (error) => {
|
|
|
157
197
|
}
|
|
158
198
|
return error instanceof Error ? error.message : "Request failed";
|
|
159
199
|
};
|
|
200
|
+
export const isAuthApiError = Schema.is(AuthHttpError);
|
|
201
|
+
export const authClientErrorStatus = (error) => {
|
|
202
|
+
if (!isAuthApiError(error)) {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
switch (error.code) {
|
|
206
|
+
case "bad_request": {
|
|
207
|
+
return 400;
|
|
208
|
+
}
|
|
209
|
+
case "invalid_credentials":
|
|
210
|
+
case "unauthenticated": {
|
|
211
|
+
return 401;
|
|
212
|
+
}
|
|
213
|
+
case "policy_denied":
|
|
214
|
+
case "request_rejected":
|
|
215
|
+
case "step_up_required": {
|
|
216
|
+
return 403;
|
|
217
|
+
}
|
|
218
|
+
case "identity_already_registered":
|
|
219
|
+
case "conflict": {
|
|
220
|
+
return 409;
|
|
221
|
+
}
|
|
222
|
+
case "not_found": {
|
|
223
|
+
return 404;
|
|
224
|
+
}
|
|
225
|
+
case "rate_limited": {
|
|
226
|
+
return 429;
|
|
227
|
+
}
|
|
228
|
+
case "internal_error": {
|
|
229
|
+
return 500;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
export const isAuthenticated = (response) => response.type === "authenticated";
|
|
234
|
+
export const createEmailAuthClient = (options = {}) => {
|
|
235
|
+
const requestInit = {
|
|
236
|
+
...defaultRequestInit,
|
|
237
|
+
...options.requestInit,
|
|
238
|
+
};
|
|
239
|
+
const fetch = options.fetch ?? globalThis.fetch;
|
|
240
|
+
const prefix = options.prefix ?? defaultEmailAuthPrefix;
|
|
241
|
+
const paths = {
|
|
242
|
+
...defaultEmailAuthClientPaths,
|
|
243
|
+
...options.paths,
|
|
244
|
+
};
|
|
245
|
+
const url = (path) => clientUrl(options.baseUrl, joinPath(prefix, path));
|
|
246
|
+
const decodeEmailAuthStart = Schema.decodeUnknownEffect(EmailAuthStartBody);
|
|
247
|
+
const decodeEmailAuthStarted = Schema.decodeUnknownEffect(EmailAuthStartedBody);
|
|
248
|
+
const decode = (effect) => Effect.runPromise(effect);
|
|
249
|
+
const request = async (path, body, requestOptions, decodeResponse) => {
|
|
250
|
+
const response = await fetch(url(path), {
|
|
251
|
+
...requestInit,
|
|
252
|
+
method: "POST",
|
|
253
|
+
headers: requestHeaders(requestInit, body),
|
|
254
|
+
body: JSON.stringify(body),
|
|
255
|
+
signal: requestOptions?.signal,
|
|
256
|
+
});
|
|
257
|
+
if (!response.ok) {
|
|
258
|
+
return throwFailedResponse(response);
|
|
259
|
+
}
|
|
260
|
+
return decode(decodeResponse(await responseJson(response)));
|
|
261
|
+
};
|
|
262
|
+
return {
|
|
263
|
+
start: async (input, requestOptions) => {
|
|
264
|
+
const payload = await decode(decodeEmailAuthStart(input));
|
|
265
|
+
return request(paths.start, payload, requestOptions, decodeEmailAuthStarted);
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
export const createIdentityClient = (options = {}) => {
|
|
270
|
+
const requestInit = {
|
|
271
|
+
...defaultRequestInit,
|
|
272
|
+
...options.requestInit,
|
|
273
|
+
};
|
|
274
|
+
const fetch = options.fetch ?? globalThis.fetch;
|
|
275
|
+
const prefix = options.prefix ?? defaultIdentityPrefix;
|
|
276
|
+
const paths = {
|
|
277
|
+
...defaultIdentityClientPaths,
|
|
278
|
+
...options.paths,
|
|
279
|
+
};
|
|
280
|
+
const url = (path) => clientUrl(options.baseUrl, joinPath(prefix, path));
|
|
281
|
+
const request = async (method, path, body, signal, schema) => {
|
|
282
|
+
const response = await fetch(url(path), {
|
|
283
|
+
...requestInit,
|
|
284
|
+
method,
|
|
285
|
+
headers: requestHeaders(requestInit, body),
|
|
286
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
287
|
+
signal,
|
|
288
|
+
});
|
|
289
|
+
if (!response.ok) {
|
|
290
|
+
return throwFailedResponse(response);
|
|
291
|
+
}
|
|
292
|
+
return Effect.runPromise(Schema.decodeUnknownEffect(schema)(await responseJson(response)));
|
|
293
|
+
};
|
|
294
|
+
const post = async (path, input, requestOptions, inputSchema, outputSchema) => request("POST", path, await Effect.runPromise(Schema.decodeUnknownEffect(inputSchema)(input)), requestOptions?.signal, outputSchema);
|
|
295
|
+
return {
|
|
296
|
+
availability: (input, requestOptions) => post(paths.availability, input, requestOptions, IdentityAvailabilityBody, IdentityAvailabilityResultBody),
|
|
297
|
+
list: (requestOptions) => request("GET", paths.list, undefined, requestOptions?.signal, IdentitiesBody),
|
|
298
|
+
add: (input, requestOptions) => post(paths.add, input, requestOptions, IdentityAddBody, IdentityHttpBody),
|
|
299
|
+
replace: (input, requestOptions) => post(paths.replace, input, requestOptions, IdentityReplaceBody, IdentityHttpBody),
|
|
300
|
+
revoke: (input, requestOptions) => post(paths.revoke, input, requestOptions, IdentityRevokeBody, IdentityHttpBody),
|
|
301
|
+
primary: (input, requestOptions) => post(paths.primary, input, requestOptions, IdentityPrimaryBody, IdentityHttpBody),
|
|
302
|
+
};
|
|
303
|
+
};
|
|
160
304
|
export const createPasskeyClient = (options = {}) => {
|
|
161
305
|
const requestInit = {
|
|
162
306
|
...defaultRequestInit,
|
|
@@ -207,7 +351,7 @@ export const createPasskeyClient = (options = {}) => {
|
|
|
207
351
|
};
|
|
208
352
|
return {
|
|
209
353
|
registration: {
|
|
210
|
-
start: async (input, requestOptions) => request("POST", paths.registrationStart, await decode(decodePasskeyRegistrationStart(input)), requestOptions, decodePasskeyRegistrationStarted),
|
|
354
|
+
start: async (input, requestOptions) => request("POST", paths.registrationStart, await decode(decodePasskeyRegistrationStart(input ?? {})), requestOptions, decodePasskeyRegistrationStarted),
|
|
211
355
|
finish: async (input, requestOptions) => request("POST", paths.registrationFinish, await decode(decodePasskeyRegistrationFinish(input)), requestOptions, decodePasskeyRegistered),
|
|
212
356
|
},
|
|
213
357
|
authentication: {
|
|
@@ -293,6 +437,7 @@ export const createRecoveryCodeClient = (options = {}) => {
|
|
|
293
437
|
};
|
|
294
438
|
const url = (path) => clientUrl(options.baseUrl, joinPath(prefix, path));
|
|
295
439
|
const decodeRecoveryCodeGenerate = Schema.decodeUnknownEffect(RecoveryCodeGenerateBody);
|
|
440
|
+
const decodeRecoveryCodeRegenerate = Schema.decodeUnknownEffect(RecoveryCodeRegenerateBody);
|
|
296
441
|
const decodeRecoveryCodeVerify = Schema.decodeUnknownEffect(RecoveryCodeVerifyBody);
|
|
297
442
|
const decodeRecoveryCodeRevoke = Schema.decodeUnknownEffect(RecoveryCodeRevokeBody);
|
|
298
443
|
const decodeRecoveryCodesGenerated = Schema.decodeUnknownEffect(RecoveryCodesGeneratedBody);
|
|
@@ -327,6 +472,7 @@ export const createRecoveryCodeClient = (options = {}) => {
|
|
|
327
472
|
return {
|
|
328
473
|
generation: {
|
|
329
474
|
generate: async (input, requestOptions) => request("POST", paths.generate, await decode(decodeRecoveryCodeGenerate(input)), requestOptions, decodeRecoveryCodesGenerated),
|
|
475
|
+
regenerate: async (input, requestOptions) => request("POST", paths.regenerate, await decode(decodeRecoveryCodeRegenerate(input)), requestOptions, decodeRecoveryCodesGenerated),
|
|
330
476
|
},
|
|
331
477
|
verification: {
|
|
332
478
|
verify: async (input, requestOptions) => request("POST", paths.verify, await decode(decodeRecoveryCodeVerify(input)), requestOptions, decodeRecoveryCodeVerifyResult),
|
|
@@ -526,7 +672,7 @@ export const createMfaClient = (options = {}) => {
|
|
|
526
672
|
const decodePasskeyMfaVerify = Schema.decodeUnknownEffect(PasskeyMfaVerifyBody);
|
|
527
673
|
const decodePasskeyAuthenticationStarted = Schema.decodeUnknownEffect(PasskeyAuthenticationStartedBody);
|
|
528
674
|
const decodeMfaOptionsResult = Schema.decodeUnknownEffect(MfaOptionsResultBody);
|
|
529
|
-
const
|
|
675
|
+
const decodeMfaResult = Schema.decodeUnknownEffect(MfaAuthSuccess);
|
|
530
676
|
const decode = (effect) => Effect.runPromise(effect);
|
|
531
677
|
const request = async (path, body, requestOptions, decodeResponse) => {
|
|
532
678
|
const response = await fetch(url(path), {
|
|
@@ -544,16 +690,16 @@ export const createMfaClient = (options = {}) => {
|
|
|
544
690
|
return {
|
|
545
691
|
options: async (input, requestOptions) => request(paths.options, await decode(decodeMfaOptions(input)), requestOptions, decodeMfaOptionsResult),
|
|
546
692
|
totp: {
|
|
547
|
-
verify: async (input, requestOptions) => request(paths.totpVerify, await decode(decodeTotpMfaVerify(input)), requestOptions,
|
|
548
|
-
verifyForFlow: async (input, requestOptions) => request(paths.totpVerifyForFlow, await decode(decodeTotpMfaVerifyForFlow(input)), requestOptions,
|
|
693
|
+
verify: async (input, requestOptions) => request(paths.totpVerify, await decode(decodeTotpMfaVerify(input)), requestOptions, decodeMfaResult),
|
|
694
|
+
verifyForFlow: async (input, requestOptions) => request(paths.totpVerifyForFlow, await decode(decodeTotpMfaVerifyForFlow(input)), requestOptions, decodeMfaResult),
|
|
549
695
|
},
|
|
550
696
|
recoveryCode: {
|
|
551
|
-
verify: async (input, requestOptions) => request(paths.recoveryCodeVerify, await decode(decodeRecoveryCodeMfaVerify(input)), requestOptions,
|
|
552
|
-
verifyForFlow: async (input, requestOptions) => request(paths.recoveryCodeVerifyForFlow, await decode(decodeRecoveryCodeMfaVerifyForFlow(input)), requestOptions,
|
|
697
|
+
verify: async (input, requestOptions) => request(paths.recoveryCodeVerify, await decode(decodeRecoveryCodeMfaVerify(input)), requestOptions, decodeMfaResult),
|
|
698
|
+
verifyForFlow: async (input, requestOptions) => request(paths.recoveryCodeVerifyForFlow, await decode(decodeRecoveryCodeMfaVerifyForFlow(input)), requestOptions, decodeMfaResult),
|
|
553
699
|
},
|
|
554
700
|
passkey: {
|
|
555
701
|
start: async (input, requestOptions) => request(paths.passkeyStart, await decode(decodePasskeyMfaStart(input)), requestOptions, decodePasskeyAuthenticationStarted),
|
|
556
|
-
verify: async (input, requestOptions) => request(paths.passkeyVerify, await decode(decodePasskeyMfaVerify(input)), requestOptions,
|
|
702
|
+
verify: async (input, requestOptions) => request(paths.passkeyVerify, await decode(decodePasskeyMfaVerify(input)), requestOptions, decodeMfaResult),
|
|
557
703
|
},
|
|
558
704
|
};
|
|
559
705
|
};
|
|
@@ -570,6 +716,7 @@ export const createStepUpClient = (options = {}) => {
|
|
|
570
716
|
};
|
|
571
717
|
const url = (path) => clientUrl(options.baseUrl, joinPath(prefix, path));
|
|
572
718
|
const decodeStepUpTotpVerify = Schema.decodeUnknownEffect(StepUpTotpVerifyBody);
|
|
719
|
+
const decodeStepUpPasswordVerify = Schema.decodeUnknownEffect(StepUpPasswordVerifyBody);
|
|
573
720
|
const decodeStepUpRecoveryCodeVerify = Schema.decodeUnknownEffect(StepUpRecoveryCodeVerifyBody);
|
|
574
721
|
const decodeStepUpPasskeyStart = Schema.decodeUnknownEffect(StepUpPasskeyStartBody);
|
|
575
722
|
const decodeStepUpPasskeyVerify = Schema.decodeUnknownEffect(StepUpPasskeyVerifyBody);
|
|
@@ -595,6 +742,9 @@ export const createStepUpClient = (options = {}) => {
|
|
|
595
742
|
totp: {
|
|
596
743
|
verify: async (input, requestOptions) => request("POST", paths.totpVerify, await decode(decodeStepUpTotpVerify(input)), requestOptions, decodeAuthenticated),
|
|
597
744
|
},
|
|
745
|
+
password: {
|
|
746
|
+
verify: async (input, requestOptions) => request("POST", paths.passwordVerify, await decode(decodeStepUpPasswordVerify(input)), requestOptions, decodeAuthenticated),
|
|
747
|
+
},
|
|
598
748
|
recoveryCode: {
|
|
599
749
|
verify: async (input, requestOptions) => request("POST", paths.recoveryCodeVerify, await decode(decodeStepUpRecoveryCodeVerify(input)), requestOptions, decodeAuthenticated),
|
|
600
750
|
},
|
|
@@ -758,6 +908,72 @@ export const createAdminSessionClient = (options = {}) => {
|
|
|
758
908
|
},
|
|
759
909
|
};
|
|
760
910
|
};
|
|
911
|
+
export const createAdminPermissionDefinitionClient = (options = {}) => {
|
|
912
|
+
const requestInit = {
|
|
913
|
+
...defaultRequestInit,
|
|
914
|
+
...options.requestInit,
|
|
915
|
+
};
|
|
916
|
+
const fetch = options.fetch ?? globalThis.fetch;
|
|
917
|
+
const prefix = options.prefix ?? defaultAdminPermissionDefinitionPrefix;
|
|
918
|
+
const paths = {
|
|
919
|
+
...defaultAdminPermissionDefinitionClientPaths,
|
|
920
|
+
...options.paths,
|
|
921
|
+
};
|
|
922
|
+
const url = (path) => clientUrl(options.baseUrl, joinPath(prefix, path));
|
|
923
|
+
const decodeCreate = Schema.decodeUnknownEffect(AdminPermissionDefinitionCreateBody);
|
|
924
|
+
const decodeGet = Schema.decodeUnknownEffect(AdminPermissionDefinitionGetQuery);
|
|
925
|
+
const decodeList = Schema.decodeUnknownEffect(AdminPermissionDefinitionListQuery);
|
|
926
|
+
const decodeUpdate = Schema.decodeUnknownEffect(AdminPermissionDefinitionUpdateBody);
|
|
927
|
+
const decodeMutation = Schema.decodeUnknownEffect(AdminPermissionDefinitionMutationBody);
|
|
928
|
+
const decodeDefinition = Schema.decodeUnknownEffect(AdminPermissionDefinitionHttpBody);
|
|
929
|
+
const decodeDefinitions = Schema.decodeUnknownEffect(AdminPermissionDefinitionsHttpBody);
|
|
930
|
+
const decode = (effect) => Effect.runPromise(effect);
|
|
931
|
+
const getPath = (query) => {
|
|
932
|
+
const searchParams = new URLSearchParams();
|
|
933
|
+
searchParams.set("id", query.id);
|
|
934
|
+
return pathWithSearch(paths.get, searchParams);
|
|
935
|
+
};
|
|
936
|
+
const listPath = (query) => {
|
|
937
|
+
const searchParams = new URLSearchParams();
|
|
938
|
+
if (query.includeDisabled !== undefined) {
|
|
939
|
+
searchParams.set("includeDisabled", String(query.includeDisabled));
|
|
940
|
+
}
|
|
941
|
+
if (query.includeDeleted !== undefined) {
|
|
942
|
+
searchParams.set("includeDeleted", String(query.includeDeleted));
|
|
943
|
+
}
|
|
944
|
+
if (query.after !== undefined) {
|
|
945
|
+
searchParams.set("after", query.after);
|
|
946
|
+
}
|
|
947
|
+
if (query.limit !== undefined) {
|
|
948
|
+
searchParams.set("limit", String(query.limit));
|
|
949
|
+
}
|
|
950
|
+
return pathWithSearch(paths.list === "/" ? "" : paths.list, searchParams);
|
|
951
|
+
};
|
|
952
|
+
const request = async (method, path, body, requestOptions, decodeResponse) => {
|
|
953
|
+
const response = await fetch(url(path), {
|
|
954
|
+
...requestInit,
|
|
955
|
+
method,
|
|
956
|
+
headers: requestHeaders(requestInit, body),
|
|
957
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
958
|
+
signal: requestOptions?.signal,
|
|
959
|
+
});
|
|
960
|
+
if (!response.ok) {
|
|
961
|
+
return throwFailedResponse(response);
|
|
962
|
+
}
|
|
963
|
+
return decode(decodeResponse(await responseJson(response)));
|
|
964
|
+
};
|
|
965
|
+
return {
|
|
966
|
+
definitions: {
|
|
967
|
+
create: async (input, requestOptions) => request("POST", paths.create, await decode(decodeCreate(input)), requestOptions, decodeDefinition),
|
|
968
|
+
get: async (input, requestOptions) => request("GET", getPath(await decode(decodeGet(input))), undefined, requestOptions, decodeDefinition),
|
|
969
|
+
list: async (input, requestOptions) => request("GET", listPath(await decode(decodeList(input ?? {}))), undefined, requestOptions, decodeDefinitions),
|
|
970
|
+
update: async (input, requestOptions) => request("POST", paths.update, await decode(decodeUpdate(input)), requestOptions, decodeDefinition),
|
|
971
|
+
disable: async (input, requestOptions) => request("POST", paths.disable, await decode(decodeMutation(input)), requestOptions, decodeDefinition),
|
|
972
|
+
enable: async (input, requestOptions) => request("POST", paths.enable, await decode(decodeMutation(input)), requestOptions, decodeDefinition),
|
|
973
|
+
delete: async (input, requestOptions) => request("POST", paths.delete, await decode(decodeMutation(input)), requestOptions, decodeDefinition),
|
|
974
|
+
},
|
|
975
|
+
};
|
|
976
|
+
};
|
|
761
977
|
export const createTrustedDeviceClient = (options = {}) => {
|
|
762
978
|
const requestInit = {
|
|
763
979
|
...defaultRequestInit,
|
|
@@ -908,6 +1124,32 @@ export const createOAuthClient = (options = {}) => {
|
|
|
908
1124
|
},
|
|
909
1125
|
};
|
|
910
1126
|
};
|
|
1127
|
+
const RemovedAuthProtocolNode = Symbol.for("@effect-auth/core/Client/RemovedAuthProtocolNode");
|
|
1128
|
+
const isObjectRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1129
|
+
const mergeAuthProtocol = (standard, patch, runtime) => {
|
|
1130
|
+
if (patch === null) {
|
|
1131
|
+
return RemovedAuthProtocolNode;
|
|
1132
|
+
}
|
|
1133
|
+
if (isObjectRecord(patch) && AuthHttpApiExtensionTypeId in patch) {
|
|
1134
|
+
return patch[AuthHttpApiExtensionTypeId](runtime);
|
|
1135
|
+
}
|
|
1136
|
+
if (!isObjectRecord(patch)) {
|
|
1137
|
+
return patch;
|
|
1138
|
+
}
|
|
1139
|
+
const merged = isObjectRecord(standard)
|
|
1140
|
+
? { ...standard }
|
|
1141
|
+
: {};
|
|
1142
|
+
for (const key of Reflect.ownKeys(patch)) {
|
|
1143
|
+
const value = mergeAuthProtocol(merged[key], patch[key], runtime);
|
|
1144
|
+
if (value === RemovedAuthProtocolNode) {
|
|
1145
|
+
Reflect.deleteProperty(merged, key);
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
merged[key] = value;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return merged;
|
|
1152
|
+
};
|
|
911
1153
|
export const createAuthClient = (options = {}) => {
|
|
912
1154
|
const requestInit = {
|
|
913
1155
|
...defaultRequestInit,
|
|
@@ -917,9 +1159,7 @@ export const createAuthClient = (options = {}) => {
|
|
|
917
1159
|
? (layer) => layer
|
|
918
1160
|
: Layer.provide(Layer.succeed(FetchHttpClient.Fetch, options.fetch)));
|
|
919
1161
|
const runtime = ManagedRuntime.make(fetchLayer);
|
|
920
|
-
const clientEffect =
|
|
921
|
-
baseUrl: options.baseUrl,
|
|
922
|
-
});
|
|
1162
|
+
const clientEffect = makeAuthHttpClient({ baseUrl: options.baseUrl });
|
|
923
1163
|
const decodePasswordSignIn = Schema.decodeUnknownEffect(PasswordSignInBody);
|
|
924
1164
|
const decodePasswordSignUp = Schema.decodeUnknownEffect(PasswordSignUpBody);
|
|
925
1165
|
const decodePasswordResetStart = Schema.decodeUnknownEffect(PasswordResetStartBody);
|
|
@@ -937,9 +1177,38 @@ export const createAuthClient = (options = {}) => {
|
|
|
937
1177
|
const decodeLoginApprovalStatus = Schema.decodeUnknownEffect(LoginApprovalReviewStatusBody);
|
|
938
1178
|
const decodeLoginApprovalFinalize = Schema.decodeUnknownEffect(LoginApprovalFinalizeBody);
|
|
939
1179
|
const decodeLoginNotificationReport = Schema.decodeUnknownEffect(LoginNotificationReportBody);
|
|
1180
|
+
const decodeEmailAuthStart = Schema.decodeUnknownEffect(EmailAuthStartBody);
|
|
1181
|
+
const decodePasskeyRegistrationStart = Schema.decodeUnknownEffect(PasskeyRegistrationStartBody);
|
|
1182
|
+
const decodePasskeyRegistrationFinish = Schema.decodeUnknownEffect(PasskeyRegistrationFinishBody);
|
|
1183
|
+
const decodePasskeyAuthenticationStart = Schema.decodeUnknownEffect(PasskeyAuthenticationStartBody);
|
|
1184
|
+
const decodePasskeyAuthenticationFinish = Schema.decodeUnknownEffect(PasskeyAuthenticationFinishBody);
|
|
1185
|
+
const decodePasskeyCredentialRevoke = Schema.decodeUnknownEffect(PasskeyCredentialRevokeBody);
|
|
1186
|
+
const decodeIdentityAvailability = Schema.decodeUnknownEffect(IdentityAvailabilityBody);
|
|
1187
|
+
const decodeIdentityAdd = Schema.decodeUnknownEffect(IdentityAddBody);
|
|
1188
|
+
const decodeIdentityReplace = Schema.decodeUnknownEffect(IdentityReplaceBody);
|
|
1189
|
+
const decodeIdentityRevoke = Schema.decodeUnknownEffect(IdentityRevokeBody);
|
|
1190
|
+
const decodeIdentityPrimary = Schema.decodeUnknownEffect(IdentityPrimaryBody);
|
|
1191
|
+
const decodeTotpEnrollmentStart = Schema.decodeUnknownEffect(TotpEnrollmentStartBody);
|
|
1192
|
+
const decodeTotpEnrollmentConfirm = Schema.decodeUnknownEffect(TotpEnrollmentConfirmBody);
|
|
1193
|
+
const decodeTotpVerify = Schema.decodeUnknownEffect(TotpVerifyBody);
|
|
1194
|
+
const decodeTotpFactorRevoke = Schema.decodeUnknownEffect(TotpFactorRevokeBody);
|
|
1195
|
+
const decodeRecoveryCodeGenerate = Schema.decodeUnknownEffect(RecoveryCodeGenerateBody);
|
|
1196
|
+
const decodeRecoveryCodeRegenerate = Schema.decodeUnknownEffect(RecoveryCodeRegenerateBody);
|
|
1197
|
+
const decodeRecoveryCodeVerify = Schema.decodeUnknownEffect(RecoveryCodeVerifyBody);
|
|
1198
|
+
const decodeRecoveryCodeRevoke = Schema.decodeUnknownEffect(RecoveryCodeRevokeBody);
|
|
1199
|
+
const decodeMfaOptions = Schema.decodeUnknownEffect(MfaOptionsBody);
|
|
1200
|
+
const decodeTotpMfaVerifyForFlow = Schema.decodeUnknownEffect(TotpMfaVerifyForFlowBody);
|
|
1201
|
+
const decodeRecoveryCodeMfaVerifyForFlow = Schema.decodeUnknownEffect(RecoveryCodeMfaVerifyForFlowBody);
|
|
1202
|
+
const decodePasskeyMfaStart = Schema.decodeUnknownEffect(PasskeyMfaStartBody);
|
|
1203
|
+
const decodePasskeyMfaVerify = Schema.decodeUnknownEffect(PasskeyMfaVerifyBody);
|
|
1204
|
+
const decodeStepUpTotpVerify = Schema.decodeUnknownEffect(StepUpTotpVerifyBody);
|
|
1205
|
+
const decodeStepUpPasswordVerify = Schema.decodeUnknownEffect(StepUpPasswordVerifyBody);
|
|
1206
|
+
const decodeStepUpRecoveryCodeVerify = Schema.decodeUnknownEffect(StepUpRecoveryCodeVerifyBody);
|
|
1207
|
+
const decodeStepUpPasskeyStart = Schema.decodeUnknownEffect(StepUpPasskeyStartBody);
|
|
1208
|
+
const decodeStepUpPasskeyVerify = Schema.decodeUnknownEffect(StepUpPasskeyVerifyBody);
|
|
940
1209
|
const run = (effect, requestOptions = {}) => runtime.runPromise(effect, requestOptions);
|
|
941
1210
|
const withClient = (effect, requestOptions) => run(Effect.flatMap(clientEffect, effect), requestOptions);
|
|
942
|
-
|
|
1211
|
+
const standard = {
|
|
943
1212
|
password: {
|
|
944
1213
|
signIn: (input, requestOptions) => withClient((client) => Effect.flatMap(decodePasswordSignIn(input), (payload) => client.password.signIn({ payload })), requestOptions),
|
|
945
1214
|
signUp: (input, requestOptions) => withClient((client) => Effect.flatMap(decodePasswordSignUp(input), (payload) => client.password.signUp({ payload })), requestOptions),
|
|
@@ -959,6 +1228,9 @@ export const createAuthClient = (options = {}) => {
|
|
|
959
1228
|
revoke: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeSessionRevoke(input), (payload) => client.session.revoke({ payload })), requestOptions),
|
|
960
1229
|
revokeOthers: (requestOptions) => withClient((client) => client.session.revokeOthers(), requestOptions),
|
|
961
1230
|
},
|
|
1231
|
+
email: {
|
|
1232
|
+
start: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeEmailAuthStart(input), (payload) => client.emailAuth.start({ payload })), requestOptions),
|
|
1233
|
+
},
|
|
962
1234
|
emailVerification: {
|
|
963
1235
|
start: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeEmailVerificationStart(input), (payload) => client.emailVerification.start({ payload })), requestOptions),
|
|
964
1236
|
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeEmailVerificationVerify(input), (payload) => client.emailVerification.verify({ payload })), requestOptions),
|
|
@@ -971,6 +1243,111 @@ export const createAuthClient = (options = {}) => {
|
|
|
971
1243
|
start: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeMagicLinkStart(input), (payload) => client.magicLink.start({ payload })), requestOptions),
|
|
972
1244
|
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeMagicLinkVerify(input), (payload) => client.magicLink.verify({ payload })), requestOptions),
|
|
973
1245
|
},
|
|
1246
|
+
passkey: {
|
|
1247
|
+
isSupported: isPasskeySupported,
|
|
1248
|
+
register: async (input, requestOptions) => {
|
|
1249
|
+
const started = await withClient((client) => Effect.flatMap(decodePasskeyRegistrationStart(input ?? {}), (payload) => client.passkey.registerStart({ payload })), requestOptions);
|
|
1250
|
+
const credential = await createPasskeyCredential(started.publicKey, options.browser?.passkey);
|
|
1251
|
+
return withClient((client) => Effect.flatMap(decodePasskeyRegistrationFinish({
|
|
1252
|
+
challengeId: started.challengeId,
|
|
1253
|
+
credential,
|
|
1254
|
+
}), (payload) => client.passkey.registerFinish({ payload })), requestOptions);
|
|
1255
|
+
},
|
|
1256
|
+
signIn: async (input, requestOptions) => {
|
|
1257
|
+
const request = input ?? {};
|
|
1258
|
+
const started = await withClient((client) => Effect.flatMap(decodePasskeyAuthenticationStart(request), (payload) => client.passkey.authenticateStart({ payload })), requestOptions);
|
|
1259
|
+
const credential = await getPasskeyCredential(started.publicKey, options.browser?.passkey);
|
|
1260
|
+
return withClient((client) => Effect.flatMap(decodePasskeyAuthenticationFinish({
|
|
1261
|
+
challengeId: started.challengeId,
|
|
1262
|
+
credential,
|
|
1263
|
+
...(request.userId === undefined
|
|
1264
|
+
? {}
|
|
1265
|
+
: { userId: request.userId }),
|
|
1266
|
+
...(request.metadata === undefined
|
|
1267
|
+
? {}
|
|
1268
|
+
: { metadata: request.metadata }),
|
|
1269
|
+
}), (payload) => client.passkey.authenticateFinish({ payload })), requestOptions);
|
|
1270
|
+
},
|
|
1271
|
+
credentials: {
|
|
1272
|
+
list: (requestOptions) => withClient((client) => client.passkey.listCredentials(), requestOptions),
|
|
1273
|
+
revoke: (input, requestOptions) => withClient((client) => Effect.flatMap(decodePasskeyCredentialRevoke(input), (payload) => client.passkey.revokeCredential({ payload })), requestOptions),
|
|
1274
|
+
},
|
|
1275
|
+
},
|
|
1276
|
+
identities: {
|
|
1277
|
+
availability: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeIdentityAvailability(input), (payload) => client.identity.availability({ payload })), requestOptions),
|
|
1278
|
+
list: (requestOptions) => withClient((client) => client.identity.list(), requestOptions),
|
|
1279
|
+
add: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeIdentityAdd(input), (payload) => client.identity.add({ payload })), requestOptions),
|
|
1280
|
+
replace: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeIdentityReplace(input), (payload) => client.identity.replace({ payload })), requestOptions),
|
|
1281
|
+
revoke: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeIdentityRevoke(input), (payload) => client.identity.revoke({ payload })), requestOptions),
|
|
1282
|
+
primary: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeIdentityPrimary(input), (payload) => client.identity.primary({ payload })), requestOptions),
|
|
1283
|
+
},
|
|
1284
|
+
totp: {
|
|
1285
|
+
enrollment: {
|
|
1286
|
+
start: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeTotpEnrollmentStart(input), (payload) => client.totp.startEnrollment({ payload })), requestOptions),
|
|
1287
|
+
confirm: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeTotpEnrollmentConfirm(input), (payload) => client.totp.confirmEnrollment({ payload })), requestOptions),
|
|
1288
|
+
},
|
|
1289
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeTotpVerify(input), (payload) => client.totp.verify({ payload })), requestOptions),
|
|
1290
|
+
factors: {
|
|
1291
|
+
list: (requestOptions) => withClient((client) => client.totp.listFactors(), requestOptions),
|
|
1292
|
+
revoke: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeTotpFactorRevoke(input), (payload) => client.totp.revokeFactor({ payload })), requestOptions),
|
|
1293
|
+
},
|
|
1294
|
+
},
|
|
1295
|
+
recoveryCodes: {
|
|
1296
|
+
generate: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeRecoveryCodeGenerate(input ?? {}), (payload) => client.recoveryCodes.generateRecoveryCodes({ payload })), requestOptions),
|
|
1297
|
+
regenerate: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeRecoveryCodeRegenerate(input ?? {}), (payload) => client.recoveryCodes.regenerateRecoveryCodes({ payload })), requestOptions),
|
|
1298
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeRecoveryCodeVerify(input), (payload) => client.recoveryCodes.verifyRecoveryCode({ payload })), requestOptions),
|
|
1299
|
+
list: (requestOptions) => withClient((client) => client.recoveryCodes.listRecoveryCodes(), requestOptions),
|
|
1300
|
+
revoke: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeRecoveryCodeRevoke(input), (payload) => client.recoveryCodes.revokeRecoveryCode({ payload })), requestOptions),
|
|
1301
|
+
},
|
|
1302
|
+
mfa: {
|
|
1303
|
+
options: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeMfaOptions(input), (payload) => client.mfa.options({ payload })), requestOptions),
|
|
1304
|
+
totp: {
|
|
1305
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeTotpMfaVerifyForFlow(input), (payload) => client.mfa.verifyTotpForFlow({ payload })), requestOptions),
|
|
1306
|
+
},
|
|
1307
|
+
recoveryCode: {
|
|
1308
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeRecoveryCodeMfaVerifyForFlow(input), (payload) => client.mfa.verifyRecoveryCodeForFlow({ payload })), requestOptions),
|
|
1309
|
+
},
|
|
1310
|
+
passkey: {
|
|
1311
|
+
verify: async (input, requestOptions) => {
|
|
1312
|
+
const started = await withClient((client) => Effect.flatMap(decodePasskeyMfaStart(input), (payload) => client.mfa.startPasskey({ payload })), requestOptions);
|
|
1313
|
+
const credential = await getPasskeyCredential(started.publicKey, options.browser?.passkey);
|
|
1314
|
+
return withClient((client) => Effect.flatMap(decodePasskeyMfaVerify({
|
|
1315
|
+
flowId: input.flowId,
|
|
1316
|
+
challengeId: started.challengeId,
|
|
1317
|
+
credential,
|
|
1318
|
+
...(input.metadata === undefined
|
|
1319
|
+
? {}
|
|
1320
|
+
: { metadata: input.metadata }),
|
|
1321
|
+
}), (payload) => client.mfa.verifyPasskey({ payload })), requestOptions);
|
|
1322
|
+
},
|
|
1323
|
+
},
|
|
1324
|
+
},
|
|
1325
|
+
stepUp: {
|
|
1326
|
+
options: (requestOptions) => withClient((client) => client.stepUp.options(), requestOptions),
|
|
1327
|
+
totp: {
|
|
1328
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeStepUpTotpVerify(input), (payload) => client.stepUp.verifyTotp({ payload })), requestOptions),
|
|
1329
|
+
},
|
|
1330
|
+
password: {
|
|
1331
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeStepUpPasswordVerify(input), (payload) => client.stepUp.verifyPassword({ payload })), requestOptions),
|
|
1332
|
+
},
|
|
1333
|
+
recoveryCode: {
|
|
1334
|
+
verify: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeStepUpRecoveryCodeVerify(input), (payload) => client.stepUp.verifyRecoveryCode({ payload })), requestOptions),
|
|
1335
|
+
},
|
|
1336
|
+
passkey: {
|
|
1337
|
+
verify: async (input, requestOptions) => {
|
|
1338
|
+
const request = input ?? {};
|
|
1339
|
+
const started = await withClient((client) => Effect.flatMap(decodeStepUpPasskeyStart(request), (payload) => client.stepUp.startPasskey({ payload })), requestOptions);
|
|
1340
|
+
const credential = await getPasskeyCredential(started.publicKey, options.browser?.passkey);
|
|
1341
|
+
return withClient((client) => Effect.flatMap(decodeStepUpPasskeyVerify({
|
|
1342
|
+
challengeId: started.challengeId,
|
|
1343
|
+
credential,
|
|
1344
|
+
...(request.metadata === undefined
|
|
1345
|
+
? {}
|
|
1346
|
+
: { metadata: request.metadata }),
|
|
1347
|
+
}), (payload) => client.stepUp.verifyPasskey({ payload })), requestOptions);
|
|
1348
|
+
},
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
974
1351
|
loginApproval: {
|
|
975
1352
|
approve: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeLoginApprovalApprove(input), (payload) => client.loginApproval.approve({ payload })), requestOptions),
|
|
976
1353
|
status: (input, requestOptions) => withClient((client) => Effect.flatMap(decodeLoginApprovalStatus(input), (payload) => client.loginApproval.status({ payload })), requestOptions),
|
|
@@ -981,5 +1358,9 @@ export const createAuthClient = (options = {}) => {
|
|
|
981
1358
|
},
|
|
982
1359
|
dispose: () => runtime.dispose(),
|
|
983
1360
|
};
|
|
1361
|
+
return mergeAuthProtocol(standard, options.protocol ?? {}, {
|
|
1362
|
+
baseUrl: options.baseUrl,
|
|
1363
|
+
run,
|
|
1364
|
+
});
|
|
984
1365
|
};
|
|
985
1366
|
//# sourceMappingURL=Client.js.map
|