@effect-auth/core 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +679 -36
- package/dist/AuditLog.d.ts +3 -0
- package/dist/AuditLog.d.ts.map +1 -1
- package/dist/AuditLog.js +6 -3
- package/dist/AuditLog.js.map +1 -1
- package/dist/AuthConfig.d.ts +51 -0
- package/dist/AuthConfig.d.ts.map +1 -0
- package/dist/AuthConfig.js +56 -0
- package/dist/AuthConfig.js.map +1 -0
- package/dist/AuthFlow.d.ts +295 -35
- package/dist/AuthFlow.d.ts.map +1 -1
- package/dist/AuthFlow.js +133 -6
- 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 +22 -3
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +160 -1
- package/dist/Challenge.js.map +1 -1
- package/dist/Client.d.ts +36 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +55 -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/D1Kysely.d.ts +43 -0
- package/dist/D1Kysely.d.ts.map +1 -0
- package/dist/D1Kysely.js +78 -0
- package/dist/D1Kysely.js.map +1 -0
- package/dist/EffectQbSqliteStorage.d.ts +183 -0
- package/dist/EffectQbSqliteStorage.d.ts.map +1 -0
- package/dist/EffectQbSqliteStorage.js +446 -0
- package/dist/EffectQbSqliteStorage.js.map +1 -0
- package/dist/EmailOtp.d.ts +117 -0
- package/dist/EmailOtp.d.ts.map +1 -0
- package/dist/EmailOtp.js +279 -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 +201 -0
- package/dist/EmailVerification.js.map +1 -0
- package/dist/HttpApi/Api.d.ts +175 -0
- package/dist/HttpApi/Api.d.ts.map +1 -0
- package/dist/HttpApi/Api.js +340 -0
- package/dist/HttpApi/Api.js.map +1 -0
- package/dist/HttpApi/Endpoints.d.ts +92 -0
- package/dist/HttpApi/Endpoints.d.ts.map +1 -0
- package/dist/HttpApi/Endpoints.js +48 -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 +86 -0
- package/dist/HttpApi/Schemas.d.ts.map +1 -0
- package/dist/HttpApi/Schemas.js +63 -0
- package/dist/HttpApi/Schemas.js.map +1 -0
- package/dist/HttpApi/Security.d.ts +147 -0
- package/dist/HttpApi/Security.d.ts.map +1 -0
- package/dist/HttpApi/Security.js +439 -0
- package/dist/HttpApi/Security.js.map +1 -0
- package/dist/HttpApi/Transport.d.ts +31 -0
- package/dist/HttpApi/Transport.d.ts.map +1 -0
- package/dist/HttpApi/Transport.js +169 -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/KyselyStorage.d.ts +67 -0
- package/dist/KyselyStorage.d.ts.map +1 -0
- package/dist/KyselyStorage.js +366 -0
- package/dist/KyselyStorage.js.map +1 -0
- package/dist/Mailer.d.ts +116 -0
- package/dist/Mailer.d.ts.map +1 -0
- package/dist/Mailer.js +101 -0
- package/dist/Mailer.js.map +1 -0
- package/dist/Password.d.ts +107 -0
- package/dist/Password.d.ts.map +1 -0
- package/dist/Password.js +252 -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/Sessions.d.ts +85 -11
- package/dist/Sessions.d.ts.map +1 -1
- package/dist/Sessions.js +424 -1
- package/dist/Sessions.js.map +1 -1
- package/dist/Storage.d.ts +162 -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 +8 -0
- package/dist/StorageMigrations.d.ts.map +1 -0
- package/dist/StorageMigrations.js +68 -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/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/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/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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -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/package.json +97 -16
- package/LICENSE +0 -21
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import type { Schema } from "effect";
|
|
3
|
+
import type { HttpServerRequest } from "effect/unstable/http";
|
|
4
|
+
import { HttpServerResponse } from "effect/unstable/http";
|
|
5
|
+
import { HttpApi, HttpApiGroup } from "effect/unstable/httpapi";
|
|
6
|
+
import { AuthResult } from "../AuthFlow.js";
|
|
7
|
+
import { EmailVerification, EmailVerificationFlow } from "../EmailVerification.js";
|
|
8
|
+
import type { EmailVerificationFlowService, EmailVerificationService, EmailVerificationIssueInput, EmailVerificationVerifyInput } from "../EmailVerification.js";
|
|
9
|
+
import { PasswordLogin, PasswordRegistration } from "../Password.js";
|
|
10
|
+
import type { PasswordLoginService, PasswordRegistrationService, PasswordSignInInput, PasswordSignUpInput } from "../Password.js";
|
|
11
|
+
import { SessionCookie, Sessions } from "../Sessions.js";
|
|
12
|
+
import type { SessionCookieService, SessionsService } from "../Sessions.js";
|
|
13
|
+
import { AuthBadRequestError, AuthEmailAlreadyRegisteredError, AuthInternalError, AuthRateLimitedError, AuthSchemaErrorMiddleware, AuthUnauthenticatedError } from "./Errors.js";
|
|
14
|
+
import type { EmailVerificationStartBody, EmailVerificationVerifyBody, PasswordSignInBody, PasswordSignUpBody } from "./Schemas.js";
|
|
15
|
+
import { AuthApiRateLimit, AuthOriginCheckMiddleware, AuthRateLimitMiddleware } from "./Security.js";
|
|
16
|
+
import type { AuthApiRateLimitService } from "./Security.js";
|
|
17
|
+
import { AuthHttp } from "./Transport.js";
|
|
18
|
+
import type { AuthHttpService } from "./Transport.js";
|
|
19
|
+
export declare const passwordSignInInput: (payload: Schema.Schema.Type<typeof PasswordSignInBody>) => PasswordSignInInput;
|
|
20
|
+
export declare const passwordSignUpInput: (payload: Schema.Schema.Type<typeof PasswordSignUpBody>) => PasswordSignUpInput;
|
|
21
|
+
export declare const emailVerificationStartInput: (payload: Schema.Schema.Type<typeof EmailVerificationStartBody>) => EmailVerificationIssueInput;
|
|
22
|
+
export declare const emailVerificationVerifyInput: (payload: Schema.Schema.Type<typeof EmailVerificationVerifyBody>) => EmailVerificationVerifyInput;
|
|
23
|
+
export type PasswordSignInHandlerRequest = {
|
|
24
|
+
readonly payload: Schema.Schema.Type<typeof PasswordSignInBody>;
|
|
25
|
+
};
|
|
26
|
+
export type PasswordSignUpHandlerRequest = {
|
|
27
|
+
readonly payload: Schema.Schema.Type<typeof PasswordSignUpBody>;
|
|
28
|
+
};
|
|
29
|
+
export type SessionHandlerRequest = {
|
|
30
|
+
readonly request: HttpServerRequest.HttpServerRequest;
|
|
31
|
+
};
|
|
32
|
+
export type EmailVerificationStartHandlerRequest = {
|
|
33
|
+
readonly payload: Schema.Schema.Type<typeof EmailVerificationStartBody>;
|
|
34
|
+
};
|
|
35
|
+
export type EmailVerificationVerifyHandlerRequest = {
|
|
36
|
+
readonly payload: Schema.Schema.Type<typeof EmailVerificationVerifyBody>;
|
|
37
|
+
readonly request: HttpServerRequest.HttpServerRequest;
|
|
38
|
+
};
|
|
39
|
+
export declare const makePasswordSignInHandler: (dependencies: {
|
|
40
|
+
readonly password: PasswordLoginService;
|
|
41
|
+
readonly authHttp: AuthHttpService;
|
|
42
|
+
readonly emailVerificationFlow?: EmailVerificationFlowService;
|
|
43
|
+
readonly authApiRateLimit?: AuthApiRateLimitService;
|
|
44
|
+
}) => (args_0: PasswordSignInHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthRateLimitedError | import("./Transport.js").PasswordSignInHttpError, never>;
|
|
45
|
+
export declare const makePasswordSignUpHandler: (dependencies: {
|
|
46
|
+
readonly registration: PasswordRegistrationService;
|
|
47
|
+
readonly authHttp: AuthHttpService;
|
|
48
|
+
readonly emailVerificationFlow?: EmailVerificationFlowService;
|
|
49
|
+
readonly authApiRateLimit?: AuthApiRateLimitService;
|
|
50
|
+
}) => (args_0: PasswordSignUpHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthRateLimitedError | AuthEmailAlreadyRegisteredError | import("./Transport.js").PasswordSignUpHttpError, never>;
|
|
51
|
+
export declare const makeCurrentSessionHandler: (dependencies: {
|
|
52
|
+
readonly sessions: SessionsService;
|
|
53
|
+
readonly sessionCookie: SessionCookieService;
|
|
54
|
+
readonly authHttp: AuthHttpService;
|
|
55
|
+
}) => (args_0: SessionHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthUnauthenticatedError | AuthInternalError, never>;
|
|
56
|
+
export declare const makeRefreshSessionHandler: (dependencies: {
|
|
57
|
+
readonly sessions: SessionsService;
|
|
58
|
+
readonly sessionCookie: SessionCookieService;
|
|
59
|
+
readonly authHttp: AuthHttpService;
|
|
60
|
+
}) => (args_0: SessionHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthUnauthenticatedError | AuthInternalError, never>;
|
|
61
|
+
export declare const makeLogoutHandler: (dependencies: {
|
|
62
|
+
readonly sessions: SessionsService;
|
|
63
|
+
readonly sessionCookie: SessionCookieService;
|
|
64
|
+
readonly authHttp: AuthHttpService;
|
|
65
|
+
}) => (args_0: SessionHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthInternalError, never>;
|
|
66
|
+
export declare const makeEmailVerificationStartHandler: (dependencies: {
|
|
67
|
+
readonly emailVerificationFlow: EmailVerificationFlowService;
|
|
68
|
+
readonly authApiRateLimit?: AuthApiRateLimitService;
|
|
69
|
+
}) => (args_0: EmailVerificationStartHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthBadRequestError | AuthRateLimitedError | AuthInternalError, never>;
|
|
70
|
+
export declare const makeEmailVerificationVerifyHandler: (dependencies: {
|
|
71
|
+
readonly emailVerification: EmailVerificationService;
|
|
72
|
+
readonly sessions: SessionsService;
|
|
73
|
+
readonly sessionCookie: SessionCookieService;
|
|
74
|
+
}) => (args_0: EmailVerificationVerifyHandlerRequest) => Effect.Effect<HttpServerResponse.HttpServerResponse, AuthBadRequestError | AuthInternalError, never>;
|
|
75
|
+
declare const PasswordApi_base: HttpApiGroup.HttpApiGroup<"password", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signIn", "POST", "/auth/password/sign-in", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
76
|
+
readonly email: Schema.brand<Schema.String, "auth/Email">;
|
|
77
|
+
readonly password: Schema.String;
|
|
78
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly type: Schema.Literal<"authenticated">;
|
|
80
|
+
readonly expiresAt: Schema.Number;
|
|
81
|
+
readonly aal: Schema.Literals<readonly ["aal1", "aal2", "aal3"]>;
|
|
82
|
+
readonly amr: Schema.$Array<Schema.String>;
|
|
83
|
+
readonly claims: Schema.optional<Schema.Struct<{
|
|
84
|
+
readonly emailVerified: Schema.optional<Schema.Boolean>;
|
|
85
|
+
readonly requirements: Schema.optional<Schema.$Array<Schema.String>>;
|
|
86
|
+
}>>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literal<"requires_mfa">;
|
|
89
|
+
readonly flowId: Schema.String;
|
|
90
|
+
readonly factors: Schema.$Array<Schema.Struct<{
|
|
91
|
+
readonly type: Schema.String;
|
|
92
|
+
}>>;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly type: Schema.Literal<"requires_email_verification">;
|
|
95
|
+
readonly flowId: Schema.String;
|
|
96
|
+
}>, Schema.Struct<{
|
|
97
|
+
readonly type: Schema.Literal<"requires_passkey_enrollment">;
|
|
98
|
+
readonly flowId: Schema.String;
|
|
99
|
+
}>]>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthBadRequestError | typeof import("./Errors.js").AuthInvalidCredentialsError | typeof import("./Errors.js").AuthPolicyDeniedError | typeof AuthRateLimitedError | typeof AuthInternalError>, AuthSchemaErrorMiddleware | AuthOriginCheckMiddleware | AuthRateLimitMiddleware, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"signUp", "POST", "/auth/password/sign-up", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
100
|
+
readonly email: Schema.brand<Schema.String, "auth/Email">;
|
|
101
|
+
readonly password: Schema.String;
|
|
102
|
+
readonly emailVerified: Schema.optional<Schema.Boolean>;
|
|
103
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
104
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Union<readonly [Schema.Struct<{
|
|
105
|
+
readonly type: Schema.Literal<"authenticated">;
|
|
106
|
+
readonly expiresAt: Schema.Number;
|
|
107
|
+
readonly aal: Schema.Literals<readonly ["aal1", "aal2", "aal3"]>;
|
|
108
|
+
readonly amr: Schema.$Array<Schema.String>;
|
|
109
|
+
readonly claims: Schema.optional<Schema.Struct<{
|
|
110
|
+
readonly emailVerified: Schema.optional<Schema.Boolean>;
|
|
111
|
+
readonly requirements: Schema.optional<Schema.$Array<Schema.String>>;
|
|
112
|
+
}>>;
|
|
113
|
+
}>, Schema.Struct<{
|
|
114
|
+
readonly type: Schema.Literal<"requires_mfa">;
|
|
115
|
+
readonly flowId: Schema.String;
|
|
116
|
+
readonly factors: Schema.$Array<Schema.Struct<{
|
|
117
|
+
readonly type: Schema.String;
|
|
118
|
+
}>>;
|
|
119
|
+
}>, Schema.Struct<{
|
|
120
|
+
readonly type: Schema.Literal<"requires_email_verification">;
|
|
121
|
+
readonly flowId: Schema.String;
|
|
122
|
+
}>, Schema.Struct<{
|
|
123
|
+
readonly type: Schema.Literal<"requires_passkey_enrollment">;
|
|
124
|
+
readonly flowId: Schema.String;
|
|
125
|
+
}>]>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthBadRequestError | typeof import("./Errors.js").AuthPolicyDeniedError | typeof AuthRateLimitedError | typeof AuthEmailAlreadyRegisteredError | typeof AuthInternalError>, AuthSchemaErrorMiddleware | AuthOriginCheckMiddleware | AuthRateLimitMiddleware, never>, false>;
|
|
126
|
+
export declare class PasswordApi extends PasswordApi_base {
|
|
127
|
+
}
|
|
128
|
+
declare const SessionApi_base: HttpApiGroup.HttpApiGroup<"session", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"current", "GET", "/auth/session", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
129
|
+
readonly type: Schema.Literal<"authenticated">;
|
|
130
|
+
readonly userId: Schema.String;
|
|
131
|
+
readonly sessionId: Schema.String;
|
|
132
|
+
readonly authTime: Schema.Number;
|
|
133
|
+
readonly expiresAt: Schema.Number;
|
|
134
|
+
readonly aal: Schema.Literals<readonly ["aal1", "aal2", "aal3"]>;
|
|
135
|
+
readonly amr: Schema.$Array<Schema.String>;
|
|
136
|
+
readonly claims: Schema.optional<Schema.Struct<{
|
|
137
|
+
readonly emailVerified: Schema.optional<Schema.Boolean>;
|
|
138
|
+
readonly requirements: Schema.optional<Schema.$Array<Schema.String>>;
|
|
139
|
+
}>>;
|
|
140
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthUnauthenticatedError | typeof AuthInternalError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"refresh", "POST", "/auth/session/refresh", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
141
|
+
readonly type: Schema.Literal<"authenticated">;
|
|
142
|
+
readonly userId: Schema.String;
|
|
143
|
+
readonly sessionId: Schema.String;
|
|
144
|
+
readonly authTime: Schema.Number;
|
|
145
|
+
readonly expiresAt: Schema.Number;
|
|
146
|
+
readonly aal: Schema.Literals<readonly ["aal1", "aal2", "aal3"]>;
|
|
147
|
+
readonly amr: Schema.$Array<Schema.String>;
|
|
148
|
+
readonly claims: Schema.optional<Schema.Struct<{
|
|
149
|
+
readonly emailVerified: Schema.optional<Schema.Boolean>;
|
|
150
|
+
readonly requirements: Schema.optional<Schema.$Array<Schema.String>>;
|
|
151
|
+
}>>;
|
|
152
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthUnauthenticatedError | typeof AuthInternalError>, AuthOriginCheckMiddleware, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"logout", "POST", "/auth/logout", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").NoContent>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthInternalError>, AuthOriginCheckMiddleware, never>, false>;
|
|
153
|
+
export declare class SessionApi extends SessionApi_base {
|
|
154
|
+
}
|
|
155
|
+
declare const EmailVerificationApi_base: HttpApiGroup.HttpApiGroup<"emailVerification", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verify", "POST", "/auth/email-verification/verify", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
156
|
+
readonly challengeId: Schema.brand<Schema.String, "auth/ChallengeId">;
|
|
157
|
+
readonly secret: Schema.optional<Schema.String>;
|
|
158
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").NoContent>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthBadRequestError | typeof AuthInternalError>, AuthSchemaErrorMiddleware | AuthOriginCheckMiddleware, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"start", "POST", "/auth/email-verification/start", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<Schema.Struct<{
|
|
159
|
+
readonly userId: Schema.brand<Schema.String, "auth/UserId">;
|
|
160
|
+
readonly email: Schema.brand<Schema.String, "auth/Email">;
|
|
161
|
+
readonly secret: Schema.optional<Schema.String>;
|
|
162
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
163
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").NoContent>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof AuthBadRequestError | typeof AuthRateLimitedError | typeof AuthInternalError>, AuthSchemaErrorMiddleware | AuthOriginCheckMiddleware | AuthRateLimitMiddleware, never>, false>;
|
|
164
|
+
export declare class EmailVerificationApi extends EmailVerificationApi_base {
|
|
165
|
+
}
|
|
166
|
+
declare const AuthApi_base: HttpApi.HttpApi<"AuthApi", typeof PasswordApi | typeof SessionApi | typeof EmailVerificationApi>;
|
|
167
|
+
export declare class AuthApi extends AuthApi_base {
|
|
168
|
+
}
|
|
169
|
+
export declare const PasswordApiLive: Layer.Layer<HttpApiGroup.ApiGroup<"AuthApi", "password">, never, EmailVerificationFlow | PasswordLogin | PasswordRegistration | AuthSchemaErrorMiddleware | AuthHttp | AuthApiRateLimit | AuthOriginCheckMiddleware | AuthRateLimitMiddleware>;
|
|
170
|
+
export declare const SessionApiLive: Layer.Layer<HttpApiGroup.ApiGroup<"AuthApi", "session">, never, Sessions | SessionCookie | AuthHttp | AuthOriginCheckMiddleware>;
|
|
171
|
+
export declare const EmailVerificationApiLive: Layer.Layer<HttpApiGroup.ApiGroup<"AuthApi", "emailVerification">, never, Sessions | SessionCookie | EmailVerificationFlow | EmailVerification | AuthSchemaErrorMiddleware | AuthApiRateLimit | AuthOriginCheckMiddleware | AuthRateLimitMiddleware>;
|
|
172
|
+
export declare const AuthHttpApiBareLive: Layer.Layer<never, never, Sessions | SessionCookie | EmailVerificationFlow | EmailVerification | PasswordLogin | PasswordRegistration | AuthHttp | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpRouter").HttpRouter | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
|
173
|
+
export declare const AuthHttpApiLive: Layer.Layer<never, never, Sessions | SessionCookie | EmailVerificationFlow | EmailVerification | PasswordLogin | PasswordRegistration | import("../Privacy.js").Privacy | AuthHttp | import("../RateLimiter.js").RateLimiter | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpRouter").HttpRouter | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
|
174
|
+
export { AuthResult };
|
|
175
|
+
//# sourceMappingURL=Api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/HttpApi/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAY,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAkB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAEL,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAE7B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EAEnB,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAA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,CAAC"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { Effect, Layer, Option, Redacted } from "effect";
|
|
2
|
+
import { HttpServerResponse } from "effect/unstable/http";
|
|
3
|
+
import { HttpApi, HttpApiBuilder, HttpApiGroup } from "effect/unstable/httpapi";
|
|
4
|
+
import { AuthResult } from "../AuthFlow.js";
|
|
5
|
+
import { EmailDeliveryError, EmailVerification, EmailVerificationFlow, EmailVerificationIssueError, } from "../EmailVerification.js";
|
|
6
|
+
import { PasswordLogin, PasswordRegistration } from "../Password.js";
|
|
7
|
+
import { SessionCookie, Sessions } from "../Sessions.js";
|
|
8
|
+
import { currentSessionEndpoint, emailVerificationStartEndpoint, emailVerificationVerifyEndpoint, logoutEndpoint, passwordSignInEndpoint, passwordSignUpEndpoint, refreshSessionEndpoint, } from "./Endpoints.js";
|
|
9
|
+
import { AuthBadRequestError, AuthEmailAlreadyRegisteredError, AuthInternalError, AuthRateLimitedError, AuthSchemaErrorMiddleware, AuthSchemaErrorMiddlewareLive, AuthUnauthenticatedError, } from "./Errors.js";
|
|
10
|
+
import { AuthApiRateLimit, AuthApiRateLimitLive, AuthApiRateLimitNoopLive, AuthOriginCheckMiddleware, AuthOriginCheckMiddlewareConfigLive, AuthRateLimitMiddleware, } from "./Security.js";
|
|
11
|
+
import { AuthHttp } from "./Transport.js";
|
|
12
|
+
const canStartRequiredEmailVerification = (result) => result._tag === "RequiresEmailVerification" &&
|
|
13
|
+
result.userId !== undefined &&
|
|
14
|
+
result.email !== undefined;
|
|
15
|
+
const noopAuthApiRateLimit = AuthApiRateLimit.make({
|
|
16
|
+
request: () => Effect.void,
|
|
17
|
+
passwordSignIn: () => Effect.void,
|
|
18
|
+
passwordSignUp: () => Effect.void,
|
|
19
|
+
emailVerificationStart: () => Effect.void,
|
|
20
|
+
});
|
|
21
|
+
export const passwordSignInInput = (payload) => ({
|
|
22
|
+
...payload,
|
|
23
|
+
password: Redacted.make(payload.password),
|
|
24
|
+
});
|
|
25
|
+
export const passwordSignUpInput = (payload) => ({
|
|
26
|
+
...payload,
|
|
27
|
+
password: Redacted.make(payload.password),
|
|
28
|
+
});
|
|
29
|
+
export const emailVerificationStartInput = (payload) => {
|
|
30
|
+
const { secret, ...input } = payload;
|
|
31
|
+
return {
|
|
32
|
+
...input,
|
|
33
|
+
...(secret === undefined ? {} : { secret: Redacted.make(secret) }),
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export const emailVerificationVerifyInput = (payload) => {
|
|
37
|
+
const { secret, ...input } = payload;
|
|
38
|
+
return {
|
|
39
|
+
...input,
|
|
40
|
+
...(secret === undefined ? {} : { secret: Redacted.make(secret) }),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const webRequestFromHeaders = (headers) => new Request("http://localhost", { headers });
|
|
44
|
+
const emailVerifiedClaims = (claims) => {
|
|
45
|
+
const requirements = claims?.requirements?.filter((requirement) => requirement !== "email_verification");
|
|
46
|
+
return {
|
|
47
|
+
...claims,
|
|
48
|
+
emailVerified: true,
|
|
49
|
+
...(requirements === undefined ? {} : { requirements }),
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
const readOptionalSession = (dependencies, request) => Effect.gen(function* () {
|
|
53
|
+
const tokenOption = yield* dependencies.sessionCookie
|
|
54
|
+
.read(webRequestFromHeaders(request.headers))
|
|
55
|
+
.pipe(Effect.catchTag("SessionValidateError", (error) => error.cause === undefined
|
|
56
|
+
? Effect.succeed(Option.none())
|
|
57
|
+
: Effect.fail(new AuthInternalError({
|
|
58
|
+
code: "internal_error",
|
|
59
|
+
message: "Failed to validate session",
|
|
60
|
+
}))));
|
|
61
|
+
if (Option.isNone(tokenOption)) {
|
|
62
|
+
return Option.none();
|
|
63
|
+
}
|
|
64
|
+
return yield* dependencies.sessions.validate(tokenOption.value).pipe(Effect.map(Option.some), Effect.catchTag("SessionValidateError", (error) => error.cause === undefined
|
|
65
|
+
? Effect.succeed(Option.none())
|
|
66
|
+
: Effect.fail(new AuthInternalError({
|
|
67
|
+
code: "internal_error",
|
|
68
|
+
message: "Failed to validate session",
|
|
69
|
+
}))));
|
|
70
|
+
});
|
|
71
|
+
const upgradeVerifiedEmailSession = (dependencies, request, verified) => Effect.gen(function* () {
|
|
72
|
+
const sessionOption = yield* readOptionalSession(dependencies, request);
|
|
73
|
+
if (Option.isNone(sessionOption)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const session = sessionOption.value.currentSession;
|
|
77
|
+
if (session.userId !== verified.user.id) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
yield* dependencies.sessions
|
|
81
|
+
.updateClaims({
|
|
82
|
+
sessionId: session.sessionId,
|
|
83
|
+
claims: emailVerifiedClaims(session.claims),
|
|
84
|
+
reason: "email_verification",
|
|
85
|
+
})
|
|
86
|
+
.pipe(Effect.catchTag("SessionUpdateClaimsError", (error) => error.cause === undefined
|
|
87
|
+
? Effect.void
|
|
88
|
+
: Effect.fail(new AuthInternalError({
|
|
89
|
+
code: "internal_error",
|
|
90
|
+
message: "Failed to update session claims",
|
|
91
|
+
}))));
|
|
92
|
+
});
|
|
93
|
+
const startRequiredEmailVerification = (dependencies, result) => Effect.gen(function* () {
|
|
94
|
+
if (dependencies.emailVerificationFlow === undefined ||
|
|
95
|
+
!canStartRequiredEmailVerification(result)) {
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
const input = {
|
|
99
|
+
userId: result.userId,
|
|
100
|
+
email: result.email,
|
|
101
|
+
};
|
|
102
|
+
const authApiRateLimit = dependencies.authApiRateLimit ?? noopAuthApiRateLimit;
|
|
103
|
+
yield* catchAuthApiRateLimit(authApiRateLimit.emailVerificationStart(input), "Failed to start email verification");
|
|
104
|
+
yield* dependencies.emailVerificationFlow
|
|
105
|
+
.start(input)
|
|
106
|
+
.pipe(Effect.catchTag("EmailVerificationFlowStartError", () => Effect.fail(passwordInternalError("Failed to start email verification"))));
|
|
107
|
+
return result;
|
|
108
|
+
});
|
|
109
|
+
const rateLimited = (retryAfter) => new AuthRateLimitedError({
|
|
110
|
+
code: "rate_limited",
|
|
111
|
+
message: "Too many authentication attempts",
|
|
112
|
+
retryAfter,
|
|
113
|
+
});
|
|
114
|
+
const passwordInternalError = (message) => new AuthInternalError({
|
|
115
|
+
code: "internal_error",
|
|
116
|
+
message,
|
|
117
|
+
});
|
|
118
|
+
const catchAuthApiRateLimit = (effect, internalMessage) => effect.pipe(Effect.catchTag("RateLimitExceededError", (error) => Effect.fail(rateLimited(error.retryAfter))), Effect.catchTag("RateLimitStoreError", () => Effect.fail(passwordInternalError(internalMessage))), Effect.catchTag("PrivacyError", () => Effect.fail(passwordInternalError(internalMessage))));
|
|
119
|
+
export const makePasswordSignInHandler = (dependencies) => Effect.fn("auth.http.password.sign_in")(function* ({ payload, }) {
|
|
120
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "password.sign_in");
|
|
121
|
+
const input = passwordSignInInput(payload);
|
|
122
|
+
const authApiRateLimit = dependencies.authApiRateLimit ?? noopAuthApiRateLimit;
|
|
123
|
+
yield* catchAuthApiRateLimit(authApiRateLimit.passwordSignIn(input), "Failed to sign in with password");
|
|
124
|
+
const result = yield* dependencies.password.signIn(input).pipe(Effect.catchTag("StorageError", () => Effect.fail(passwordInternalError("Failed to sign in with password"))), Effect.catchTag("PasswordHashError", () => Effect.fail(passwordInternalError("Failed to sign in with password"))), Effect.catchTag("SessionCreateError", () => Effect.fail(passwordInternalError("Failed to sign in with password"))));
|
|
125
|
+
yield* startRequiredEmailVerification(dependencies, result);
|
|
126
|
+
return yield* dependencies.authHttp.commitPasswordSignInResult(result);
|
|
127
|
+
});
|
|
128
|
+
export const makePasswordSignUpHandler = (dependencies) => Effect.fn("auth.http.password.sign_up")(function* ({ payload, }) {
|
|
129
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "password.sign_up");
|
|
130
|
+
const input = passwordSignUpInput(payload);
|
|
131
|
+
const authApiRateLimit = dependencies.authApiRateLimit ?? noopAuthApiRateLimit;
|
|
132
|
+
yield* catchAuthApiRateLimit(authApiRateLimit.passwordSignUp(input), "Failed to sign up with password");
|
|
133
|
+
const result = yield* dependencies.registration.signUp(input).pipe(Effect.catchTag("EmailAlreadyRegisteredError", () => Effect.fail(new AuthEmailAlreadyRegisteredError({
|
|
134
|
+
code: "email_already_registered",
|
|
135
|
+
message: "Email is already registered",
|
|
136
|
+
}))), Effect.catchTag("StorageError", () => Effect.fail(passwordInternalError("Failed to sign up with password"))), Effect.catchTag("PasswordHashError", () => Effect.fail(passwordInternalError("Failed to sign up with password"))), Effect.catchTag("CryptoError", () => Effect.fail(passwordInternalError("Failed to sign up with password"))), Effect.catchTag("SessionCreateError", () => Effect.fail(passwordInternalError("Failed to sign up with password"))));
|
|
137
|
+
yield* startRequiredEmailVerification(dependencies, result);
|
|
138
|
+
return yield* dependencies.authHttp.commitPasswordSignUpResult(result);
|
|
139
|
+
});
|
|
140
|
+
export const makeCurrentSessionHandler = (dependencies) => Effect.fn("auth.http.session.current")(function* ({ request, }) {
|
|
141
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "session.current");
|
|
142
|
+
const tokenOption = yield* dependencies.sessionCookie
|
|
143
|
+
.read(webRequestFromHeaders(request.headers))
|
|
144
|
+
.pipe(Effect.mapError((error) => error.cause === undefined
|
|
145
|
+
? new AuthUnauthenticatedError({
|
|
146
|
+
code: "unauthenticated",
|
|
147
|
+
message: "Unauthenticated",
|
|
148
|
+
})
|
|
149
|
+
: new AuthInternalError({
|
|
150
|
+
code: "internal_error",
|
|
151
|
+
message: "Failed to validate session",
|
|
152
|
+
})));
|
|
153
|
+
if (Option.isNone(tokenOption)) {
|
|
154
|
+
return yield* new AuthUnauthenticatedError({
|
|
155
|
+
code: "unauthenticated",
|
|
156
|
+
message: "Unauthenticated",
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
const session = yield* dependencies.sessions
|
|
160
|
+
.validate(tokenOption.value)
|
|
161
|
+
.pipe(Effect.mapError((error) => error.cause === undefined
|
|
162
|
+
? new AuthUnauthenticatedError({
|
|
163
|
+
code: "unauthenticated",
|
|
164
|
+
message: "Unauthenticated",
|
|
165
|
+
})
|
|
166
|
+
: new AuthInternalError({
|
|
167
|
+
code: "internal_error",
|
|
168
|
+
message: "Failed to validate session",
|
|
169
|
+
})));
|
|
170
|
+
return yield* dependencies.authHttp.commitCurrentSession(session);
|
|
171
|
+
});
|
|
172
|
+
export const makeRefreshSessionHandler = (dependencies) => Effect.fn("auth.http.session.refresh")(function* ({ request, }) {
|
|
173
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "session.refresh");
|
|
174
|
+
const tokenOption = yield* dependencies.sessionCookie
|
|
175
|
+
.read(webRequestFromHeaders(request.headers))
|
|
176
|
+
.pipe(Effect.mapError((error) => error.cause === undefined
|
|
177
|
+
? new AuthUnauthenticatedError({
|
|
178
|
+
code: "unauthenticated",
|
|
179
|
+
message: "Unauthenticated",
|
|
180
|
+
})
|
|
181
|
+
: new AuthInternalError({
|
|
182
|
+
code: "internal_error",
|
|
183
|
+
message: "Failed to validate session",
|
|
184
|
+
})));
|
|
185
|
+
if (Option.isNone(tokenOption)) {
|
|
186
|
+
return yield* new AuthUnauthenticatedError({
|
|
187
|
+
code: "unauthenticated",
|
|
188
|
+
message: "Unauthenticated",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const session = yield* dependencies.sessions
|
|
192
|
+
.refresh(tokenOption.value)
|
|
193
|
+
.pipe(Effect.mapError((error) => error.cause === undefined
|
|
194
|
+
? new AuthUnauthenticatedError({
|
|
195
|
+
code: "unauthenticated",
|
|
196
|
+
message: "Unauthenticated",
|
|
197
|
+
})
|
|
198
|
+
: new AuthInternalError({
|
|
199
|
+
code: "internal_error",
|
|
200
|
+
message: "Failed to refresh session",
|
|
201
|
+
})));
|
|
202
|
+
return yield* dependencies.authHttp.commitSessionRefreshed(session);
|
|
203
|
+
});
|
|
204
|
+
export const makeLogoutHandler = (dependencies) => Effect.fn("auth.http.session.logout")(function* ({ request, }) {
|
|
205
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "session.logout");
|
|
206
|
+
const tokenOption = yield* dependencies.sessionCookie
|
|
207
|
+
.read(webRequestFromHeaders(request.headers))
|
|
208
|
+
.pipe(Effect.catchTag("SessionValidateError", (error) => error.cause === undefined
|
|
209
|
+
? Effect.succeed(Option.none())
|
|
210
|
+
: Effect.fail(new AuthInternalError({
|
|
211
|
+
code: "internal_error",
|
|
212
|
+
message: "Failed to validate session",
|
|
213
|
+
}))));
|
|
214
|
+
if (Option.isSome(tokenOption)) {
|
|
215
|
+
const sessionOption = yield* dependencies.sessions
|
|
216
|
+
.validate(tokenOption.value)
|
|
217
|
+
.pipe(Effect.map(Option.some), Effect.catchTag("SessionValidateError", (error) => error.cause === undefined
|
|
218
|
+
? Effect.succeed(Option.none())
|
|
219
|
+
: Effect.fail(new AuthInternalError({
|
|
220
|
+
code: "internal_error",
|
|
221
|
+
message: "Failed to validate session",
|
|
222
|
+
}))));
|
|
223
|
+
if (Option.isSome(sessionOption)) {
|
|
224
|
+
yield* dependencies.sessions
|
|
225
|
+
.revoke({
|
|
226
|
+
sessionId: sessionOption.value.currentSession.sessionId,
|
|
227
|
+
reason: "logout",
|
|
228
|
+
})
|
|
229
|
+
.pipe(Effect.mapError(() => new AuthInternalError({
|
|
230
|
+
code: "internal_error",
|
|
231
|
+
message: "Failed to revoke session",
|
|
232
|
+
})));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return yield* dependencies.authHttp.commitSessionCleared();
|
|
236
|
+
});
|
|
237
|
+
export const makeEmailVerificationStartHandler = (dependencies) => Effect.fn("auth.http.email_verification.start")(function* ({ payload, }) {
|
|
238
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "email_verification.start");
|
|
239
|
+
const input = emailVerificationStartInput(payload);
|
|
240
|
+
const authApiRateLimit = dependencies.authApiRateLimit ?? noopAuthApiRateLimit;
|
|
241
|
+
yield* catchAuthApiRateLimit(authApiRateLimit.emailVerificationStart(input), "Failed to start email verification");
|
|
242
|
+
yield* dependencies.emailVerificationFlow.start(input).pipe(Effect.catchTag("EmailVerificationFlowStartError", (error) => Effect.fail(error.cause instanceof EmailVerificationIssueError
|
|
243
|
+
? new AuthBadRequestError({
|
|
244
|
+
code: "bad_request",
|
|
245
|
+
message: "Invalid email verification request",
|
|
246
|
+
})
|
|
247
|
+
: error.cause instanceof EmailDeliveryError
|
|
248
|
+
? new AuthInternalError({
|
|
249
|
+
code: "internal_error",
|
|
250
|
+
message: "Failed to send email verification",
|
|
251
|
+
})
|
|
252
|
+
: new AuthInternalError({
|
|
253
|
+
code: "internal_error",
|
|
254
|
+
message: "Failed to start email verification",
|
|
255
|
+
}))));
|
|
256
|
+
return HttpServerResponse.empty({ status: 204 });
|
|
257
|
+
});
|
|
258
|
+
export const makeEmailVerificationVerifyHandler = (dependencies) => Effect.fn("auth.http.email_verification.verify")(function* ({ payload, request, }) {
|
|
259
|
+
yield* Effect.annotateCurrentSpan("auth.http.endpoint", "email_verification.verify");
|
|
260
|
+
const verified = yield* dependencies.emailVerification
|
|
261
|
+
.verify(emailVerificationVerifyInput(payload))
|
|
262
|
+
.pipe(Effect.mapError(() => new AuthBadRequestError({
|
|
263
|
+
code: "bad_request",
|
|
264
|
+
message: "Invalid email verification request",
|
|
265
|
+
})));
|
|
266
|
+
yield* upgradeVerifiedEmailSession(dependencies, request, verified);
|
|
267
|
+
return HttpServerResponse.empty({ status: 204 });
|
|
268
|
+
});
|
|
269
|
+
export class PasswordApi extends HttpApiGroup.make("password")
|
|
270
|
+
.add(passwordSignInEndpoint.middleware(AuthRateLimitMiddleware), passwordSignUpEndpoint.middleware(AuthRateLimitMiddleware))
|
|
271
|
+
.prefix("/auth/password")
|
|
272
|
+
.middleware(AuthSchemaErrorMiddleware)
|
|
273
|
+
.middleware(AuthOriginCheckMiddleware) {
|
|
274
|
+
}
|
|
275
|
+
export class SessionApi extends HttpApiGroup.make("session")
|
|
276
|
+
.add(currentSessionEndpoint, refreshSessionEndpoint.middleware(AuthOriginCheckMiddleware), logoutEndpoint.middleware(AuthOriginCheckMiddleware))
|
|
277
|
+
.prefix("/auth") {
|
|
278
|
+
}
|
|
279
|
+
export class EmailVerificationApi extends HttpApiGroup.make("emailVerification")
|
|
280
|
+
.add(emailVerificationStartEndpoint.middleware(AuthRateLimitMiddleware), emailVerificationVerifyEndpoint)
|
|
281
|
+
.prefix("/auth/email-verification")
|
|
282
|
+
.middleware(AuthSchemaErrorMiddleware)
|
|
283
|
+
.middleware(AuthOriginCheckMiddleware) {
|
|
284
|
+
}
|
|
285
|
+
export class AuthApi extends HttpApi.make("AuthApi")
|
|
286
|
+
.add(PasswordApi)
|
|
287
|
+
.add(SessionApi)
|
|
288
|
+
.add(EmailVerificationApi) {
|
|
289
|
+
}
|
|
290
|
+
export const PasswordApiLive = HttpApiBuilder.group(AuthApi, "password", Effect.fn("auth.http.password.group")(function* (handlers) {
|
|
291
|
+
const password = yield* PasswordLogin;
|
|
292
|
+
const registration = yield* PasswordRegistration;
|
|
293
|
+
const authHttp = yield* AuthHttp;
|
|
294
|
+
const emailVerificationFlow = yield* EmailVerificationFlow;
|
|
295
|
+
const authApiRateLimit = yield* AuthApiRateLimit;
|
|
296
|
+
return handlers
|
|
297
|
+
.handle("signIn", makePasswordSignInHandler({
|
|
298
|
+
password,
|
|
299
|
+
authHttp,
|
|
300
|
+
emailVerificationFlow,
|
|
301
|
+
authApiRateLimit,
|
|
302
|
+
}))
|
|
303
|
+
.handle("signUp", makePasswordSignUpHandler({
|
|
304
|
+
registration,
|
|
305
|
+
authHttp,
|
|
306
|
+
emailVerificationFlow,
|
|
307
|
+
authApiRateLimit,
|
|
308
|
+
}));
|
|
309
|
+
}));
|
|
310
|
+
export const SessionApiLive = HttpApiBuilder.group(AuthApi, "session", Effect.fn("auth.http.session.group")(function* (handlers) {
|
|
311
|
+
const sessions = yield* Sessions;
|
|
312
|
+
const sessionCookie = yield* SessionCookie;
|
|
313
|
+
const authHttp = yield* AuthHttp;
|
|
314
|
+
return handlers
|
|
315
|
+
.handle("current", makeCurrentSessionHandler({ sessions, sessionCookie, authHttp }))
|
|
316
|
+
.handle("refresh", makeRefreshSessionHandler({ sessions, sessionCookie, authHttp }))
|
|
317
|
+
.handle("logout", makeLogoutHandler({ sessions, sessionCookie, authHttp }));
|
|
318
|
+
}));
|
|
319
|
+
export const EmailVerificationApiLive = HttpApiBuilder.group(AuthApi, "emailVerification", Effect.fn("auth.http.email_verification.group")(function* (handlers) {
|
|
320
|
+
const emailVerificationFlow = yield* EmailVerificationFlow;
|
|
321
|
+
const emailVerification = yield* EmailVerification;
|
|
322
|
+
const sessions = yield* Sessions;
|
|
323
|
+
const sessionCookie = yield* SessionCookie;
|
|
324
|
+
const authApiRateLimit = yield* AuthApiRateLimit;
|
|
325
|
+
return handlers
|
|
326
|
+
.handle("start", makeEmailVerificationStartHandler({
|
|
327
|
+
emailVerificationFlow,
|
|
328
|
+
authApiRateLimit,
|
|
329
|
+
}))
|
|
330
|
+
.handle("verify", makeEmailVerificationVerifyHandler({
|
|
331
|
+
emailVerification,
|
|
332
|
+
sessions,
|
|
333
|
+
sessionCookie,
|
|
334
|
+
}));
|
|
335
|
+
}));
|
|
336
|
+
const AuthHttpApiBaseLive = HttpApiBuilder.layer(AuthApi).pipe(Layer.provide(PasswordApiLive), Layer.provide(SessionApiLive), Layer.provide(EmailVerificationApiLive), Layer.provide(AuthOriginCheckMiddlewareConfigLive), Layer.provide(AuthSchemaErrorMiddlewareLive));
|
|
337
|
+
export const AuthHttpApiBareLive = AuthHttpApiBaseLive.pipe(Layer.provide(AuthApiRateLimitNoopLive));
|
|
338
|
+
export const AuthHttpApiLive = AuthHttpApiBaseLive.pipe(Layer.provide(AuthApiRateLimitLive));
|
|
339
|
+
export { AuthResult };
|
|
340
|
+
//# sourceMappingURL=Api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Api.js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