@aotter/mantle-cloudflare 0.1.2 → 0.1.3-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 +6 -0
- package/dist/auth/conventionalAuth.d.ts +1 -1
- package/dist/auth/conventionalAuth.d.ts.map +1 -1
- package/dist/auth/conventionalAuth.js +2 -1
- package/dist/auth/conventionalAuth.js.map +1 -1
- package/dist/auth/createAuth.d.ts +15 -426
- package/dist/auth/createAuth.d.ts.map +1 -1
- package/dist/auth/createAuth.js +24 -1260
- package/dist/auth/createAuth.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/mount/bootRuntimeOnce.d.ts +1 -1
- package/dist/mount/bootRuntimeOnce.d.ts.map +1 -1
- package/dist/mount/cmsConfig.d.ts +1 -1
- package/dist/mount/cmsConfig.d.ts.map +1 -1
- package/dist/mount/index.d.ts +1 -1
- package/dist/mount/index.d.ts.map +1 -1
- package/dist/mount/index.js +1 -1
- package/dist/mount/index.js.map +1 -1
- package/dist/mount/mountMcp.d.ts.map +1 -1
- package/dist/mount/mountMcp.js +62 -32
- package/dist/mount/mountMcp.js.map +1 -1
- package/dist/mount/mountPublicRoutes.js +1 -1
- package/dist/mount/mountPublicRoutes.js.map +1 -1
- package/dist/mount/mountRuntimeEndpoints.d.ts.map +1 -1
- package/dist/mount/mountRuntimeEndpoints.js +5 -11
- package/dist/mount/mountRuntimeEndpoints.js.map +1 -1
- package/dist/mount/resolveCaller.d.ts +32 -2
- package/dist/mount/resolveCaller.d.ts.map +1 -1
- package/dist/mount/resolveCaller.js +71 -13
- package/dist/mount/resolveCaller.js.map +1 -1
- package/dist/worker/createMantleWorker.d.ts +1 -1
- package/dist/worker/createMantleWorker.d.ts.map +1 -1
- package/package.json +6 -8
- package/dist/auth/ConsoleEmailSender.d.ts +0 -15
- package/dist/auth/ConsoleEmailSender.d.ts.map +0 -1
- package/dist/auth/ConsoleEmailSender.js +0 -19
- package/dist/auth/ConsoleEmailSender.js.map +0 -1
- package/dist/auth/appleClientSecret.d.ts +0 -72
- package/dist/auth/appleClientSecret.d.ts.map +0 -1
- package/dist/auth/appleClientSecret.js +0 -113
- package/dist/auth/appleClientSecret.js.map +0 -1
- package/dist/auth/emailTemplates.d.ts +0 -7
- package/dist/auth/emailTemplates.d.ts.map +0 -1
- package/dist/auth/emailTemplates.js +0 -27
- package/dist/auth/emailTemplates.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HandlerContext } from "@aotter/mantle-runtime";
|
|
2
2
|
import { type Diagnostic } from "@aotter/mantle-spec";
|
|
3
|
-
import { type Auth } from "
|
|
3
|
+
import { type MantleAuth as Auth } from "@aotter/mantle-auth";
|
|
4
4
|
export type ConsumerCredentialResolution = {
|
|
5
5
|
readonly kind: "not-handled";
|
|
6
6
|
} | {
|
|
@@ -30,7 +30,11 @@ export interface ResolveCallerOptions {
|
|
|
30
30
|
};
|
|
31
31
|
readonly env?: unknown;
|
|
32
32
|
readonly waitUntil?: (promise: Promise<unknown>) => void;
|
|
33
|
+
/** Optional observability wrapper around the two I/O steps: bearer
|
|
34
|
+
* verification (`oauth`) and the fresh role read (`role`). */
|
|
35
|
+
readonly phase?: PhaseHook;
|
|
33
36
|
}
|
|
37
|
+
export type PhaseHook = <T>(phase: "oauth" | "role", run: () => Promise<T>) => Promise<T>;
|
|
34
38
|
export type CallerResolution = {
|
|
35
39
|
readonly kind: "anonymous" | "authenticated";
|
|
36
40
|
readonly context: HandlerContext;
|
|
@@ -38,10 +42,36 @@ export type CallerResolution = {
|
|
|
38
42
|
readonly kind: "invalid";
|
|
39
43
|
readonly status: 401 | 403;
|
|
40
44
|
readonly diagnostic: Diagnostic;
|
|
45
|
+
/** Verifier reason (e.g. `invalid-dpop-proof`) for transports that render a challenge. */
|
|
46
|
+
readonly reason: string;
|
|
41
47
|
};
|
|
42
48
|
/** Normalize consumer credentials, OAuth bearer, or cookie session in
|
|
43
49
|
* that precedence order. A presented-but-invalid credential never
|
|
44
50
|
* falls back to a valid session cookie. */
|
|
45
51
|
export declare function resolveCaller(request: Request, options: ResolveCallerOptions): Promise<CallerResolution>;
|
|
46
|
-
export declare function contextForVerifiedUser(userId: string | null, authContext: NonNullable<HandlerContext["auth"]>, auth: Auth, base: Pick<HandlerContext, "env" | "waitUntil">, currentRole?: string | null): Promise<HandlerContext>;
|
|
52
|
+
export declare function contextForVerifiedUser(userId: string | null, authContext: NonNullable<HandlerContext["auth"]>, auth: Auth, base: Pick<HandlerContext, "env" | "waitUntil">, currentRole?: string | null, phase?: PhaseHook): Promise<HandlerContext>;
|
|
53
|
+
/** Which callers a transport surface admits before the target's own `requires` runs. */
|
|
54
|
+
export type SurfacePolicy = "public" | "staff";
|
|
55
|
+
export type CallerGate = {
|
|
56
|
+
readonly kind: "allow";
|
|
57
|
+
readonly context: HandlerContext;
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: "deny";
|
|
60
|
+
readonly status: 401 | 403;
|
|
61
|
+
readonly diagnostic: Diagnostic;
|
|
62
|
+
/** `invalid-credential`, `invalid-dpop-proof`, `insufficient-scope`, `cross-origin`, `unauthenticated` or `insufficient-role`. */
|
|
63
|
+
readonly reason: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The one caller gate every transport shares (#977). It resolves identity
|
|
67
|
+
* through `resolveCaller`, applies the cross-origin guard only when the
|
|
68
|
+
* credential is a cookie session, and lets `surface` decide exactly one
|
|
69
|
+
* thing: whether `ctx.staff` is required. `public` admits anonymous callers;
|
|
70
|
+
* the target's `requires.auth` and guard still run on every invocation, so
|
|
71
|
+
* enforcement stays where the manifest declares it rather than at the
|
|
72
|
+
* transport. Transports differ only in how they render a denial.
|
|
73
|
+
*/
|
|
74
|
+
export declare function gateCaller(request: Request, options: ResolveCallerOptions & {
|
|
75
|
+
readonly surface?: SurfacePolicy;
|
|
76
|
+
}): Promise<CallerGate>;
|
|
47
77
|
//# sourceMappingURL=resolveCaller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCaller.d.ts","sourceRoot":"","sources":["../../src/mount/resolveCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveCaller.d.ts","sourceRoot":"","sources":["../../src/mount/resolveCaller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,UAAU,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG9E,MAAM,MAAM,4BAA4B,GACpC;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,UAAU,EAAE,SAAS,GAAG,gBAAgB,CAAC;QAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACrC,CAAC;CACH,CAAC;AAEN;oEACoE;AACpE,MAAM,MAAM,0BAA0B,GAAG,CACvC,OAAO,EAAE,OAAO,KACb,4BAA4B,GA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B,CAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAChD,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,WAAW,CAAC,EAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,KAAK,GAAE,SAAqB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAczB;AAuBD,wFAAwF;AACxF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/C,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAC5D;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,kIAAkI;IAClI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAIN;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAA;CAAE,GACnE,OAAO,CAAC,UAAU,CAAC,CAwCrB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { runtimeDiagnostic, } from "@aotter/mantle-spec";
|
|
2
|
-
import { STAFF_ROLE_SET } from "
|
|
2
|
+
import { STAFF_ROLE_SET } from "@aotter/mantle-auth";
|
|
3
|
+
import { rejectCrossOriginMutation } from "@aotter/mantle-admin";
|
|
4
|
+
const runDirect = (_phase, run) => run();
|
|
3
5
|
/** Normalize consumer credentials, OAuth bearer, or cookie session in
|
|
4
6
|
* that precedence order. A presented-but-invalid credential never
|
|
5
7
|
* falls back to a valid session cookie. */
|
|
@@ -8,6 +10,7 @@ export async function resolveCaller(request, options) {
|
|
|
8
10
|
env: options.env ?? {},
|
|
9
11
|
...(options.waitUntil ? { waitUntil: options.waitUntil } : {}),
|
|
10
12
|
};
|
|
13
|
+
const phase = options.phase ?? runDirect;
|
|
11
14
|
if (options.credentialResolver) {
|
|
12
15
|
const resolved = await options.credentialResolver(request);
|
|
13
16
|
if (resolved.kind === "invalid")
|
|
@@ -21,24 +24,27 @@ export async function resolveCaller(request, options) {
|
|
|
21
24
|
credentialId: credential.credentialId,
|
|
22
25
|
clientId: credential.clientId ?? null,
|
|
23
26
|
scopes: credential.scopes ?? [],
|
|
24
|
-
}, options.auth, base),
|
|
27
|
+
}, options.auth, base, undefined, phase),
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
const authorization = request.headers.get("authorization");
|
|
29
32
|
if (authorization !== null) {
|
|
30
|
-
|
|
33
|
+
// Bearer or DPoP (sender-constrained) access tokens; the verifier checks
|
|
34
|
+
// the proof. MCP clients use DPoP, so the shared gate must admit it.
|
|
35
|
+
const token = /^(?:Bearer|DPoP) ([^\s]+)$/i.exec(authorization)?.[1];
|
|
31
36
|
if (!token) {
|
|
32
37
|
return invalidCredential(401);
|
|
33
38
|
}
|
|
34
39
|
if (!options.jwtBearer)
|
|
35
40
|
return invalidCredential(401);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
const jwtBearer = options.jwtBearer;
|
|
42
|
+
const verified = await phase("oauth", () => options.auth.verifyOAuthAccessToken(request, {
|
|
43
|
+
audience: jwtBearer.audience,
|
|
44
|
+
scopes: jwtBearer.scopes,
|
|
45
|
+
}));
|
|
40
46
|
if (!verified.ok)
|
|
41
|
-
return invalidCredential(verified.status);
|
|
47
|
+
return invalidCredential(verified.status, verified.reason);
|
|
42
48
|
return {
|
|
43
49
|
kind: "authenticated",
|
|
44
50
|
context: await contextForVerifiedUser(verified.userId, {
|
|
@@ -46,7 +52,7 @@ export async function resolveCaller(request, options) {
|
|
|
46
52
|
credentialId: verified.credentialId,
|
|
47
53
|
clientId: verified.clientId,
|
|
48
54
|
scopes: verified.scopes,
|
|
49
|
-
}, options.auth, base),
|
|
55
|
+
}, options.auth, base, undefined, phase),
|
|
50
56
|
};
|
|
51
57
|
}
|
|
52
58
|
const session = await options.auth.getSession(request);
|
|
@@ -63,13 +69,13 @@ export async function resolveCaller(request, options) {
|
|
|
63
69
|
credentialId: session.session.id,
|
|
64
70
|
clientId: null,
|
|
65
71
|
scopes: [],
|
|
66
|
-
}, options.auth, base, session.user.roleCurrent ? session.user.role ?? null : undefined),
|
|
72
|
+
}, options.auth, base, session.user.roleCurrent ? session.user.role ?? null : undefined, phase),
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
|
-
export async function contextForVerifiedUser(userId, authContext, auth, base, currentRole) {
|
|
75
|
+
export async function contextForVerifiedUser(userId, authContext, auth, base, currentRole, phase = runDirect) {
|
|
70
76
|
const role = currentRole !== undefined
|
|
71
77
|
? currentRole
|
|
72
|
-
: userId ? await auth.getUserRole(userId) : null;
|
|
78
|
+
: userId ? await phase("role", () => auth.getUserRole(userId)) : null;
|
|
73
79
|
const staff = userId && role && STAFF_ROLE_SET.has(role)
|
|
74
80
|
? { id: userId, role: role }
|
|
75
81
|
: null;
|
|
@@ -80,10 +86,11 @@ export async function contextForVerifiedUser(userId, authContext, auth, base, cu
|
|
|
80
86
|
...base,
|
|
81
87
|
};
|
|
82
88
|
}
|
|
83
|
-
function invalidCredential(status) {
|
|
89
|
+
function invalidCredential(status, reason) {
|
|
84
90
|
return {
|
|
85
91
|
kind: "invalid",
|
|
86
92
|
status,
|
|
93
|
+
reason: reason ?? (status === 403 ? "insufficient-scope" : "invalid-credential"),
|
|
87
94
|
diagnostic: runtimeDiagnostic({
|
|
88
95
|
code: status === 401 ? "UNAUTHENTICATED" : "AUTH_DENIED",
|
|
89
96
|
severity: "error",
|
|
@@ -97,4 +104,55 @@ function invalidCredential(status) {
|
|
|
97
104
|
}),
|
|
98
105
|
};
|
|
99
106
|
}
|
|
107
|
+
const SAFE_METHODS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
108
|
+
/**
|
|
109
|
+
* The one caller gate every transport shares (#977). It resolves identity
|
|
110
|
+
* through `resolveCaller`, applies the cross-origin guard only when the
|
|
111
|
+
* credential is a cookie session, and lets `surface` decide exactly one
|
|
112
|
+
* thing: whether `ctx.staff` is required. `public` admits anonymous callers;
|
|
113
|
+
* the target's `requires.auth` and guard still run on every invocation, so
|
|
114
|
+
* enforcement stays where the manifest declares it rather than at the
|
|
115
|
+
* transport. Transports differ only in how they render a denial.
|
|
116
|
+
*/
|
|
117
|
+
export async function gateCaller(request, options) {
|
|
118
|
+
const caller = await resolveCaller(request, options);
|
|
119
|
+
if (caller.kind === "invalid") {
|
|
120
|
+
return { kind: "deny", status: caller.status, diagnostic: caller.diagnostic, reason: caller.reason };
|
|
121
|
+
}
|
|
122
|
+
if (caller.context.auth?.credential === "session" && !SAFE_METHODS.has(request.method)) {
|
|
123
|
+
const rejected = rejectCrossOriginMutation(request);
|
|
124
|
+
if (rejected) {
|
|
125
|
+
return {
|
|
126
|
+
kind: "deny",
|
|
127
|
+
status: 403,
|
|
128
|
+
reason: "cross-origin",
|
|
129
|
+
diagnostic: runtimeDiagnostic({
|
|
130
|
+
code: "AUTH_DENIED",
|
|
131
|
+
severity: "error",
|
|
132
|
+
path: "request:origin",
|
|
133
|
+
expected: "a same-origin request when the credential is a cookie session",
|
|
134
|
+
message: "Cross-origin session mutation rejected.",
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (options.surface === "staff" && !caller.context.staff) {
|
|
140
|
+
const anonymous = caller.kind === "anonymous";
|
|
141
|
+
return {
|
|
142
|
+
kind: "deny",
|
|
143
|
+
status: anonymous ? 401 : 403,
|
|
144
|
+
reason: anonymous ? "unauthenticated" : "insufficient-role",
|
|
145
|
+
diagnostic: runtimeDiagnostic({
|
|
146
|
+
code: anonymous ? "UNAUTHENTICATED" : "AUTH_DENIED",
|
|
147
|
+
severity: "error",
|
|
148
|
+
path: "request:surface",
|
|
149
|
+
expected: "a staff caller on the staff surface",
|
|
150
|
+
message: anonymous
|
|
151
|
+
? "The staff surface requires a signed-in staff caller."
|
|
152
|
+
: "The caller is signed in but holds no staff role.",
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return { kind: "allow", context: caller.context };
|
|
157
|
+
}
|
|
100
158
|
//# sourceMappingURL=resolveCaller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCaller.js","sourceRoot":"","sources":["../../src/mount/resolveCaller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"resolveCaller.js","sourceRoot":"","sources":["../../src/mount/resolveCaller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAA2B,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAwCjE,MAAM,SAAS,GAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AAepD;;2CAE2C;AAC3C,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAgB,EAChB,OAA6B;IAE7B,MAAM,IAAI,GAAG;QACX,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC;IACF,MAAM,KAAK,GAAG,OAAO,CAAC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MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACzD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC;QAC9C,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;YAC7B,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,mBAAmB;YAC3D,UAAU,EAAE,iBAAiB,CAAC;gBAC5B,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,aAAa;gBACnD,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,qCAAqC;gBAC/C,OAAO,EAAE,SAAS;oBAChB,CAAC,CAAC,sDAAsD;oBACxD,CAAC,CAAC,kDAAkD;aACvD,CAAC;SACH,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { PublicPathResolver, TemplateRegistry } from "@aotter/mantle-web";
|
|
|
4
4
|
import { createRuntimeClient } from "@aotter/mantle-web/client-runtime";
|
|
5
5
|
import type { SiteDefaults } from "@aotter/mantle-spec";
|
|
6
6
|
import { type ConventionalAuthEnv } from "../auth/conventionalAuth.js";
|
|
7
|
-
import type { Auth } from "
|
|
7
|
+
import type { MantleAuth as Auth } from "@aotter/mantle-auth";
|
|
8
8
|
import { type MantleWorkerBindings } from "../bindings/conventionalBindings.js";
|
|
9
9
|
import { type CloudflareMantleRuntime, type MantleRuntimeRef } from "../mount/bootRuntimeOnce.js";
|
|
10
10
|
import type { MantleCloudflareConfig } from "../mount/cmsConfig.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMantleWorker.d.ts","sourceRoot":"","sources":["../../src/worker/createMantleWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,GAAG,IAAI,OAAO,EACnB,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACvB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createMantleWorker.d.ts","sourceRoot":"","sources":["../../src/worker/createMantleWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,GAAG,IAAI,OAAO,EACnB,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACvB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,IAAI,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OA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, Admin, MCP, and public Web mounts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://mantle.tools/",
|
|
@@ -33,13 +33,11 @@
|
|
|
33
33
|
"README.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@aotter/mantle-
|
|
40
|
-
"@aotter/mantle-
|
|
41
|
-
"@aotter/mantle-spec": "0.1.2",
|
|
42
|
-
"@aotter/mantle-web": "0.1.2"
|
|
36
|
+
"@aotter/mantle-admin": "0.1.3-alpha.2",
|
|
37
|
+
"@aotter/mantle-runtime": "0.1.3-alpha.2",
|
|
38
|
+
"@aotter/mantle-spec": "0.1.3-alpha.2",
|
|
39
|
+
"@aotter/mantle-web": "0.1.3-alpha.2",
|
|
40
|
+
"@aotter/mantle-auth": "0.1.3-alpha.2"
|
|
43
41
|
},
|
|
44
42
|
"peerDependencies": {
|
|
45
43
|
"aws4fetch": "^1.0.20",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { EmailSender, EmailSendArgs } from "@aotter/mantle-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Dev convenience: writes the email to `console.log` instead of
|
|
4
|
-
* sending it. Use this in `wrangler dev` to read OTP codes off the
|
|
5
|
-
* Worker logs without wiring a real sender.
|
|
6
|
-
*
|
|
7
|
-
* **Never wire this in production.** Boot diagnostics will not stop
|
|
8
|
-
* you — Better Auth is happy to call `sender.send()` either way —
|
|
9
|
-
* but real recipients won't get the email. Wrap in an env-gated
|
|
10
|
-
* factory at the adapter wiring site.
|
|
11
|
-
*/
|
|
12
|
-
export declare class ConsoleEmailSender implements EmailSender {
|
|
13
|
-
send(args: EmailSendArgs): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=ConsoleEmailSender.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleEmailSender.d.ts","sourceRoot":"","sources":["../../src/auth/ConsoleEmailSender.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IAC9C,IAAI,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ/C"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dev convenience: writes the email to `console.log` instead of
|
|
3
|
-
* sending it. Use this in `wrangler dev` to read OTP codes off the
|
|
4
|
-
* Worker logs without wiring a real sender.
|
|
5
|
-
*
|
|
6
|
-
* **Never wire this in production.** Boot diagnostics will not stop
|
|
7
|
-
* you — Better Auth is happy to call `sender.send()` either way —
|
|
8
|
-
* but real recipients won't get the email. Wrap in an env-gated
|
|
9
|
-
* factory at the adapter wiring site.
|
|
10
|
-
*/
|
|
11
|
-
export class ConsoleEmailSender {
|
|
12
|
-
async send(args) {
|
|
13
|
-
const { to, subject, text, locale, category } = args;
|
|
14
|
-
console.log(`[ConsoleEmailSender] ${category ?? "email"} → ${to} (${locale})\n` +
|
|
15
|
-
` subject: ${subject}\n` +
|
|
16
|
-
` body: ${text}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ConsoleEmailSender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleEmailSender.js","sourceRoot":"","sources":["../../src/auth/ConsoleEmailSender.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,IAAI,CAAC,IAAmB;QAC5B,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QACrD,OAAO,CAAC,GAAG,CACT,wBAAwB,QAAQ,IAAI,OAAO,MAAM,EAAE,KAAK,MAAM,KAAK;YACjE,cAAc,OAAO,IAAI;YACzB,WAAW,IAAI,EAAE,CACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper for the Sign In with Apple `clientSecret` field.
|
|
3
|
-
*
|
|
4
|
-
* Apple's "client secret" is **not** an OAuth client secret — it is
|
|
5
|
-
* an ES256-signed JWT the relying party generates from:
|
|
6
|
-
*
|
|
7
|
-
* - Team ID (Apple Developer team identifier, 10 chars)
|
|
8
|
-
* - Key ID (the Sign-In key id, 10 chars; visible in Apple Developer)
|
|
9
|
-
* - Private key (the `.p8` file Apple lets you download once)
|
|
10
|
-
* - Audience (typically the Services ID — same as the Better Auth
|
|
11
|
-
* `clientId` you pass for `provider: "apple"`)
|
|
12
|
-
*
|
|
13
|
-
* The JWT lives at most 180 days per Apple's policy. This helper
|
|
14
|
-
* defaults to 30 days; **the adopter is responsible for regenerating
|
|
15
|
-
* the JWT before it expires** (e.g. on deploy, or via a scheduled
|
|
16
|
-
* worker). A long-lived Cloudflare isolate can outlive the default,
|
|
17
|
-
* and Apple will reject signin attempts with an expired secret —
|
|
18
|
-
* don't rely on isolate restart cadence for rotation.
|
|
19
|
-
*
|
|
20
|
-
* Built on `crypto.subtle` (native to Workers) — no `node:crypto`, no
|
|
21
|
-
* JWT deps.
|
|
22
|
-
*
|
|
23
|
-
* # Adopter usage
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* const appleSecret = await appleClientSecret({
|
|
27
|
-
* teamId: env.APPLE_TEAM_ID,
|
|
28
|
-
* keyId: env.APPLE_KEY_ID,
|
|
29
|
-
* privateKey: env.APPLE_PRIVATE_KEY, // contents of the .p8 file
|
|
30
|
-
* audience: env.APPLE_SERVICES_ID, // your Services ID
|
|
31
|
-
* });
|
|
32
|
-
* const auth = createAuth({
|
|
33
|
-
* methods: [{
|
|
34
|
-
* kind: "social",
|
|
35
|
-
* provider: "apple",
|
|
36
|
-
* options: {
|
|
37
|
-
* clientId: env.APPLE_SERVICES_ID,
|
|
38
|
-
* clientSecret: appleSecret,
|
|
39
|
-
* },
|
|
40
|
-
* }],
|
|
41
|
-
* // ...
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* `env.APPLE_PRIVATE_KEY` is the multi-line PEM contents of the `.p8`
|
|
46
|
-
* file (set via `wrangler secret put APPLE_PRIVATE_KEY` — paste the
|
|
47
|
-
* whole file when prompted). The helper also accepts the bare
|
|
48
|
-
* base64-encoded DER if the PEM wrapping doesn't survive your secret
|
|
49
|
-
* pipeline.
|
|
50
|
-
*/
|
|
51
|
-
export interface AppleClientSecretArgs {
|
|
52
|
-
/** Apple Developer team identifier (10 chars). */
|
|
53
|
-
readonly teamId: string;
|
|
54
|
-
/** Sign-In key id (10 chars). */
|
|
55
|
-
readonly keyId: string;
|
|
56
|
-
/**
|
|
57
|
-
* `.p8` file contents — either PEM-wrapped
|
|
58
|
-
* (`-----BEGIN PRIVATE KEY-----\n…\n-----END PRIVATE KEY-----`)
|
|
59
|
-
* or just the base64 of the DER.
|
|
60
|
-
*/
|
|
61
|
-
readonly privateKey: string;
|
|
62
|
-
/** Typically the Services ID — same string you pass for `clientId`. */
|
|
63
|
-
readonly audience: string;
|
|
64
|
-
/**
|
|
65
|
-
* JWT lifetime in seconds. Apple caps at 180 days
|
|
66
|
-
* (`180 * 24 * 60 * 60 = 15552000`); the default here is 30 days.
|
|
67
|
-
* The helper rejects values above Apple's cap.
|
|
68
|
-
*/
|
|
69
|
-
readonly expiresInSeconds?: number;
|
|
70
|
-
}
|
|
71
|
-
export declare function appleClientSecret(args: AppleClientSecretArgs): Promise<string>;
|
|
72
|
-
//# sourceMappingURL=appleClientSecret.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appleClientSecret.d.ts","sourceRoot":"","sources":["../../src/auth/appleClientSecret.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,MAAM,WAAW,qBAAqB;IACpC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAMD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper for the Sign In with Apple `clientSecret` field.
|
|
3
|
-
*
|
|
4
|
-
* Apple's "client secret" is **not** an OAuth client secret — it is
|
|
5
|
-
* an ES256-signed JWT the relying party generates from:
|
|
6
|
-
*
|
|
7
|
-
* - Team ID (Apple Developer team identifier, 10 chars)
|
|
8
|
-
* - Key ID (the Sign-In key id, 10 chars; visible in Apple Developer)
|
|
9
|
-
* - Private key (the `.p8` file Apple lets you download once)
|
|
10
|
-
* - Audience (typically the Services ID — same as the Better Auth
|
|
11
|
-
* `clientId` you pass for `provider: "apple"`)
|
|
12
|
-
*
|
|
13
|
-
* The JWT lives at most 180 days per Apple's policy. This helper
|
|
14
|
-
* defaults to 30 days; **the adopter is responsible for regenerating
|
|
15
|
-
* the JWT before it expires** (e.g. on deploy, or via a scheduled
|
|
16
|
-
* worker). A long-lived Cloudflare isolate can outlive the default,
|
|
17
|
-
* and Apple will reject signin attempts with an expired secret —
|
|
18
|
-
* don't rely on isolate restart cadence for rotation.
|
|
19
|
-
*
|
|
20
|
-
* Built on `crypto.subtle` (native to Workers) — no `node:crypto`, no
|
|
21
|
-
* JWT deps.
|
|
22
|
-
*
|
|
23
|
-
* # Adopter usage
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* const appleSecret = await appleClientSecret({
|
|
27
|
-
* teamId: env.APPLE_TEAM_ID,
|
|
28
|
-
* keyId: env.APPLE_KEY_ID,
|
|
29
|
-
* privateKey: env.APPLE_PRIVATE_KEY, // contents of the .p8 file
|
|
30
|
-
* audience: env.APPLE_SERVICES_ID, // your Services ID
|
|
31
|
-
* });
|
|
32
|
-
* const auth = createAuth({
|
|
33
|
-
* methods: [{
|
|
34
|
-
* kind: "social",
|
|
35
|
-
* provider: "apple",
|
|
36
|
-
* options: {
|
|
37
|
-
* clientId: env.APPLE_SERVICES_ID,
|
|
38
|
-
* clientSecret: appleSecret,
|
|
39
|
-
* },
|
|
40
|
-
* }],
|
|
41
|
-
* // ...
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* `env.APPLE_PRIVATE_KEY` is the multi-line PEM contents of the `.p8`
|
|
46
|
-
* file (set via `wrangler secret put APPLE_PRIVATE_KEY` — paste the
|
|
47
|
-
* whole file when prompted). The helper also accepts the bare
|
|
48
|
-
* base64-encoded DER if the PEM wrapping doesn't survive your secret
|
|
49
|
-
* pipeline.
|
|
50
|
-
*/
|
|
51
|
-
const DEFAULT_EXPIRES_IN_SECONDS = 30 * 24 * 60 * 60; // 30 days
|
|
52
|
-
const APPLE_MAX_EXPIRES_IN_SECONDS = 180 * 24 * 60 * 60; // 180 days
|
|
53
|
-
const APPLE_TOKEN_AUDIENCE_ISSUER = "https://appleid.apple.com";
|
|
54
|
-
export async function appleClientSecret(args) {
|
|
55
|
-
const expiresIn = args.expiresInSeconds ?? DEFAULT_EXPIRES_IN_SECONDS;
|
|
56
|
-
if (!Number.isFinite(expiresIn) || expiresIn <= 0) {
|
|
57
|
-
// `Number.isFinite` filters NaN / Infinity — without it, NaN slips
|
|
58
|
-
// through `<= 0` and lands as `exp: NaN` → JSON serialises null
|
|
59
|
-
// → Apple rejects opaquely. Catch at the boundary with a clear msg.
|
|
60
|
-
throw new Error("appleClientSecret: expiresInSeconds must be a positive finite number");
|
|
61
|
-
}
|
|
62
|
-
if (expiresIn > APPLE_MAX_EXPIRES_IN_SECONDS) {
|
|
63
|
-
throw new Error(`appleClientSecret: expiresInSeconds ${expiresIn} exceeds Apple's 180-day max (${APPLE_MAX_EXPIRES_IN_SECONDS}).`);
|
|
64
|
-
}
|
|
65
|
-
const now = Math.floor(Date.now() / 1000);
|
|
66
|
-
const header = { alg: "ES256", kid: args.keyId };
|
|
67
|
-
const payload = {
|
|
68
|
-
iss: args.teamId,
|
|
69
|
-
iat: now,
|
|
70
|
-
exp: now + expiresIn,
|
|
71
|
-
aud: APPLE_TOKEN_AUDIENCE_ISSUER,
|
|
72
|
-
sub: args.audience,
|
|
73
|
-
};
|
|
74
|
-
const headerB64 = base64UrlEncode(textEncoder.encode(JSON.stringify(header)));
|
|
75
|
-
const payloadB64 = base64UrlEncode(textEncoder.encode(JSON.stringify(payload)));
|
|
76
|
-
const signingInput = `${headerB64}.${payloadB64}`;
|
|
77
|
-
const key = await importApplePrivateKey(args.privateKey);
|
|
78
|
-
const signature = await crypto.subtle.sign({ name: "ECDSA", hash: "SHA-256" }, key, textEncoder.encode(signingInput));
|
|
79
|
-
return `${signingInput}.${base64UrlEncode(new Uint8Array(signature))}`;
|
|
80
|
-
}
|
|
81
|
-
const textEncoder = new TextEncoder();
|
|
82
|
-
const PEM_MARKERS_RE = /-----(?:BEGIN|END) [^-]+-----/g;
|
|
83
|
-
async function importApplePrivateKey(input) {
|
|
84
|
-
const der = decodePrivateKeyToDer(input);
|
|
85
|
-
return crypto.subtle.importKey("pkcs8", der, { name: "ECDSA", namedCurve: "P-256" }, false, ["sign"]);
|
|
86
|
-
}
|
|
87
|
-
function decodePrivateKeyToDer(input) {
|
|
88
|
-
// Strip PEM markers + all whitespace; tolerate the bare-base64 path too.
|
|
89
|
-
const body = input.replace(PEM_MARKERS_RE, "").replace(/\s+/g, "");
|
|
90
|
-
if (body.length === 0) {
|
|
91
|
-
throw new Error("appleClientSecret: privateKey is empty after stripping the PEM wrapper.");
|
|
92
|
-
}
|
|
93
|
-
try {
|
|
94
|
-
return base64ToBytes(body);
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
throw new Error("appleClientSecret: privateKey is not valid base64 — paste the contents of your .p8 file (PEM or base64).");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function base64UrlEncode(bytes) {
|
|
101
|
-
let bin = "";
|
|
102
|
-
for (let i = 0; i < bytes.length; i++)
|
|
103
|
-
bin += String.fromCharCode(bytes[i]);
|
|
104
|
-
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
105
|
-
}
|
|
106
|
-
function base64ToBytes(b64) {
|
|
107
|
-
const bin = atob(b64);
|
|
108
|
-
const out = new Uint8Array(bin.length);
|
|
109
|
-
for (let i = 0; i < bin.length; i++)
|
|
110
|
-
out[i] = bin.charCodeAt(i);
|
|
111
|
-
return out;
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=appleClientSecret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appleClientSecret.js","sourceRoot":"","sources":["../../src/auth/appleClientSecret.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAuBH,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU;AAChE,MAAM,4BAA4B,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW;AACpE,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAA2B;IAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,IAAI,0BAA0B,CAAC;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,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EmailSendArgs } from "@aotter/mantle-runtime";
|
|
2
|
-
type EmailContent = Pick<EmailSendArgs, "subject" | "text">;
|
|
3
|
-
export declare function signInCodeEmail(code: string): EmailContent;
|
|
4
|
-
export declare function signInLinkEmail(url: string): EmailContent;
|
|
5
|
-
export declare function staffInvitationEmail(role: string, signInUrl: string): EmailContent;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=emailTemplates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emailTemplates.d.ts","sourceRoot":"","sources":["../../src/auth/emailTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,KAAK,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAS5D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAK1D;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAMzD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAMlF"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function englishEmail(subject, lines) {
|
|
2
|
-
return {
|
|
3
|
-
subject,
|
|
4
|
-
text: `${lines.join("\n\n")}\n\nIf you did not expect this email, you can ignore it.`,
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
export function signInCodeEmail(code) {
|
|
8
|
-
return englishEmail(`Your Mantle sign-in code: ${code}`, [
|
|
9
|
-
`Your one-time code is ${code}.`,
|
|
10
|
-
"It expires shortly.",
|
|
11
|
-
]);
|
|
12
|
-
}
|
|
13
|
-
export function signInLinkEmail(url) {
|
|
14
|
-
return englishEmail("Your Mantle sign-in link", [
|
|
15
|
-
"Use this link to sign in:",
|
|
16
|
-
url,
|
|
17
|
-
"The link expires shortly.",
|
|
18
|
-
]);
|
|
19
|
-
}
|
|
20
|
-
export function staffInvitationEmail(role, signInUrl) {
|
|
21
|
-
return englishEmail("You have been invited to Mantle", [
|
|
22
|
-
`You now have ${role} access to Mantle.`,
|
|
23
|
-
"Sign in with this email address to accept the invitation:",
|
|
24
|
-
signInUrl,
|
|
25
|
-
]);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=emailTemplates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emailTemplates.js","sourceRoot":"","sources":["../../src/auth/emailTemplates.ts"],"names":[],"mappings":"AAIA,SAAS,YAAY,CAAC,OAAe,EAAE,KAAwB;IAC7D,OAAO;QACL,OAAO;QACP,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,0DAA0D;KACtF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,YAAY,CAAC,6BAA6B,IAAI,EAAE,EAAE;QACvD,yBAAyB,IAAI,GAAG;QAChC,qBAAqB;KACtB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,YAAY,CAAC,0BAA0B,EAAE;QAC9C,2BAA2B;QAC3B,GAAG;QACH,2BAA2B;KAC5B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,SAAiB;IAClE,OAAO,YAAY,CAAC,iCAAiC,EAAE;QACrD,gBAAgB,IAAI,oBAAoB;QACxC,2DAA2D;QAC3D,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
|