@effect-auth/core 0.1.0-alpha.0 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +774 -36
- package/dist/ApiKey.d.ts +207 -0
- package/dist/ApiKey.d.ts.map +1 -0
- package/dist/ApiKey.js +275 -0
- package/dist/ApiKey.js.map +1 -0
- package/dist/AuditLog.d.ts +278 -1
- package/dist/AuditLog.d.ts.map +1 -1
- package/dist/AuditLog.js +217 -2
- package/dist/AuditLog.js.map +1 -1
- package/dist/AuthConfig.d.ts +42 -0
- package/dist/AuthConfig.d.ts.map +1 -0
- package/dist/AuthConfig.js +43 -0
- package/dist/AuthConfig.js.map +1 -0
- package/dist/AuthFlow.d.ts +465 -36
- package/dist/AuthFlow.d.ts.map +1 -1
- package/dist/AuthFlow.js +660 -5
- package/dist/AuthFlow.js.map +1 -1
- package/dist/AuthKernel.d.ts +3 -0
- package/dist/AuthKernel.d.ts.map +1 -0
- package/dist/AuthKernel.js +9 -0
- package/dist/AuthKernel.js.map +1 -0
- package/dist/Challenge.d.ts +27 -4
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +170 -1
- package/dist/Challenge.js.map +1 -1
- package/dist/Client.d.ts +378 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +768 -0
- package/dist/Client.js.map +1 -0
- package/dist/Crypto.d.ts +9 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +65 -1
- package/dist/Crypto.js.map +1 -1
- package/dist/EffectQbSqliteStorage.d.ts +600 -0
- package/dist/EffectQbSqliteStorage.d.ts.map +1 -0
- package/dist/EffectQbSqliteStorage.js +1637 -0
- package/dist/EffectQbSqliteStorage.js.map +1 -0
- package/dist/EmailOtp.d.ts +120 -0
- package/dist/EmailOtp.d.ts.map +1 -0
- package/dist/EmailOtp.js +286 -0
- package/dist/EmailOtp.js.map +1 -0
- package/dist/EmailVerification.d.ts +121 -0
- package/dist/EmailVerification.d.ts.map +1 -0
- package/dist/EmailVerification.js +200 -0
- package/dist/EmailVerification.js.map +1 -0
- package/dist/HttpApi/Api.d.ts +1956 -0
- package/dist/HttpApi/Api.d.ts.map +1 -0
- package/dist/HttpApi/Api.js +2325 -0
- package/dist/HttpApi/Api.js.map +1 -0
- package/dist/HttpApi/Endpoints.d.ts +945 -0
- package/dist/HttpApi/Endpoints.d.ts.map +1 -0
- package/dist/HttpApi/Endpoints.js +373 -0
- package/dist/HttpApi/Endpoints.js.map +1 -0
- package/dist/HttpApi/Errors.d.ts +82 -0
- package/dist/HttpApi/Errors.d.ts.map +1 -0
- package/dist/HttpApi/Errors.js +184 -0
- package/dist/HttpApi/Errors.js.map +1 -0
- package/dist/HttpApi/Schemas.d.ts +1113 -0
- package/dist/HttpApi/Schemas.d.ts.map +1 -0
- package/dist/HttpApi/Schemas.js +734 -0
- package/dist/HttpApi/Schemas.js.map +1 -0
- package/dist/HttpApi/Security.d.ts +159 -0
- package/dist/HttpApi/Security.d.ts.map +1 -0
- package/dist/HttpApi/Security.js +530 -0
- package/dist/HttpApi/Security.js.map +1 -0
- package/dist/HttpApi/Transport.d.ts +65 -0
- package/dist/HttpApi/Transport.d.ts.map +1 -0
- package/dist/HttpApi/Transport.js +311 -0
- package/dist/HttpApi/Transport.js.map +1 -0
- package/dist/HttpApi/index.d.ts +8 -0
- package/dist/HttpApi/index.d.ts.map +1 -0
- package/dist/HttpApi/index.js +7 -0
- package/dist/HttpApi/index.js.map +1 -0
- package/dist/HttpApi.d.ts +2 -0
- package/dist/HttpApi.d.ts.map +1 -0
- package/dist/HttpApi.js +2 -0
- package/dist/HttpApi.js.map +1 -0
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js.map +1 -1
- package/dist/Internal.d.ts +7 -0
- package/dist/Internal.d.ts.map +1 -0
- package/dist/Internal.js +12 -0
- package/dist/Internal.js.map +1 -0
- package/dist/Jwt.d.ts +271 -0
- package/dist/Jwt.d.ts.map +1 -0
- package/dist/Jwt.js +512 -0
- package/dist/Jwt.js.map +1 -0
- package/dist/LoginApproval.d.ts +314 -0
- package/dist/LoginApproval.d.ts.map +1 -0
- package/dist/LoginApproval.js +551 -0
- package/dist/LoginApproval.js.map +1 -0
- package/dist/LoginNotification.d.ts +183 -0
- package/dist/LoginNotification.d.ts.map +1 -0
- package/dist/LoginNotification.js +329 -0
- package/dist/LoginNotification.js.map +1 -0
- package/dist/LoginRisk.d.ts +73 -0
- package/dist/LoginRisk.d.ts.map +1 -0
- package/dist/LoginRisk.js +57 -0
- package/dist/LoginRisk.js.map +1 -0
- package/dist/MagicLink.d.ts +85 -0
- package/dist/MagicLink.d.ts.map +1 -0
- package/dist/MagicLink.js +206 -0
- package/dist/MagicLink.js.map +1 -0
- package/dist/Mailer.d.ts +147 -0
- package/dist/Mailer.d.ts.map +1 -0
- package/dist/Mailer.js +208 -0
- package/dist/Mailer.js.map +1 -0
- package/dist/OAuth.d.ts +934 -0
- package/dist/OAuth.d.ts.map +1 -0
- package/dist/OAuth.js +1661 -0
- package/dist/OAuth.js.map +1 -0
- package/dist/Passkey.d.ts +334 -0
- package/dist/Passkey.d.ts.map +1 -0
- package/dist/Passkey.js +422 -0
- package/dist/Passkey.js.map +1 -0
- package/dist/PasskeySimpleWebAuthn.d.ts +11 -0
- package/dist/PasskeySimpleWebAuthn.d.ts.map +1 -0
- package/dist/PasskeySimpleWebAuthn.js +181 -0
- package/dist/PasskeySimpleWebAuthn.js.map +1 -0
- package/dist/Password.d.ts +237 -0
- package/dist/Password.d.ts.map +1 -0
- package/dist/Password.js +641 -0
- package/dist/Password.js.map +1 -0
- package/dist/Policy.d.ts +7 -4
- package/dist/Policy.d.ts.map +1 -1
- package/dist/Policy.js +28 -5
- package/dist/Policy.js.map +1 -1
- package/dist/Privacy.d.ts +18 -0
- package/dist/Privacy.d.ts.map +1 -1
- package/dist/Privacy.js +63 -3
- package/dist/Privacy.js.map +1 -1
- package/dist/RateLimiter.d.ts +104 -0
- package/dist/RateLimiter.d.ts.map +1 -0
- package/dist/RateLimiter.js +118 -0
- package/dist/RateLimiter.js.map +1 -0
- package/dist/RecoveryCode.d.ts +169 -0
- package/dist/RecoveryCode.d.ts.map +1 -0
- package/dist/RecoveryCode.js +299 -0
- package/dist/RecoveryCode.js.map +1 -0
- package/dist/RefreshToken.d.ts +222 -0
- package/dist/RefreshToken.d.ts.map +1 -0
- package/dist/RefreshToken.js +342 -0
- package/dist/RefreshToken.js.map +1 -0
- package/dist/SecurityTimeline.d.ts +72 -0
- package/dist/SecurityTimeline.d.ts.map +1 -0
- package/dist/SecurityTimeline.js +386 -0
- package/dist/SecurityTimeline.js.map +1 -0
- package/dist/Sessions.d.ts +135 -11
- package/dist/Sessions.d.ts.map +1 -1
- package/dist/Sessions.js +546 -1
- package/dist/Sessions.js.map +1 -1
- package/dist/StepUp.d.ts +44 -0
- package/dist/StepUp.d.ts.map +1 -0
- package/dist/StepUp.js +82 -0
- package/dist/StepUp.js.map +1 -0
- package/dist/Storage.d.ts +175 -0
- package/dist/Storage.d.ts.map +1 -0
- package/dist/Storage.js +27 -0
- package/dist/Storage.js.map +1 -0
- package/dist/StorageMigrations.d.ts +19 -0
- package/dist/StorageMigrations.d.ts.map +1 -0
- package/dist/StorageMigrations.js +291 -0
- package/dist/StorageMigrations.js.map +1 -0
- package/dist/Testing.d.ts +9 -1
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js +30 -2
- package/dist/Testing.js.map +1 -1
- package/dist/Totp.d.ts +220 -0
- package/dist/Totp.d.ts.map +1 -0
- package/dist/Totp.js +477 -0
- package/dist/Totp.js.map +1 -0
- package/dist/TrustedDevice.d.ts +127 -0
- package/dist/TrustedDevice.d.ts.map +1 -0
- package/dist/TrustedDevice.js +252 -0
- package/dist/TrustedDevice.js.map +1 -0
- package/dist/WaitUntil.d.ts +3 -0
- package/dist/WaitUntil.d.ts.map +1 -1
- package/dist/WaitUntil.js +6 -3
- package/dist/WaitUntil.js.map +1 -1
- package/dist/Webhook.d.ts +72 -0
- package/dist/Webhook.d.ts.map +1 -0
- package/dist/Webhook.js +82 -0
- package/dist/Webhook.js.map +1 -0
- package/dist/alchemy/cloudflare/Email.d.ts +25 -0
- package/dist/alchemy/cloudflare/Email.d.ts.map +1 -0
- package/dist/alchemy/cloudflare/Email.js +117 -0
- package/dist/alchemy/cloudflare/Email.js.map +1 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts +34 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js +30 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js.map +1 -0
- package/dist/cloudflare/Email.d.ts +25 -0
- package/dist/cloudflare/Email.d.ts.map +1 -0
- package/dist/cloudflare/Email.js +153 -0
- package/dist/cloudflare/Email.js.map +1 -0
- package/dist/cloudflare/RateLimitDurableObject.d.ts +50 -0
- package/dist/cloudflare/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/cloudflare/RateLimitDurableObject.js +51 -0
- package/dist/cloudflare/RateLimitDurableObject.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/RateLimitDurableObject.d.ts +32 -0
- package/dist/internal/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/internal/RateLimitDurableObject.js +80 -0
- package/dist/internal/RateLimitDurableObject.js.map +1 -0
- package/migrations/0001_auth_storage.sql +32 -0
- package/migrations/0002_auth_password.sql +25 -0
- package/migrations/0003_auth_login_approval_review.sql +22 -0
- package/migrations/0004_auth_trusted_device.sql +12 -0
- package/migrations/0005_auth_passkey.sql +17 -0
- package/migrations/0006_auth_totp_factor.sql +17 -0
- package/migrations/0007_auth_recovery_code.sql +13 -0
- package/migrations/0008_auth_api_key.sql +17 -0
- package/migrations/0009_auth_refresh_token.sql +21 -0
- package/migrations/0010_auth_jwt_revocation.sql +8 -0
- package/migrations/0011_auth_oauth_account.sql +16 -0
- package/migrations/0012_auth_oauth_provider_token_vault.sql +20 -0
- package/migrations/0013_auth_security_timeline.sql +16 -0
- package/package.json +161 -16
- package/LICENSE +0 -21
package/dist/OAuth.d.ts
ADDED
|
@@ -0,0 +1,934 @@
|
|
|
1
|
+
import { Brand, Context, Duration, Effect, Layer, Redacted } from "effect";
|
|
2
|
+
import type * as OptionTypes from "effect/Option";
|
|
3
|
+
import { Challenge } from "./Challenge.js";
|
|
4
|
+
import type { ChallengeService } from "./Challenge.js";
|
|
5
|
+
import { Crypto } from "./Crypto.js";
|
|
6
|
+
import type { CryptoService } from "./Crypto.js";
|
|
7
|
+
import { ChallengeId, Email, OAuthAccountId, OAuthProviderId, UnixMillis, UserId } from "./Identifiers.js";
|
|
8
|
+
import { JwtError, JwtVerifier, type JwksDocument, type JwtAudience, type JwtAlgorithm, type JwtClaims, type JwtHeader, type JwtKeyInfo, type JwtKeysService, type JwtVerifierService, type JwtVerificationFailureReason } from "./Jwt.js";
|
|
9
|
+
export type OAuthStateToken = Brand.Branded<string, "auth/OAuthStateToken">;
|
|
10
|
+
export declare const OAuthStateToken: Brand.Constructor<OAuthStateToken>;
|
|
11
|
+
export type OAuthCodeVerifier = Brand.Branded<string, "auth/OAuthCodeVerifier">;
|
|
12
|
+
export declare const OAuthCodeVerifier: Brand.Constructor<OAuthCodeVerifier>;
|
|
13
|
+
export type OAuthCodeChallenge = Brand.Branded<string, "auth/OAuthCodeChallenge">;
|
|
14
|
+
export declare const OAuthCodeChallenge: Brand.Constructor<OAuthCodeChallenge>;
|
|
15
|
+
export type OAuthNonce = Brand.Branded<string, "auth/OAuthNonce">;
|
|
16
|
+
export declare const OAuthNonce: Brand.Constructor<OAuthNonce>;
|
|
17
|
+
export type OAuthAuthorizationCode = Brand.Branded<string, "auth/OAuthAuthorizationCode">;
|
|
18
|
+
export declare const OAuthAuthorizationCode: Brand.Constructor<OAuthAuthorizationCode>;
|
|
19
|
+
export type OAuthAccessToken = Brand.Branded<string, "auth/OAuthAccessToken">;
|
|
20
|
+
export declare const OAuthAccessToken: Brand.Constructor<OAuthAccessToken>;
|
|
21
|
+
export type OAuthRefreshToken = Brand.Branded<string, "auth/OAuthRefreshToken">;
|
|
22
|
+
export declare const OAuthRefreshToken: Brand.Constructor<OAuthRefreshToken>;
|
|
23
|
+
export type OAuthIdToken = Brand.Branded<string, "auth/OAuthIdToken">;
|
|
24
|
+
export declare const OAuthIdToken: Brand.Constructor<OAuthIdToken>;
|
|
25
|
+
export declare const defaultOAuthStateTtl: Duration.Duration;
|
|
26
|
+
export declare const defaultOAuthLinkConfirmationTtl: Duration.Duration;
|
|
27
|
+
export declare const defaultOAuthJwksCacheTtl: Duration.Duration;
|
|
28
|
+
export declare const defaultOAuthStateSecretBytes = 32;
|
|
29
|
+
export declare const defaultOAuthCodeVerifierBytes = 32;
|
|
30
|
+
export declare const defaultOAuthLinkConfirmationSecretBytes = 32;
|
|
31
|
+
export declare const defaultOAuthNonceBytes = 16;
|
|
32
|
+
export declare const appleSignInProviderId: OAuthProviderId;
|
|
33
|
+
export declare const appleSignInIssuer = "https://appleid.apple.com";
|
|
34
|
+
export declare const appleSignInAuthorizationEndpoint = "https://appleid.apple.com/auth/authorize";
|
|
35
|
+
export declare const appleSignInTokenEndpoint = "https://appleid.apple.com/auth/token";
|
|
36
|
+
export declare const appleSignInRevocationEndpoint = "https://appleid.apple.com/auth/revoke";
|
|
37
|
+
export declare const appleSignInJwksUri = "https://appleid.apple.com/auth/keys";
|
|
38
|
+
export declare const appleSignInPrivateRelayDomain = "privaterelay.appleid.com";
|
|
39
|
+
export declare const appleSignInDefaultScopes: readonly ["openid", "email", "name"];
|
|
40
|
+
export declare const appleSignInDefaultAuthorizationParams: {
|
|
41
|
+
readonly response_mode: "form_post";
|
|
42
|
+
};
|
|
43
|
+
export declare const githubOAuthProviderId: OAuthProviderId;
|
|
44
|
+
export declare const githubOAuthAuthorizationEndpoint = "https://github.com/login/oauth/authorize";
|
|
45
|
+
export declare const githubOAuthTokenEndpoint = "https://github.com/login/oauth/access_token";
|
|
46
|
+
export declare const githubOAuthUserEndpoint = "https://api.github.com/user";
|
|
47
|
+
export declare const githubOAuthEmailsEndpoint = "https://api.github.com/user/emails";
|
|
48
|
+
export declare const githubOAuthDefaultScopes: readonly ["read:user", "user:email"];
|
|
49
|
+
export declare const githubOAuthApiVersion = "2022-11-28";
|
|
50
|
+
export declare const githubOAuthApiVersionHeader: {
|
|
51
|
+
readonly "x-github-api-version": "2022-11-28";
|
|
52
|
+
};
|
|
53
|
+
export declare const googleOidcProviderId: OAuthProviderId;
|
|
54
|
+
export declare const googleOidcIssuer = "https://accounts.google.com";
|
|
55
|
+
export declare const googleOidcAuthorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
56
|
+
export declare const googleOidcTokenEndpoint = "https://oauth2.googleapis.com/token";
|
|
57
|
+
export declare const googleOidcRevocationEndpoint = "https://oauth2.googleapis.com/revoke";
|
|
58
|
+
export declare const googleOidcUserInfoEndpoint = "https://openidconnect.googleapis.com/v1/userinfo";
|
|
59
|
+
export declare const googleOidcJwksUri = "https://www.googleapis.com/oauth2/v3/certs";
|
|
60
|
+
export declare const googleOidcDefaultScopes: readonly ["openid", "email", "profile"];
|
|
61
|
+
export declare const googleOidcOfflineAccessAuthorizationParams: {
|
|
62
|
+
readonly access_type: "offline";
|
|
63
|
+
readonly prompt: "consent";
|
|
64
|
+
};
|
|
65
|
+
export declare const microsoftOidcProviderId: OAuthProviderId;
|
|
66
|
+
export declare const microsoftOidcLoginBaseUrl = "https://login.microsoftonline.com";
|
|
67
|
+
export declare const microsoftOidcUserInfoEndpoint = "https://graph.microsoft.com/oidc/userinfo";
|
|
68
|
+
export declare const microsoftOidcDefaultScopes: readonly ["openid", "email", "profile"];
|
|
69
|
+
export declare const microsoftOidcOfflineAccessScopes: readonly ["openid", "email", "profile", "offline_access"];
|
|
70
|
+
export declare const genericOidcDefaultScopes: readonly ["openid", "email", "profile"];
|
|
71
|
+
export declare const microsoftOidcAuthorizationEndpoint: (tenant: string) => string;
|
|
72
|
+
export declare const microsoftOidcTokenEndpoint: (tenant: string) => string;
|
|
73
|
+
export declare const microsoftOidcJwksUri: (tenant: string) => string;
|
|
74
|
+
export declare const microsoftOidcIssuer: (tenant: string) => string;
|
|
75
|
+
export interface GoogleOidcProviderOptions {
|
|
76
|
+
readonly clientId: string;
|
|
77
|
+
readonly redirectUri: string;
|
|
78
|
+
readonly id?: OAuthProviderId;
|
|
79
|
+
readonly scopes?: readonly string[];
|
|
80
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
81
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
82
|
+
}
|
|
83
|
+
export interface GithubOAuthProviderOptions {
|
|
84
|
+
readonly clientId: string;
|
|
85
|
+
readonly redirectUri: string;
|
|
86
|
+
readonly id?: OAuthProviderId;
|
|
87
|
+
readonly scopes?: readonly string[];
|
|
88
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
89
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
90
|
+
}
|
|
91
|
+
export interface MicrosoftOidcProviderOptions {
|
|
92
|
+
readonly tenant: string;
|
|
93
|
+
readonly clientId: string;
|
|
94
|
+
readonly redirectUri: string;
|
|
95
|
+
readonly id?: OAuthProviderId;
|
|
96
|
+
readonly scopes?: readonly string[];
|
|
97
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
98
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
99
|
+
}
|
|
100
|
+
export interface AppleSignInProviderOptions {
|
|
101
|
+
readonly clientId: string;
|
|
102
|
+
readonly redirectUri: string;
|
|
103
|
+
readonly id?: OAuthProviderId;
|
|
104
|
+
readonly scopes?: readonly string[];
|
|
105
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
106
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
107
|
+
}
|
|
108
|
+
export interface GenericOidcProviderOptions {
|
|
109
|
+
readonly id: OAuthProviderId;
|
|
110
|
+
readonly issuer: string;
|
|
111
|
+
readonly clientId: string;
|
|
112
|
+
readonly authorizationEndpoint: string;
|
|
113
|
+
readonly tokenEndpoint: string;
|
|
114
|
+
readonly redirectUri: string;
|
|
115
|
+
readonly userInfoEndpoint?: string;
|
|
116
|
+
readonly jwksUri?: string;
|
|
117
|
+
readonly revocationEndpoint?: string;
|
|
118
|
+
readonly scopes?: readonly string[];
|
|
119
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
120
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
121
|
+
}
|
|
122
|
+
export interface AppleSignInAuthorizationUser {
|
|
123
|
+
readonly email?: string;
|
|
124
|
+
readonly name?: {
|
|
125
|
+
readonly firstName?: string;
|
|
126
|
+
readonly lastName?: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface GithubOAuthEmailRecord {
|
|
130
|
+
readonly email: string;
|
|
131
|
+
readonly primary?: boolean;
|
|
132
|
+
readonly verified?: boolean;
|
|
133
|
+
readonly visibility?: string | null;
|
|
134
|
+
}
|
|
135
|
+
export interface OAuthProviderConfig {
|
|
136
|
+
readonly id: OAuthProviderId;
|
|
137
|
+
readonly clientId: string;
|
|
138
|
+
readonly authorizationEndpoint: string;
|
|
139
|
+
readonly redirectUri: string;
|
|
140
|
+
readonly scopes?: readonly string[];
|
|
141
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
142
|
+
readonly issuer?: string;
|
|
143
|
+
readonly tokenEndpoint?: string;
|
|
144
|
+
readonly revocationEndpoint?: string;
|
|
145
|
+
readonly userInfoEndpoint?: string;
|
|
146
|
+
readonly jwksUri?: string;
|
|
147
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
148
|
+
}
|
|
149
|
+
export interface OAuthJwksFetchInput {
|
|
150
|
+
readonly provider: OAuthProviderConfig;
|
|
151
|
+
readonly url: string;
|
|
152
|
+
}
|
|
153
|
+
export interface OAuthJwksJwtKeysDependencies {
|
|
154
|
+
readonly provider: OAuthProviderConfig;
|
|
155
|
+
readonly fetch: (input: OAuthJwksFetchInput) => Effect.Effect<unknown, JwtError>;
|
|
156
|
+
readonly cacheTtl?: Duration.Duration;
|
|
157
|
+
readonly allowedAlgorithms?: readonly JwtAlgorithm[];
|
|
158
|
+
}
|
|
159
|
+
export type OAuthProviderOperation = "get";
|
|
160
|
+
declare const OAuthProviderError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
161
|
+
readonly _tag: "OAuthProviderError";
|
|
162
|
+
} & Readonly<A>;
|
|
163
|
+
export declare class OAuthProviderError extends OAuthProviderError_base<{
|
|
164
|
+
readonly operation: OAuthProviderOperation;
|
|
165
|
+
readonly message: string;
|
|
166
|
+
readonly cause?: unknown;
|
|
167
|
+
}> {
|
|
168
|
+
}
|
|
169
|
+
export interface OAuthProvidersService {
|
|
170
|
+
readonly get: (id: OAuthProviderId) => Effect.Effect<OptionTypes.Option<OAuthProviderConfig>, OAuthProviderError>;
|
|
171
|
+
}
|
|
172
|
+
export type OAuthClientAuthentication = {
|
|
173
|
+
readonly method: "none";
|
|
174
|
+
} | {
|
|
175
|
+
readonly method: "client_secret_basic";
|
|
176
|
+
readonly clientSecret: Redacted.Redacted<string>;
|
|
177
|
+
} | {
|
|
178
|
+
readonly method: "client_secret_post";
|
|
179
|
+
readonly clientSecret: Redacted.Redacted<string>;
|
|
180
|
+
};
|
|
181
|
+
export interface OAuthAuthorizationCodeTokenInput {
|
|
182
|
+
readonly provider: OAuthProviderConfig;
|
|
183
|
+
readonly code: OAuthAuthorizationCode | string;
|
|
184
|
+
readonly codeVerifier: Redacted.Redacted<OAuthCodeVerifier | string>;
|
|
185
|
+
readonly redirectUri?: string;
|
|
186
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
187
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
188
|
+
}
|
|
189
|
+
export interface OAuthRefreshTokenInput {
|
|
190
|
+
readonly provider: OAuthProviderConfig;
|
|
191
|
+
readonly refreshToken: Redacted.Redacted<OAuthRefreshToken | string>;
|
|
192
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
193
|
+
readonly scopes?: readonly string[];
|
|
194
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
195
|
+
}
|
|
196
|
+
export type OAuthTokenRevocationHint = "access_token" | "refresh_token";
|
|
197
|
+
export interface OAuthTokenRevocationInput {
|
|
198
|
+
readonly provider: OAuthProviderConfig;
|
|
199
|
+
readonly token: Redacted.Redacted<OAuthAccessToken | OAuthRefreshToken | string>;
|
|
200
|
+
readonly tokenTypeHint?: OAuthTokenRevocationHint;
|
|
201
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
202
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
203
|
+
}
|
|
204
|
+
export interface OAuthTokenRequest {
|
|
205
|
+
readonly url: string;
|
|
206
|
+
readonly method: "POST";
|
|
207
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
208
|
+
readonly body: string;
|
|
209
|
+
}
|
|
210
|
+
export interface OAuthUserInfoRequestInput {
|
|
211
|
+
readonly provider: OAuthProviderConfig;
|
|
212
|
+
readonly accessToken: Redacted.Redacted<OAuthAccessToken | string>;
|
|
213
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
214
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
215
|
+
}
|
|
216
|
+
export interface OAuthUserInfoRequest {
|
|
217
|
+
readonly url: string;
|
|
218
|
+
readonly method: "GET";
|
|
219
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
220
|
+
}
|
|
221
|
+
export type OAuthUserInfo = Readonly<Record<string, unknown>>;
|
|
222
|
+
export type OAuthUserInfoOperation = "request" | "decode";
|
|
223
|
+
declare const OAuthUserInfoError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
224
|
+
readonly _tag: "OAuthUserInfoError";
|
|
225
|
+
} & Readonly<A>;
|
|
226
|
+
export declare class OAuthUserInfoError extends OAuthUserInfoError_base<{
|
|
227
|
+
readonly operation: OAuthUserInfoOperation;
|
|
228
|
+
readonly message: string;
|
|
229
|
+
readonly cause?: unknown;
|
|
230
|
+
}> {
|
|
231
|
+
}
|
|
232
|
+
export interface OAuthTokenResponse {
|
|
233
|
+
readonly accessToken: Redacted.Redacted<OAuthAccessToken>;
|
|
234
|
+
readonly tokenType: string;
|
|
235
|
+
readonly expiresIn?: number;
|
|
236
|
+
readonly refreshToken?: Redacted.Redacted<OAuthRefreshToken>;
|
|
237
|
+
readonly idToken?: Redacted.Redacted<OAuthIdToken>;
|
|
238
|
+
readonly scopes?: readonly string[];
|
|
239
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
240
|
+
}
|
|
241
|
+
export interface OAuthProviderTokenVaultRecord {
|
|
242
|
+
readonly accountId: OAuthAccountId;
|
|
243
|
+
readonly userId: UserId;
|
|
244
|
+
readonly providerId: OAuthProviderId;
|
|
245
|
+
readonly providerAccountId: string;
|
|
246
|
+
readonly accessTokenCiphertext: Redacted.Redacted<string>;
|
|
247
|
+
readonly refreshTokenCiphertext?: Redacted.Redacted<string>;
|
|
248
|
+
readonly idTokenCiphertext?: Redacted.Redacted<string>;
|
|
249
|
+
readonly tokenType: string;
|
|
250
|
+
readonly scopes?: readonly string[];
|
|
251
|
+
readonly expiresAt?: UnixMillis;
|
|
252
|
+
readonly updatedAt: UnixMillis;
|
|
253
|
+
readonly revokedAt?: UnixMillis;
|
|
254
|
+
readonly revocationReason?: string;
|
|
255
|
+
}
|
|
256
|
+
export interface OAuthProviderTokenVaultTokens {
|
|
257
|
+
readonly accessTokenCiphertext: Redacted.Redacted<string>;
|
|
258
|
+
readonly refreshTokenCiphertext?: Redacted.Redacted<string>;
|
|
259
|
+
readonly idTokenCiphertext?: Redacted.Redacted<string>;
|
|
260
|
+
readonly tokenType: string;
|
|
261
|
+
readonly scopes?: readonly string[];
|
|
262
|
+
readonly expiresAt?: UnixMillis;
|
|
263
|
+
}
|
|
264
|
+
export interface OAuthProviderTokenVaultLookupInput {
|
|
265
|
+
readonly accountId: OAuthAccountId;
|
|
266
|
+
}
|
|
267
|
+
export interface OAuthProviderTokenVaultMarkRevokedInput {
|
|
268
|
+
readonly accountId: OAuthAccountId;
|
|
269
|
+
readonly revokedAt: UnixMillis;
|
|
270
|
+
readonly reason: string;
|
|
271
|
+
}
|
|
272
|
+
export type OAuthProviderTokenVaultOperation = "upsert" | "refresh-token" | "tokens" | "mark-revoked";
|
|
273
|
+
declare const OAuthProviderTokenVaultError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
274
|
+
readonly _tag: "OAuthProviderTokenVaultError";
|
|
275
|
+
} & Readonly<A>;
|
|
276
|
+
export declare class OAuthProviderTokenVaultError extends OAuthProviderTokenVaultError_base<{
|
|
277
|
+
readonly operation: OAuthProviderTokenVaultOperation;
|
|
278
|
+
readonly message: string;
|
|
279
|
+
readonly cause?: unknown;
|
|
280
|
+
}> {
|
|
281
|
+
}
|
|
282
|
+
export interface OAuthProviderTokenVaultService {
|
|
283
|
+
readonly upsert: (record: OAuthProviderTokenVaultRecord) => Effect.Effect<void, OAuthProviderTokenVaultError>;
|
|
284
|
+
readonly refreshTokenForAccount: (input: OAuthProviderTokenVaultLookupInput) => Effect.Effect<OptionTypes.Option<Redacted.Redacted<string>>, OAuthProviderTokenVaultError>;
|
|
285
|
+
readonly tokensForAccount: (input: OAuthProviderTokenVaultLookupInput) => Effect.Effect<OptionTypes.Option<OAuthProviderTokenVaultTokens>, OAuthProviderTokenVaultError>;
|
|
286
|
+
readonly markRevoked: (input: OAuthProviderTokenVaultMarkRevokedInput) => Effect.Effect<OptionTypes.Option<OAuthProviderTokenVaultRecord>, OAuthProviderTokenVaultError>;
|
|
287
|
+
}
|
|
288
|
+
declare const OAuthProviderTokenVault_base: Context.ServiceClass<OAuthProviderTokenVault, "auth/OAuthProviderTokenVault", OAuthProviderTokenVaultService>;
|
|
289
|
+
export declare class OAuthProviderTokenVault extends OAuthProviderTokenVault_base {
|
|
290
|
+
}
|
|
291
|
+
export declare namespace OAuthProviderTokenVault {
|
|
292
|
+
const make: (service: OAuthProviderTokenVaultService) => OAuthProviderTokenVaultService;
|
|
293
|
+
}
|
|
294
|
+
export interface OAuthProviderTokenLifecycleStoreInput {
|
|
295
|
+
readonly accountId: OAuthAccountId;
|
|
296
|
+
readonly userId: UserId;
|
|
297
|
+
readonly providerId: OAuthProviderId;
|
|
298
|
+
readonly providerAccountId: string;
|
|
299
|
+
readonly tokens: OAuthTokenResponse;
|
|
300
|
+
readonly fallbackRefreshTokenCiphertext?: Redacted.Redacted<string>;
|
|
301
|
+
readonly now?: UnixMillis;
|
|
302
|
+
}
|
|
303
|
+
export interface OAuthProviderTokenLifecycleStoreResult {
|
|
304
|
+
readonly accountId: OAuthAccountId;
|
|
305
|
+
readonly expiresAt?: UnixMillis;
|
|
306
|
+
readonly hasRefreshToken: boolean;
|
|
307
|
+
readonly scopes: readonly string[];
|
|
308
|
+
}
|
|
309
|
+
export interface OAuthProviderTokenLifecycleRefreshInput {
|
|
310
|
+
readonly accountId: OAuthAccountId;
|
|
311
|
+
readonly userId: UserId;
|
|
312
|
+
readonly providerId: OAuthProviderId;
|
|
313
|
+
readonly providerAccountId: string;
|
|
314
|
+
readonly provider: OAuthProviderConfig;
|
|
315
|
+
readonly now?: UnixMillis;
|
|
316
|
+
readonly scopes?: readonly string[];
|
|
317
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
318
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
319
|
+
}
|
|
320
|
+
export type OAuthProviderTokenLifecycleRefreshResult = {
|
|
321
|
+
readonly status: "missing-refresh-token";
|
|
322
|
+
readonly accountId: OAuthAccountId;
|
|
323
|
+
} | ({
|
|
324
|
+
readonly status: "refreshed";
|
|
325
|
+
} & OAuthProviderTokenLifecycleStoreResult);
|
|
326
|
+
export interface OAuthProviderTokenLifecycleRevokeInput {
|
|
327
|
+
readonly accountId: OAuthAccountId;
|
|
328
|
+
readonly provider: OAuthProviderConfig;
|
|
329
|
+
readonly reason: string;
|
|
330
|
+
readonly now?: UnixMillis;
|
|
331
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
332
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
333
|
+
}
|
|
334
|
+
export type OAuthProviderTokenLifecycleRevokeResult = {
|
|
335
|
+
readonly status: "missing-tokens";
|
|
336
|
+
readonly accountId: OAuthAccountId;
|
|
337
|
+
} | {
|
|
338
|
+
readonly status: "revoked";
|
|
339
|
+
readonly accountId: OAuthAccountId;
|
|
340
|
+
readonly revokedAt: UnixMillis;
|
|
341
|
+
};
|
|
342
|
+
export type OAuthProviderTokenLifecycleOperation = "store" | "refresh" | "revoke";
|
|
343
|
+
declare const OAuthProviderTokenLifecycleError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
344
|
+
readonly _tag: "OAuthProviderTokenLifecycleError";
|
|
345
|
+
} & Readonly<A>;
|
|
346
|
+
export declare class OAuthProviderTokenLifecycleError extends OAuthProviderTokenLifecycleError_base<{
|
|
347
|
+
readonly operation: OAuthProviderTokenLifecycleOperation;
|
|
348
|
+
readonly message: string;
|
|
349
|
+
readonly cause?: unknown;
|
|
350
|
+
}> {
|
|
351
|
+
}
|
|
352
|
+
export interface OAuthProviderTokenLifecycleService {
|
|
353
|
+
readonly store: (input: OAuthProviderTokenLifecycleStoreInput) => Effect.Effect<OAuthProviderTokenLifecycleStoreResult, OAuthProviderTokenLifecycleError>;
|
|
354
|
+
readonly refresh: (input: OAuthProviderTokenLifecycleRefreshInput) => Effect.Effect<OAuthProviderTokenLifecycleRefreshResult, OAuthProviderTokenLifecycleError>;
|
|
355
|
+
readonly revoke: (input: OAuthProviderTokenLifecycleRevokeInput) => Effect.Effect<OAuthProviderTokenLifecycleRevokeResult, OAuthProviderTokenLifecycleError>;
|
|
356
|
+
}
|
|
357
|
+
declare const OAuthProviderTokenLifecycle_base: Context.ServiceClass<OAuthProviderTokenLifecycle, "auth/OAuthProviderTokenLifecycle", OAuthProviderTokenLifecycleService>;
|
|
358
|
+
export declare class OAuthProviderTokenLifecycle extends OAuthProviderTokenLifecycle_base {
|
|
359
|
+
}
|
|
360
|
+
export declare namespace OAuthProviderTokenLifecycle {
|
|
361
|
+
const make: (service: OAuthProviderTokenLifecycleService) => OAuthProviderTokenLifecycleService;
|
|
362
|
+
}
|
|
363
|
+
export interface OAuthProviderTokenLifecycleDependencies {
|
|
364
|
+
readonly tokenVault: OAuthProviderTokenVaultService;
|
|
365
|
+
readonly encryptToken: (token: Redacted.Redacted<string>) => Effect.Effect<Redacted.Redacted<string>, unknown>;
|
|
366
|
+
readonly decryptToken: (ciphertext: Redacted.Redacted<string>) => Effect.Effect<Redacted.Redacted<string>, unknown>;
|
|
367
|
+
readonly request: (request: OAuthTokenRequest) => Effect.Effect<unknown, unknown>;
|
|
368
|
+
}
|
|
369
|
+
export type OAuthProviderTokenLifecycleLiveOptions = Omit<OAuthProviderTokenLifecycleDependencies, "tokenVault">;
|
|
370
|
+
export interface GoogleOidcProviderTokenRefreshInput {
|
|
371
|
+
readonly accountId: OAuthAccountId;
|
|
372
|
+
readonly userId: UserId;
|
|
373
|
+
readonly providerAccountId: string;
|
|
374
|
+
readonly provider: OAuthProviderConfig;
|
|
375
|
+
readonly now?: UnixMillis;
|
|
376
|
+
readonly scopes?: readonly string[];
|
|
377
|
+
readonly clientSecret?: Redacted.Redacted<string>;
|
|
378
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
379
|
+
}
|
|
380
|
+
export interface GoogleOidcProviderTokenRevokeInput {
|
|
381
|
+
readonly accountId: OAuthAccountId;
|
|
382
|
+
readonly provider: OAuthProviderConfig;
|
|
383
|
+
readonly reason: string;
|
|
384
|
+
readonly now?: UnixMillis;
|
|
385
|
+
readonly clientSecret?: Redacted.Redacted<string>;
|
|
386
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
387
|
+
}
|
|
388
|
+
export interface MicrosoftOidcProviderTokenRefreshInput {
|
|
389
|
+
readonly accountId: OAuthAccountId;
|
|
390
|
+
readonly userId: UserId;
|
|
391
|
+
readonly providerAccountId: string;
|
|
392
|
+
readonly provider: OAuthProviderConfig;
|
|
393
|
+
readonly now?: UnixMillis;
|
|
394
|
+
readonly scopes?: readonly string[];
|
|
395
|
+
readonly clientSecret?: Redacted.Redacted<string>;
|
|
396
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
397
|
+
}
|
|
398
|
+
export interface AppleSignInProviderTokenRefreshInput {
|
|
399
|
+
readonly accountId: OAuthAccountId;
|
|
400
|
+
readonly userId: UserId;
|
|
401
|
+
readonly providerAccountId: string;
|
|
402
|
+
readonly provider: OAuthProviderConfig;
|
|
403
|
+
readonly clientSecret: Redacted.Redacted<string>;
|
|
404
|
+
readonly now?: UnixMillis;
|
|
405
|
+
readonly scopes?: readonly string[];
|
|
406
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
407
|
+
}
|
|
408
|
+
export interface AppleSignInProviderTokenRevokeInput {
|
|
409
|
+
readonly accountId: OAuthAccountId;
|
|
410
|
+
readonly provider: OAuthProviderConfig;
|
|
411
|
+
readonly reason: string;
|
|
412
|
+
readonly clientSecret: Redacted.Redacted<string>;
|
|
413
|
+
readonly now?: UnixMillis;
|
|
414
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
415
|
+
}
|
|
416
|
+
export interface OidcIdTokenClaims extends JwtClaims {
|
|
417
|
+
readonly iss: string;
|
|
418
|
+
readonly sub: string;
|
|
419
|
+
readonly aud: JwtAudience;
|
|
420
|
+
readonly exp: number;
|
|
421
|
+
readonly iat: number;
|
|
422
|
+
readonly nonce?: string;
|
|
423
|
+
readonly azp?: string;
|
|
424
|
+
readonly email?: string;
|
|
425
|
+
readonly email_verified?: boolean;
|
|
426
|
+
readonly name?: string;
|
|
427
|
+
readonly preferred_username?: string;
|
|
428
|
+
readonly picture?: string;
|
|
429
|
+
}
|
|
430
|
+
export type OidcIdTokenVerificationFailureReason = JwtVerificationFailureReason | "missing_provider_issuer" | "missing_subject" | "missing_expiration" | "missing_issued_at" | "missing_authorized_party" | "authorized_party_mismatch" | "nonce_mismatch";
|
|
431
|
+
export interface OidcIdTokenVerifyInput {
|
|
432
|
+
readonly provider: OAuthProviderConfig;
|
|
433
|
+
readonly idToken: Redacted.Redacted<OAuthIdToken | string>;
|
|
434
|
+
readonly nonce?: OAuthNonce | string;
|
|
435
|
+
readonly audience?: JwtAudience;
|
|
436
|
+
readonly authorizedParty?: string;
|
|
437
|
+
readonly now?: UnixMillis;
|
|
438
|
+
readonly clockTolerance?: Duration.Duration;
|
|
439
|
+
}
|
|
440
|
+
export type OidcIdTokenVerificationResult = {
|
|
441
|
+
readonly valid: true;
|
|
442
|
+
readonly header: JwtHeader;
|
|
443
|
+
readonly claims: OidcIdTokenClaims;
|
|
444
|
+
readonly key: JwtKeyInfo;
|
|
445
|
+
} | {
|
|
446
|
+
readonly valid: false;
|
|
447
|
+
readonly reason: OidcIdTokenVerificationFailureReason;
|
|
448
|
+
};
|
|
449
|
+
export type OidcIdTokenVerifierOperation = "verify";
|
|
450
|
+
declare const OidcIdTokenVerifierError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
451
|
+
readonly _tag: "OidcIdTokenVerifierError";
|
|
452
|
+
} & Readonly<A>;
|
|
453
|
+
export declare class OidcIdTokenVerifierError extends OidcIdTokenVerifierError_base<{
|
|
454
|
+
readonly operation: OidcIdTokenVerifierOperation;
|
|
455
|
+
readonly message: string;
|
|
456
|
+
readonly cause?: unknown;
|
|
457
|
+
}> {
|
|
458
|
+
}
|
|
459
|
+
export interface OidcIdTokenVerifierService {
|
|
460
|
+
readonly verify: (input: OidcIdTokenVerifyInput) => Effect.Effect<OidcIdTokenVerificationResult, OidcIdTokenVerifierError>;
|
|
461
|
+
}
|
|
462
|
+
declare const OidcIdTokenVerifier_base: Context.ServiceClass<OidcIdTokenVerifier, "auth/OidcIdTokenVerifier", OidcIdTokenVerifierService>;
|
|
463
|
+
export declare class OidcIdTokenVerifier extends OidcIdTokenVerifier_base {
|
|
464
|
+
}
|
|
465
|
+
export declare namespace OidcIdTokenVerifier {
|
|
466
|
+
const make: (service: OidcIdTokenVerifierService) => OidcIdTokenVerifierService;
|
|
467
|
+
}
|
|
468
|
+
export interface OidcIdTokenVerifierDependencies {
|
|
469
|
+
readonly jwtVerifier: JwtVerifierService;
|
|
470
|
+
}
|
|
471
|
+
export interface OAuthProfile {
|
|
472
|
+
readonly providerId: OAuthProviderId;
|
|
473
|
+
readonly providerAccountId: string;
|
|
474
|
+
readonly email?: Email;
|
|
475
|
+
readonly emailVerified?: boolean;
|
|
476
|
+
readonly name?: string;
|
|
477
|
+
readonly username?: string;
|
|
478
|
+
readonly avatarUrl?: string;
|
|
479
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
480
|
+
}
|
|
481
|
+
export interface OAuthProfileNormalizeInput {
|
|
482
|
+
readonly provider: OAuthProviderConfig;
|
|
483
|
+
readonly claims?: OidcIdTokenClaims;
|
|
484
|
+
readonly userInfo?: unknown;
|
|
485
|
+
readonly profile?: unknown;
|
|
486
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
487
|
+
}
|
|
488
|
+
export type OAuthProfileNormalizationFailureReason = "missing_claims" | "missing_subject" | "invalid_userinfo" | "subject_mismatch";
|
|
489
|
+
export type OAuthProfileNormalizationOperation = "normalize";
|
|
490
|
+
declare const OAuthProfileNormalizationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
491
|
+
readonly _tag: "OAuthProfileNormalizationError";
|
|
492
|
+
} & Readonly<A>;
|
|
493
|
+
export declare class OAuthProfileNormalizationError extends OAuthProfileNormalizationError_base<{
|
|
494
|
+
readonly operation: OAuthProfileNormalizationOperation;
|
|
495
|
+
readonly reason: OAuthProfileNormalizationFailureReason;
|
|
496
|
+
readonly message: string;
|
|
497
|
+
readonly cause?: unknown;
|
|
498
|
+
}> {
|
|
499
|
+
}
|
|
500
|
+
export interface OAuthProfileNormalizerService {
|
|
501
|
+
readonly normalize: (input: OAuthProfileNormalizeInput) => Effect.Effect<OAuthProfile, OAuthProfileNormalizationError>;
|
|
502
|
+
}
|
|
503
|
+
declare const OAuthProfileNormalizer_base: Context.ServiceClass<OAuthProfileNormalizer, "auth/OAuthProfileNormalizer", OAuthProfileNormalizerService>;
|
|
504
|
+
export declare class OAuthProfileNormalizer extends OAuthProfileNormalizer_base {
|
|
505
|
+
}
|
|
506
|
+
export declare namespace OAuthProfileNormalizer {
|
|
507
|
+
const make: (service: OAuthProfileNormalizerService) => OAuthProfileNormalizerService;
|
|
508
|
+
}
|
|
509
|
+
export type OAuthTokenExchangeOperation = "token-request" | "refresh-token-request" | "revocation-request" | "decode-token-response" | "exchange-code";
|
|
510
|
+
declare const OAuthTokenExchangeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
511
|
+
readonly _tag: "OAuthTokenExchangeError";
|
|
512
|
+
} & Readonly<A>;
|
|
513
|
+
export declare class OAuthTokenExchangeError extends OAuthTokenExchangeError_base<{
|
|
514
|
+
readonly operation: OAuthTokenExchangeOperation;
|
|
515
|
+
readonly message: string;
|
|
516
|
+
readonly cause?: unknown;
|
|
517
|
+
}> {
|
|
518
|
+
}
|
|
519
|
+
export interface OAuthTokenExchangeService {
|
|
520
|
+
readonly exchangeAuthorizationCode: (input: OAuthAuthorizationCodeTokenInput) => Effect.Effect<OAuthTokenResponse, OAuthTokenExchangeError>;
|
|
521
|
+
}
|
|
522
|
+
declare const OAuthTokenExchange_base: Context.ServiceClass<OAuthTokenExchange, "auth/OAuthTokenExchange", OAuthTokenExchangeService>;
|
|
523
|
+
export declare class OAuthTokenExchange extends OAuthTokenExchange_base {
|
|
524
|
+
}
|
|
525
|
+
export declare namespace OAuthTokenExchange {
|
|
526
|
+
const make: (service: OAuthTokenExchangeService) => OAuthTokenExchangeService;
|
|
527
|
+
}
|
|
528
|
+
export interface OAuthTokenExchangeDependencies {
|
|
529
|
+
readonly request: (request: OAuthTokenRequest) => Effect.Effect<unknown, OAuthTokenExchangeError>;
|
|
530
|
+
}
|
|
531
|
+
declare const OAuthProviders_base: Context.ServiceClass<OAuthProviders, "auth/OAuthProviders", OAuthProvidersService>;
|
|
532
|
+
export declare class OAuthProviders extends OAuthProviders_base {
|
|
533
|
+
}
|
|
534
|
+
export declare namespace OAuthProviders {
|
|
535
|
+
const make: (service: OAuthProvidersService) => OAuthProvidersService;
|
|
536
|
+
}
|
|
537
|
+
export interface OAuthPkce {
|
|
538
|
+
readonly codeVerifier: Redacted.Redacted<OAuthCodeVerifier>;
|
|
539
|
+
readonly codeChallenge: OAuthCodeChallenge;
|
|
540
|
+
readonly codeChallengeMethod: "S256";
|
|
541
|
+
}
|
|
542
|
+
export interface OAuthPkceInput {
|
|
543
|
+
readonly codeVerifier?: Redacted.Redacted<string>;
|
|
544
|
+
readonly verifierBytes?: number;
|
|
545
|
+
}
|
|
546
|
+
export interface OAuthAuthorizationStartInput {
|
|
547
|
+
readonly provider: OAuthProviderConfig;
|
|
548
|
+
readonly ttl?: Duration.Duration;
|
|
549
|
+
readonly redirectUri?: string;
|
|
550
|
+
readonly scopes?: readonly string[];
|
|
551
|
+
readonly authorizationParams?: Readonly<Record<string, string>>;
|
|
552
|
+
readonly codeVerifier?: Redacted.Redacted<string>;
|
|
553
|
+
readonly includeNonce?: boolean;
|
|
554
|
+
readonly nonce?: string;
|
|
555
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
556
|
+
}
|
|
557
|
+
export interface StartedOAuthAuthorization {
|
|
558
|
+
readonly providerId: OAuthProviderId;
|
|
559
|
+
readonly authorizationUrl: string;
|
|
560
|
+
readonly state: OAuthStateToken;
|
|
561
|
+
readonly challengeId: ChallengeId;
|
|
562
|
+
readonly expiresAt: UnixMillis;
|
|
563
|
+
readonly codeVerifier: Redacted.Redacted<OAuthCodeVerifier>;
|
|
564
|
+
readonly codeChallenge: OAuthCodeChallenge;
|
|
565
|
+
readonly codeChallengeMethod: "S256";
|
|
566
|
+
readonly nonce?: OAuthNonce;
|
|
567
|
+
readonly redirectUri: string;
|
|
568
|
+
readonly scopes: readonly string[];
|
|
569
|
+
}
|
|
570
|
+
export interface OAuthStateVerifyInput {
|
|
571
|
+
readonly state: OAuthStateToken | string;
|
|
572
|
+
}
|
|
573
|
+
export interface VerifiedOAuthState {
|
|
574
|
+
readonly challengeId: ChallengeId;
|
|
575
|
+
readonly providerId: OAuthProviderId;
|
|
576
|
+
readonly redirectUri?: string;
|
|
577
|
+
readonly scopes: readonly string[];
|
|
578
|
+
readonly codeChallenge?: OAuthCodeChallenge;
|
|
579
|
+
readonly nonce?: OAuthNonce;
|
|
580
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
581
|
+
}
|
|
582
|
+
export interface OAuthCallbackInput {
|
|
583
|
+
readonly provider: OAuthProviderConfig;
|
|
584
|
+
readonly state: OAuthStateToken | string;
|
|
585
|
+
readonly code: OAuthAuthorizationCode | string;
|
|
586
|
+
readonly codeVerifier: Redacted.Redacted<OAuthCodeVerifier | string>;
|
|
587
|
+
readonly redirectUri?: string;
|
|
588
|
+
readonly clientAuthentication?: OAuthClientAuthentication;
|
|
589
|
+
readonly tokenParams?: Readonly<Record<string, string>>;
|
|
590
|
+
}
|
|
591
|
+
export interface OAuthCallbackResult {
|
|
592
|
+
readonly state: VerifiedOAuthState;
|
|
593
|
+
readonly tokens: OAuthTokenResponse;
|
|
594
|
+
}
|
|
595
|
+
export type OAuthStateOperation = "start" | "verify" | "parse" | "pkce" | "authorization-url";
|
|
596
|
+
declare const OAuthStateError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
597
|
+
readonly _tag: "OAuthStateError";
|
|
598
|
+
} & Readonly<A>;
|
|
599
|
+
export declare class OAuthStateError extends OAuthStateError_base<{
|
|
600
|
+
readonly operation: OAuthStateOperation;
|
|
601
|
+
readonly message: string;
|
|
602
|
+
readonly cause?: unknown;
|
|
603
|
+
}> {
|
|
604
|
+
}
|
|
605
|
+
export interface OAuthStateService {
|
|
606
|
+
readonly start: (input: OAuthAuthorizationStartInput) => Effect.Effect<StartedOAuthAuthorization, OAuthStateError>;
|
|
607
|
+
readonly verify: (input: OAuthStateVerifyInput) => Effect.Effect<VerifiedOAuthState, OAuthStateError>;
|
|
608
|
+
}
|
|
609
|
+
declare const OAuthState_base: Context.ServiceClass<OAuthState, "auth/OAuthState", OAuthStateService>;
|
|
610
|
+
export declare class OAuthState extends OAuthState_base {
|
|
611
|
+
}
|
|
612
|
+
export declare namespace OAuthState {
|
|
613
|
+
const make: (service: OAuthStateService) => OAuthStateService;
|
|
614
|
+
}
|
|
615
|
+
export interface OAuthAccountRecord {
|
|
616
|
+
readonly id: OAuthAccountId;
|
|
617
|
+
readonly providerId: OAuthProviderId;
|
|
618
|
+
readonly providerAccountId: string;
|
|
619
|
+
readonly userId: UserId;
|
|
620
|
+
readonly email?: Email;
|
|
621
|
+
readonly emailVerified?: boolean;
|
|
622
|
+
readonly createdAt: UnixMillis;
|
|
623
|
+
readonly updatedAt: UnixMillis;
|
|
624
|
+
readonly unlinkedAt?: UnixMillis;
|
|
625
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
626
|
+
}
|
|
627
|
+
export interface VerifiedOAuthIdentity {
|
|
628
|
+
readonly providerId: OAuthProviderId;
|
|
629
|
+
readonly providerAccountId: string;
|
|
630
|
+
readonly email?: Email;
|
|
631
|
+
readonly emailVerified?: boolean;
|
|
632
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
633
|
+
}
|
|
634
|
+
export interface OAuthAccountLookupInput {
|
|
635
|
+
readonly providerId: OAuthProviderId;
|
|
636
|
+
readonly providerAccountId: string;
|
|
637
|
+
readonly includeUnlinked?: boolean;
|
|
638
|
+
}
|
|
639
|
+
export interface OAuthAccountListByUserInput {
|
|
640
|
+
readonly userId: UserId;
|
|
641
|
+
readonly includeUnlinked?: boolean;
|
|
642
|
+
}
|
|
643
|
+
export interface OAuthAccountUnlinkInput {
|
|
644
|
+
readonly providerId: OAuthProviderId;
|
|
645
|
+
readonly providerAccountId: string;
|
|
646
|
+
readonly unlinkedAt: UnixMillis;
|
|
647
|
+
readonly reason?: string;
|
|
648
|
+
}
|
|
649
|
+
export type OAuthAccountStoreOperation = "insert" | "find" | "list" | "unlink";
|
|
650
|
+
declare const OAuthAccountStoreError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
651
|
+
readonly _tag: "OAuthAccountStoreError";
|
|
652
|
+
} & Readonly<A>;
|
|
653
|
+
export declare class OAuthAccountStoreError extends OAuthAccountStoreError_base<{
|
|
654
|
+
readonly operation: OAuthAccountStoreOperation;
|
|
655
|
+
readonly message: string;
|
|
656
|
+
readonly cause?: unknown;
|
|
657
|
+
}> {
|
|
658
|
+
}
|
|
659
|
+
export interface OAuthAccountStoreService {
|
|
660
|
+
readonly insert: (row: OAuthAccountRecord) => Effect.Effect<void, OAuthAccountStoreError>;
|
|
661
|
+
readonly findById: (id: OAuthAccountId) => Effect.Effect<OptionTypes.Option<OAuthAccountRecord>, OAuthAccountStoreError>;
|
|
662
|
+
readonly findByProviderAccount: (input: OAuthAccountLookupInput) => Effect.Effect<OptionTypes.Option<OAuthAccountRecord>, OAuthAccountStoreError>;
|
|
663
|
+
readonly listByUser: (input: OAuthAccountListByUserInput) => Effect.Effect<readonly OAuthAccountRecord[], OAuthAccountStoreError>;
|
|
664
|
+
readonly unlink: (input: OAuthAccountUnlinkInput) => Effect.Effect<OptionTypes.Option<OAuthAccountRecord>, OAuthAccountStoreError>;
|
|
665
|
+
}
|
|
666
|
+
declare const OAuthAccountStore_base: Context.ServiceClass<OAuthAccountStore, "auth/OAuthAccountStore", OAuthAccountStoreService>;
|
|
667
|
+
export declare class OAuthAccountStore extends OAuthAccountStore_base {
|
|
668
|
+
}
|
|
669
|
+
export declare namespace OAuthAccountStore {
|
|
670
|
+
const make: (service: OAuthAccountStoreService) => OAuthAccountStoreService;
|
|
671
|
+
}
|
|
672
|
+
export interface OAuthAccountLinkingResolveInput {
|
|
673
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
674
|
+
readonly currentUserId?: UserId;
|
|
675
|
+
readonly matchedUserId?: UserId;
|
|
676
|
+
}
|
|
677
|
+
export type OAuthAccountLinkingResolution = {
|
|
678
|
+
readonly type: "sign-in";
|
|
679
|
+
readonly reason: "linked-account";
|
|
680
|
+
readonly userId: UserId;
|
|
681
|
+
readonly account: OAuthAccountRecord;
|
|
682
|
+
} | {
|
|
683
|
+
readonly type: "link-existing-user";
|
|
684
|
+
readonly reason: "current-user" | "verified-email";
|
|
685
|
+
readonly userId: UserId;
|
|
686
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
687
|
+
} | {
|
|
688
|
+
readonly type: "require-explicit-linking";
|
|
689
|
+
readonly reason: "matched-email" | "unverified-email" | "no-linked-account";
|
|
690
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
691
|
+
readonly matchedUserId?: UserId;
|
|
692
|
+
} | {
|
|
693
|
+
readonly type: "deny";
|
|
694
|
+
readonly reason: "provider-account-linked-to-different-user";
|
|
695
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
696
|
+
readonly account: OAuthAccountRecord;
|
|
697
|
+
readonly currentUserId: UserId;
|
|
698
|
+
};
|
|
699
|
+
export type OAuthAccountLinkingOperation = "resolve";
|
|
700
|
+
declare const OAuthAccountLinkingError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
701
|
+
readonly _tag: "OAuthAccountLinkingError";
|
|
702
|
+
} & Readonly<A>;
|
|
703
|
+
export declare class OAuthAccountLinkingError extends OAuthAccountLinkingError_base<{
|
|
704
|
+
readonly operation: OAuthAccountLinkingOperation;
|
|
705
|
+
readonly message: string;
|
|
706
|
+
readonly cause?: unknown;
|
|
707
|
+
}> {
|
|
708
|
+
}
|
|
709
|
+
export interface OAuthAccountLinkingService {
|
|
710
|
+
readonly resolve: (input: OAuthAccountLinkingResolveInput) => Effect.Effect<OAuthAccountLinkingResolution, OAuthAccountLinkingError>;
|
|
711
|
+
}
|
|
712
|
+
declare const OAuthAccountLinking_base: Context.ServiceClass<OAuthAccountLinking, "auth/OAuthAccountLinking", OAuthAccountLinkingService>;
|
|
713
|
+
export declare class OAuthAccountLinking extends OAuthAccountLinking_base {
|
|
714
|
+
}
|
|
715
|
+
export declare namespace OAuthAccountLinking {
|
|
716
|
+
const make: (service: OAuthAccountLinkingService) => OAuthAccountLinkingService;
|
|
717
|
+
}
|
|
718
|
+
export interface OAuthAccountLinkingPolicyOptions {
|
|
719
|
+
readonly autoLinkVerifiedEmail?: boolean;
|
|
720
|
+
}
|
|
721
|
+
export interface OAuthAccountLinkingPolicyDependencies extends OAuthAccountLinkingPolicyOptions {
|
|
722
|
+
readonly accounts: OAuthAccountStoreService;
|
|
723
|
+
}
|
|
724
|
+
export interface OAuthAccountUnlinkingResolveInput {
|
|
725
|
+
readonly userId: UserId;
|
|
726
|
+
readonly providerId: OAuthProviderId;
|
|
727
|
+
readonly providerAccountId: string;
|
|
728
|
+
readonly stepUpSatisfied?: boolean;
|
|
729
|
+
}
|
|
730
|
+
export type OAuthAccountUnlinkingResolution = {
|
|
731
|
+
readonly type: "allow";
|
|
732
|
+
readonly reason: "owned-account";
|
|
733
|
+
readonly userId: UserId;
|
|
734
|
+
readonly account: OAuthAccountRecord;
|
|
735
|
+
readonly remainingAccounts: readonly OAuthAccountRecord[];
|
|
736
|
+
} | {
|
|
737
|
+
readonly type: "requires-step-up";
|
|
738
|
+
readonly reason: "step-up-required";
|
|
739
|
+
readonly userId: UserId;
|
|
740
|
+
readonly account: OAuthAccountRecord;
|
|
741
|
+
readonly remainingAccounts: readonly OAuthAccountRecord[];
|
|
742
|
+
} | {
|
|
743
|
+
readonly type: "deny-not-found";
|
|
744
|
+
readonly reason: "provider-account-not-found";
|
|
745
|
+
readonly userId: UserId;
|
|
746
|
+
readonly providerId: OAuthProviderId;
|
|
747
|
+
readonly providerAccountId: string;
|
|
748
|
+
} | {
|
|
749
|
+
readonly type: "deny-not-owner";
|
|
750
|
+
readonly reason: "provider-account-linked-to-different-user";
|
|
751
|
+
readonly userId: UserId;
|
|
752
|
+
readonly account: OAuthAccountRecord;
|
|
753
|
+
} | {
|
|
754
|
+
readonly type: "deny-last-account";
|
|
755
|
+
readonly reason: "last-linked-account";
|
|
756
|
+
readonly userId: UserId;
|
|
757
|
+
readonly account: OAuthAccountRecord;
|
|
758
|
+
};
|
|
759
|
+
export type OAuthAccountUnlinkingOperation = "resolve";
|
|
760
|
+
declare const OAuthAccountUnlinkingError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
761
|
+
readonly _tag: "OAuthAccountUnlinkingError";
|
|
762
|
+
} & Readonly<A>;
|
|
763
|
+
export declare class OAuthAccountUnlinkingError extends OAuthAccountUnlinkingError_base<{
|
|
764
|
+
readonly operation: OAuthAccountUnlinkingOperation;
|
|
765
|
+
readonly message: string;
|
|
766
|
+
readonly cause?: unknown;
|
|
767
|
+
}> {
|
|
768
|
+
}
|
|
769
|
+
export interface OAuthAccountUnlinkingService {
|
|
770
|
+
readonly resolve: (input: OAuthAccountUnlinkingResolveInput) => Effect.Effect<OAuthAccountUnlinkingResolution, OAuthAccountUnlinkingError>;
|
|
771
|
+
}
|
|
772
|
+
declare const OAuthAccountUnlinking_base: Context.ServiceClass<OAuthAccountUnlinking, "auth/OAuthAccountUnlinking", OAuthAccountUnlinkingService>;
|
|
773
|
+
export declare class OAuthAccountUnlinking extends OAuthAccountUnlinking_base {
|
|
774
|
+
}
|
|
775
|
+
export declare namespace OAuthAccountUnlinking {
|
|
776
|
+
const make: (service: OAuthAccountUnlinkingService) => OAuthAccountUnlinkingService;
|
|
777
|
+
}
|
|
778
|
+
export interface OAuthAccountUnlinkingPolicyOptions {
|
|
779
|
+
readonly allowLastAccount?: boolean;
|
|
780
|
+
readonly requireStepUp?: boolean;
|
|
781
|
+
}
|
|
782
|
+
export interface OAuthAccountUnlinkingPolicyDependencies extends OAuthAccountUnlinkingPolicyOptions {
|
|
783
|
+
readonly accounts: OAuthAccountStoreService;
|
|
784
|
+
}
|
|
785
|
+
export type OAuthLinkConfirmationReason = "current-user" | "matched-email" | "unverified-email" | "no-linked-account" | "manual" | (string & {});
|
|
786
|
+
export interface OAuthLinkConfirmationStartInput {
|
|
787
|
+
readonly userId: UserId;
|
|
788
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
789
|
+
readonly reason?: OAuthLinkConfirmationReason;
|
|
790
|
+
readonly ttl?: Duration.Duration;
|
|
791
|
+
readonly secret?: Redacted.Redacted<string>;
|
|
792
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
793
|
+
}
|
|
794
|
+
export interface StartedOAuthLinkConfirmation {
|
|
795
|
+
readonly challengeId: ChallengeId;
|
|
796
|
+
readonly userId: UserId;
|
|
797
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
798
|
+
readonly reason: OAuthLinkConfirmationReason;
|
|
799
|
+
readonly secret: Redacted.Redacted<string>;
|
|
800
|
+
readonly expiresAt: UnixMillis;
|
|
801
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
802
|
+
}
|
|
803
|
+
export interface OAuthLinkConfirmationInspectInput {
|
|
804
|
+
readonly challengeId: ChallengeId;
|
|
805
|
+
readonly secret?: Redacted.Redacted<string>;
|
|
806
|
+
}
|
|
807
|
+
export interface PendingOAuthLinkConfirmation {
|
|
808
|
+
readonly challengeId: ChallengeId;
|
|
809
|
+
readonly userId: UserId;
|
|
810
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
811
|
+
readonly reason: OAuthLinkConfirmationReason;
|
|
812
|
+
readonly expiresAt: UnixMillis;
|
|
813
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
814
|
+
}
|
|
815
|
+
export interface OAuthLinkConfirmationConfirmInput {
|
|
816
|
+
readonly challengeId: ChallengeId;
|
|
817
|
+
readonly secret?: Redacted.Redacted<string>;
|
|
818
|
+
readonly currentUserId?: UserId;
|
|
819
|
+
readonly expectedProviderId?: OAuthProviderId;
|
|
820
|
+
readonly expectedProviderAccountId?: string;
|
|
821
|
+
}
|
|
822
|
+
export interface ConfirmedOAuthLinkConfirmation {
|
|
823
|
+
readonly challengeId: ChallengeId;
|
|
824
|
+
readonly userId: UserId;
|
|
825
|
+
readonly identity: VerifiedOAuthIdentity;
|
|
826
|
+
readonly reason: OAuthLinkConfirmationReason;
|
|
827
|
+
readonly existingAccount?: OAuthAccountRecord;
|
|
828
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
829
|
+
}
|
|
830
|
+
export type OAuthLinkConfirmationOperation = "start" | "inspect" | "confirm";
|
|
831
|
+
declare const OAuthLinkConfirmationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
832
|
+
readonly _tag: "OAuthLinkConfirmationError";
|
|
833
|
+
} & Readonly<A>;
|
|
834
|
+
export declare class OAuthLinkConfirmationError extends OAuthLinkConfirmationError_base<{
|
|
835
|
+
readonly operation: OAuthLinkConfirmationOperation;
|
|
836
|
+
readonly message: string;
|
|
837
|
+
readonly cause?: unknown;
|
|
838
|
+
}> {
|
|
839
|
+
}
|
|
840
|
+
export interface OAuthLinkConfirmationService {
|
|
841
|
+
readonly start: (input: OAuthLinkConfirmationStartInput) => Effect.Effect<StartedOAuthLinkConfirmation, OAuthLinkConfirmationError>;
|
|
842
|
+
readonly inspect: (input: OAuthLinkConfirmationInspectInput) => Effect.Effect<PendingOAuthLinkConfirmation, OAuthLinkConfirmationError>;
|
|
843
|
+
readonly confirm: (input: OAuthLinkConfirmationConfirmInput) => Effect.Effect<ConfirmedOAuthLinkConfirmation, OAuthLinkConfirmationError>;
|
|
844
|
+
}
|
|
845
|
+
declare const OAuthLinkConfirmation_base: Context.ServiceClass<OAuthLinkConfirmation, "auth/OAuthLinkConfirmation", OAuthLinkConfirmationService>;
|
|
846
|
+
export declare class OAuthLinkConfirmation extends OAuthLinkConfirmation_base {
|
|
847
|
+
}
|
|
848
|
+
export declare namespace OAuthLinkConfirmation {
|
|
849
|
+
const make: (service: OAuthLinkConfirmationService) => OAuthLinkConfirmationService;
|
|
850
|
+
}
|
|
851
|
+
export interface OAuthLinkConfirmationDependencies {
|
|
852
|
+
readonly challenge: ChallengeService;
|
|
853
|
+
readonly accounts: OAuthAccountStoreService;
|
|
854
|
+
readonly crypto: CryptoService;
|
|
855
|
+
readonly secretBytes?: number;
|
|
856
|
+
}
|
|
857
|
+
export interface OAuthStateDependencies {
|
|
858
|
+
readonly crypto: CryptoService;
|
|
859
|
+
readonly challenge: ChallengeService;
|
|
860
|
+
readonly stateSecretBytes?: number;
|
|
861
|
+
readonly codeVerifierBytes?: number;
|
|
862
|
+
readonly nonceBytes?: number;
|
|
863
|
+
}
|
|
864
|
+
export declare const makeAppleSignInProvider: (input: AppleSignInProviderOptions) => OAuthProviderConfig;
|
|
865
|
+
export declare const makeGithubOAuthProvider: (input: GithubOAuthProviderOptions) => OAuthProviderConfig;
|
|
866
|
+
export declare const makeGoogleOidcProvider: (input: GoogleOidcProviderOptions) => OAuthProviderConfig;
|
|
867
|
+
export declare const makeMicrosoftOidcProvider: (input: MicrosoftOidcProviderOptions) => OAuthProviderConfig;
|
|
868
|
+
export declare const makeGenericOidcProvider: (input: GenericOidcProviderOptions) => OAuthProviderConfig;
|
|
869
|
+
export declare const makeGoogleOidcProviderTokenRefreshInput: (input: GoogleOidcProviderTokenRefreshInput) => OAuthProviderTokenLifecycleRefreshInput;
|
|
870
|
+
export declare const makeGoogleOidcProviderTokenRevokeInput: (input: GoogleOidcProviderTokenRevokeInput) => OAuthProviderTokenLifecycleRevokeInput;
|
|
871
|
+
export declare const makeMicrosoftOidcProviderTokenRefreshInput: (input: MicrosoftOidcProviderTokenRefreshInput) => OAuthProviderTokenLifecycleRefreshInput;
|
|
872
|
+
export declare const makeAppleSignInProviderTokenRefreshInput: (input: AppleSignInProviderTokenRefreshInput) => OAuthProviderTokenLifecycleRefreshInput;
|
|
873
|
+
export declare const makeAppleSignInProviderTokenRevokeInput: (input: AppleSignInProviderTokenRevokeInput) => OAuthProviderTokenLifecycleRevokeInput;
|
|
874
|
+
export declare const parseOAuthState: (state: OAuthStateToken | string) => Effect.Effect<{
|
|
875
|
+
readonly challengeId: ChallengeId;
|
|
876
|
+
readonly secret: Redacted.Redacted<string>;
|
|
877
|
+
}, OAuthStateError>;
|
|
878
|
+
export declare const githubOAuthVerifiedEmail: (emails: readonly GithubOAuthEmailRecord[]) => string | undefined;
|
|
879
|
+
export declare const googleOidcHostedDomain: (value: Readonly<Record<string, unknown>>) => string | undefined;
|
|
880
|
+
export declare const microsoftOidcTenantId: (value: Readonly<Record<string, unknown>>) => string | undefined;
|
|
881
|
+
export declare const microsoftOidcObjectId: (value: Readonly<Record<string, unknown>>) => string | undefined;
|
|
882
|
+
export declare const microsoftOidcAccountId: (value: Readonly<Record<string, unknown>>) => string | undefined;
|
|
883
|
+
export declare const decodeAppleSignInAuthorizationUser: (value: unknown) => AppleSignInAuthorizationUser | undefined;
|
|
884
|
+
export declare const appleSignInAuthorizationUserFullName: (user: AppleSignInAuthorizationUser | undefined) => string | undefined;
|
|
885
|
+
export declare const appleSignInAuthorizationUserEmail: (user: AppleSignInAuthorizationUser | undefined) => Email | undefined;
|
|
886
|
+
export declare const appleSignInIsPrivateEmail: (input: {
|
|
887
|
+
readonly claims?: Readonly<Record<string, unknown>>;
|
|
888
|
+
readonly email?: Email | string;
|
|
889
|
+
}) => boolean | undefined;
|
|
890
|
+
export declare const makeOAuthTokenRequest: (input: OAuthAuthorizationCodeTokenInput) => Effect.Effect<OAuthTokenRequest, OAuthTokenExchangeError>;
|
|
891
|
+
export declare const makeOAuthRefreshTokenRequest: (input: OAuthRefreshTokenInput) => Effect.Effect<OAuthTokenRequest, OAuthTokenExchangeError>;
|
|
892
|
+
export declare const makeOAuthTokenRevocationRequest: (input: OAuthTokenRevocationInput) => Effect.Effect<OAuthTokenRequest, OAuthTokenExchangeError>;
|
|
893
|
+
export declare const makeOAuthUserInfoRequest: (input: OAuthUserInfoRequestInput) => Effect.Effect<OAuthUserInfoRequest, OAuthUserInfoError>;
|
|
894
|
+
export declare const decodeOAuthUserInfoResponse: (value: unknown) => Effect.Effect<OAuthUserInfo, OAuthUserInfoError>;
|
|
895
|
+
export declare const decodeOAuthTokenResponse: (value: unknown) => Effect.Effect<OAuthTokenResponse, OAuthTokenExchangeError>;
|
|
896
|
+
export declare const makeOidcIdTokenVerifier: (dependencies: OidcIdTokenVerifierDependencies) => OidcIdTokenVerifierService;
|
|
897
|
+
export declare const verifyOidcIdToken: (input: OidcIdTokenVerifyInput) => Effect.Effect<OidcIdTokenVerificationResult, OidcIdTokenVerifierError, OidcIdTokenVerifier>;
|
|
898
|
+
export declare const decodeOAuthJwksDocument: (input: unknown) => Effect.Effect<JwksDocument, JwtError>;
|
|
899
|
+
export declare const makeOAuthJwksJwtKeys: (dependencies: OAuthJwksJwtKeysDependencies) => JwtKeysService;
|
|
900
|
+
export declare const normalizeOidcProfile: (input: OAuthProfileNormalizeInput) => Effect.Effect<OAuthProfile, OAuthProfileNormalizationError>;
|
|
901
|
+
export declare const makeOidcOAuthProfileNormalizer: () => OAuthProfileNormalizerService;
|
|
902
|
+
export declare const normalizeOAuthProfile: (input: OAuthProfileNormalizeInput) => Effect.Effect<OAuthProfile, OAuthProfileNormalizationError, OAuthProfileNormalizer>;
|
|
903
|
+
export declare const verifiedOAuthIdentityFromProfile: (profile: OAuthProfile) => VerifiedOAuthIdentity;
|
|
904
|
+
export declare const makeOAuthTokenExchange: (dependencies: OAuthTokenExchangeDependencies) => OAuthTokenExchangeService;
|
|
905
|
+
export declare const makeOAuthProviderTokenLifecycle: (dependencies: OAuthProviderTokenLifecycleDependencies) => OAuthProviderTokenLifecycleService;
|
|
906
|
+
export declare const OAuthProviderTokenLifecycleLive: (options: OAuthProviderTokenLifecycleLiveOptions) => Layer.Layer<OAuthProviderTokenLifecycle, never, OAuthProviderTokenVault>;
|
|
907
|
+
export declare const storeOAuthProviderTokens: (input: OAuthProviderTokenLifecycleStoreInput) => Effect.Effect<OAuthProviderTokenLifecycleStoreResult, OAuthProviderTokenLifecycleError, OAuthProviderTokenLifecycle>;
|
|
908
|
+
export declare const refreshOAuthProviderTokens: (input: OAuthProviderTokenLifecycleRefreshInput) => Effect.Effect<OAuthProviderTokenLifecycleRefreshResult, OAuthProviderTokenLifecycleError, OAuthProviderTokenLifecycle>;
|
|
909
|
+
export declare const revokeOAuthProviderTokens: (input: OAuthProviderTokenLifecycleRevokeInput) => Effect.Effect<OAuthProviderTokenLifecycleRevokeResult, OAuthProviderTokenLifecycleError, OAuthProviderTokenLifecycle>;
|
|
910
|
+
export declare const completeOAuthCallback: (input: OAuthCallbackInput) => Effect.Effect<OAuthCallbackResult, OAuthStateError | OAuthTokenExchangeError, OAuthState | OAuthTokenExchange>;
|
|
911
|
+
export declare const makeOAuthAccountLinkingPolicy: (dependencies: OAuthAccountLinkingPolicyDependencies) => OAuthAccountLinkingService;
|
|
912
|
+
export declare const resolveOAuthAccountLinking: (input: OAuthAccountLinkingResolveInput) => Effect.Effect<OAuthAccountLinkingResolution, OAuthAccountLinkingError, OAuthAccountLinking>;
|
|
913
|
+
export declare const makeOAuthAccountUnlinkingPolicy: (dependencies: OAuthAccountUnlinkingPolicyDependencies) => OAuthAccountUnlinkingService;
|
|
914
|
+
export declare const resolveOAuthAccountUnlinking: (input: OAuthAccountUnlinkingResolveInput) => Effect.Effect<OAuthAccountUnlinkingResolution, OAuthAccountUnlinkingError, OAuthAccountUnlinking>;
|
|
915
|
+
export declare const makeOAuthLinkConfirmation: (dependencies: OAuthLinkConfirmationDependencies) => OAuthLinkConfirmationService;
|
|
916
|
+
export declare const startOAuthLinkConfirmation: (input: OAuthLinkConfirmationStartInput) => Effect.Effect<StartedOAuthLinkConfirmation, OAuthLinkConfirmationError, OAuthLinkConfirmation>;
|
|
917
|
+
export declare const inspectOAuthLinkConfirmation: (input: OAuthLinkConfirmationInspectInput) => Effect.Effect<PendingOAuthLinkConfirmation, OAuthLinkConfirmationError, OAuthLinkConfirmation>;
|
|
918
|
+
export declare const confirmOAuthLinkConfirmation: (input: OAuthLinkConfirmationConfirmInput) => Effect.Effect<ConfirmedOAuthLinkConfirmation, OAuthLinkConfirmationError, OAuthLinkConfirmation>;
|
|
919
|
+
export declare const makeOAuthPkce: (input?: OAuthPkceInput) => Effect.Effect<OAuthPkce, OAuthStateError, Crypto>;
|
|
920
|
+
export declare const makeOAuthState: (dependencies: OAuthStateDependencies) => OAuthStateService;
|
|
921
|
+
export declare const OAuthStateLive: Layer.Layer<OAuthState, never, Crypto | Challenge>;
|
|
922
|
+
export declare const makeOAuthProviders: (providers: readonly OAuthProviderConfig[]) => OAuthProvidersService;
|
|
923
|
+
export declare const OAuthProvidersLive: (providers: readonly OAuthProviderConfig[]) => Layer.Layer<OAuthProviders, never, never>;
|
|
924
|
+
export declare const OidcIdTokenVerifierLive: Layer.Layer<OidcIdTokenVerifier, never, JwtVerifier>;
|
|
925
|
+
export declare const OAuthOidcProfileNormalizerLive: Layer.Layer<OAuthProfileNormalizer, never, never>;
|
|
926
|
+
export declare const OAuthAccountLinkingLive: Layer.Layer<OAuthAccountLinking, never, OAuthAccountStore>;
|
|
927
|
+
export declare const OAuthAccountUnlinkingLive: Layer.Layer<OAuthAccountUnlinking, never, OAuthAccountStore>;
|
|
928
|
+
export declare const OAuthLinkConfirmationLive: Layer.Layer<OAuthLinkConfirmation, never, Crypto | Challenge | OAuthAccountStore>;
|
|
929
|
+
export declare const makeOAuthProviderTokenVaultMemory: () => OAuthProviderTokenVaultService;
|
|
930
|
+
export declare const OAuthProviderTokenVaultMemoryLive: Layer.Layer<OAuthProviderTokenVault, never, never>;
|
|
931
|
+
export declare const makeOAuthAccountStoreMemory: () => OAuthAccountStoreService;
|
|
932
|
+
export declare const OAuthAccountStoreMemoryLive: Layer.Layer<OAuthAccountStore, never, never>;
|
|
933
|
+
export {};
|
|
934
|
+
//# sourceMappingURL=OAuth.d.ts.map
|