@robelest/convex-auth 0.0.2-preview.2 → 0.0.3-preview
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/dist/bin.cjs +467 -64
- package/dist/client/index.d.ts +127 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +424 -1
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +56 -1
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +141 -3
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +2 -0
- package/dist/component/convex.config.js.map +1 -1
- package/dist/component/index.d.ts +5 -4
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/index.js +4 -3
- package/dist/component/index.js.map +1 -1
- package/dist/component/portalBridge.d.ts +80 -0
- package/dist/component/portalBridge.d.ts.map +1 -0
- package/dist/component/portalBridge.js +102 -0
- package/dist/component/portalBridge.js.map +1 -0
- package/dist/component/public.d.ts +353 -9
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +328 -33
- package/dist/component/public.js.map +1 -1
- package/dist/component/schema.d.ts +168 -9
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +113 -7
- package/dist/component/schema.js.map +1 -1
- package/dist/providers/passkey.d.ts +20 -0
- package/dist/providers/passkey.d.ts.map +1 -0
- package/dist/providers/passkey.js +32 -0
- package/dist/providers/passkey.js.map +1 -0
- package/dist/providers/totp.d.ts +14 -0
- package/dist/providers/totp.d.ts.map +1 -0
- package/dist/providers/totp.js +23 -0
- package/dist/providers/totp.js.map +1 -0
- package/dist/server/convex-auth.d.ts +296 -0
- package/dist/server/convex-auth.d.ts.map +1 -0
- package/dist/server/convex-auth.js +480 -0
- package/dist/server/convex-auth.js.map +1 -0
- package/dist/server/email-templates.d.ts +18 -0
- package/dist/server/email-templates.d.ts.map +1 -0
- package/dist/server/email-templates.js +74 -0
- package/dist/server/email-templates.js.map +1 -0
- package/dist/server/implementation/apiKey.d.ts +74 -0
- package/dist/server/implementation/apiKey.d.ts.map +1 -0
- package/dist/server/implementation/apiKey.js +140 -0
- package/dist/server/implementation/apiKey.js.map +1 -0
- package/dist/server/implementation/index.d.ts +169 -7
- package/dist/server/implementation/index.d.ts.map +1 -1
- package/dist/server/implementation/index.js +220 -5
- package/dist/server/implementation/index.js.map +1 -1
- package/dist/server/implementation/passkey.d.ts +33 -0
- package/dist/server/implementation/passkey.d.ts.map +1 -0
- package/dist/server/implementation/passkey.js +450 -0
- package/dist/server/implementation/passkey.js.map +1 -0
- package/dist/server/implementation/redirects.d.ts.map +1 -1
- package/dist/server/implementation/redirects.js +4 -9
- package/dist/server/implementation/redirects.js.map +1 -1
- package/dist/server/implementation/signIn.d.ts +13 -0
- package/dist/server/implementation/signIn.d.ts.map +1 -1
- package/dist/server/implementation/signIn.js +29 -15
- package/dist/server/implementation/signIn.js.map +1 -1
- package/dist/server/implementation/totp.d.ts +40 -0
- package/dist/server/implementation/totp.d.ts.map +1 -0
- package/dist/server/implementation/totp.js +211 -0
- package/dist/server/implementation/totp.js.map +1 -0
- package/dist/server/index.d.ts +26 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +63 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server/portal-email.d.ts +19 -0
- package/dist/server/portal-email.d.ts.map +1 -0
- package/dist/server/portal-email.js +89 -0
- package/dist/server/portal-email.js.map +1 -0
- package/dist/server/provider_utils.d.ts +3 -1
- package/dist/server/provider_utils.d.ts.map +1 -1
- package/dist/server/provider_utils.js +39 -1
- package/dist/server/provider_utils.js.map +1 -1
- package/dist/server/types.d.ts +263 -4
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/version.d.ts +2 -0
- package/dist/server/version.d.ts.map +1 -0
- package/dist/server/version.js +3 -0
- package/dist/server/version.js.map +1 -0
- package/package.json +7 -3
- package/src/cli/index.ts +49 -7
- package/src/cli/portal-link.ts +112 -0
- package/src/cli/portal-upload.ts +411 -0
- package/src/cli/utils.ts +248 -0
- package/src/client/index.ts +489 -1
- package/src/component/_generated/api.ts +72 -1
- package/src/component/_generated/component.ts +241 -4
- package/src/component/convex.config.ts +3 -0
- package/src/component/index.ts +8 -3
- package/src/component/portalBridge.ts +116 -0
- package/src/component/public.ts +373 -37
- package/src/component/schema.ts +122 -7
- package/src/providers/passkey.ts +35 -0
- package/src/providers/totp.ts +26 -0
- package/src/server/convex-auth.ts +602 -0
- package/src/server/email-templates.ts +77 -0
- package/src/server/implementation/apiKey.ts +185 -0
- package/src/server/implementation/index.ts +301 -8
- package/src/server/implementation/passkey.ts +650 -0
- package/src/server/implementation/redirects.ts +4 -11
- package/src/server/implementation/signIn.ts +41 -13
- package/src/server/implementation/totp.ts +366 -0
- package/src/server/index.ts +98 -34
- package/src/server/portal-email.ts +95 -0
- package/src/server/provider_utils.ts +42 -1
- package/src/server/types.ts +285 -4
- package/src/server/version.ts +2 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Auth` class — the main entry point for Convex Auth.
|
|
3
|
+
*
|
|
4
|
+
* Combines authentication and portal admin functionality:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* // convex/auth.ts
|
|
8
|
+
* import { Auth, Portal } from "@robelest/convex-auth/component";
|
|
9
|
+
* import google from "@auth/core/providers/google";
|
|
10
|
+
* import { components } from "./_generated/api";
|
|
11
|
+
*
|
|
12
|
+
* export const auth = new Auth(components.auth, {
|
|
13
|
+
* providers: [google],
|
|
14
|
+
* email: {
|
|
15
|
+
* from: "My App <noreply@example.com>",
|
|
16
|
+
* send: async (_ctx, { from, to, subject, html }) => {
|
|
17
|
+
* await fetch("https://api.resend.com/emails", {
|
|
18
|
+
* method: "POST",
|
|
19
|
+
* headers: {
|
|
20
|
+
* Authorization: `Bearer ${process.env.AUTH_RESEND_KEY}`,
|
|
21
|
+
* "Content-Type": "application/json",
|
|
22
|
+
* },
|
|
23
|
+
* body: JSON.stringify({ from, to, subject, html }),
|
|
24
|
+
* });
|
|
25
|
+
* },
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* export const { signIn, signOut, store } = auth;
|
|
29
|
+
* export const { portalQuery, portalMutation, portalInternal } = Portal(auth);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @module
|
|
33
|
+
*/
|
|
34
|
+
import type { HttpRouter } from "convex/server";
|
|
35
|
+
import type { ComponentApi as AuthComponentApi } from "../component/_generated/component.js";
|
|
36
|
+
import { Auth as AuthFactory } from "./implementation/index.js";
|
|
37
|
+
import type { ConvexAuthConfig } from "./types.js";
|
|
38
|
+
/**
|
|
39
|
+
* Config for the Auth class. Extends the standard auth config
|
|
40
|
+
* minus `component` (which is passed as the first constructor argument).
|
|
41
|
+
*
|
|
42
|
+
* When `email` is configured, the library auto-registers:
|
|
43
|
+
* - A magic link provider (`id: "email"`) for user-facing sign-in
|
|
44
|
+
* - A portal provider (`id: "portal"`) for admin dashboard sign-in
|
|
45
|
+
*
|
|
46
|
+
* Portal functionality is always available — no configuration flag
|
|
47
|
+
* needed. The portal UI works when you export `portalQuery`,
|
|
48
|
+
* `portalMutation`, `portalInternal` from your `convex/auth.ts`
|
|
49
|
+
* and upload the portal static files via CLI.
|
|
50
|
+
*/
|
|
51
|
+
export type AuthClassConfig = Omit<ConvexAuthConfig, "component">;
|
|
52
|
+
/**
|
|
53
|
+
* Main entry point for Convex Auth. Instantiate with your component
|
|
54
|
+
* reference and config to get all the exports you need.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* export const auth = new Auth(components.auth, {
|
|
58
|
+
* providers: [google, password],
|
|
59
|
+
* email: {
|
|
60
|
+
* from: "My App <noreply@example.com>",
|
|
61
|
+
* send: (ctx, params) => resend.sendEmail(ctx, params),
|
|
62
|
+
* },
|
|
63
|
+
* });
|
|
64
|
+
* export const { signIn, signOut, store } = auth;
|
|
65
|
+
* export const { portalQuery, portalMutation, portalInternal } = Portal(auth);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class Auth {
|
|
69
|
+
/** The inner `auth` helper object from AuthFactory() */
|
|
70
|
+
private readonly _auth;
|
|
71
|
+
/** The signIn action — export this from your convex/auth.ts */
|
|
72
|
+
readonly signIn: ReturnType<typeof AuthFactory>["signIn"];
|
|
73
|
+
/** The signOut action — export this from your convex/auth.ts */
|
|
74
|
+
readonly signOut: ReturnType<typeof AuthFactory>["signOut"];
|
|
75
|
+
/** The store internal mutation — export this from your convex/auth.ts */
|
|
76
|
+
readonly store: ReturnType<typeof AuthFactory>["store"];
|
|
77
|
+
/** @internal */
|
|
78
|
+
readonly component: AuthComponentApi;
|
|
79
|
+
/** @internal */
|
|
80
|
+
readonly portalUrl: string;
|
|
81
|
+
/** User helpers: `.current(ctx)`, `.require(ctx)`, `.get(ctx, userId)`, `.viewer(ctx)` */
|
|
82
|
+
get user(): {
|
|
83
|
+
current: (ctx: {
|
|
84
|
+
auth: import("convex/server").Auth;
|
|
85
|
+
}) => Promise<import("convex/values").GenericId<"user"> | null>;
|
|
86
|
+
require: (ctx: {
|
|
87
|
+
auth: import("convex/server").Auth;
|
|
88
|
+
}) => Promise<import("convex/values").GenericId<"user">>;
|
|
89
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, userId: string) => Promise<any>;
|
|
90
|
+
viewer: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery"> & {
|
|
91
|
+
auth: import("convex/server").Auth;
|
|
92
|
+
}) => Promise<any>;
|
|
93
|
+
group: {
|
|
94
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
95
|
+
userId: string;
|
|
96
|
+
}) => Promise<any>;
|
|
97
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
98
|
+
userId: string;
|
|
99
|
+
groupId: string;
|
|
100
|
+
}) => Promise<any>;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
/** Session helpers */
|
|
104
|
+
get session(): {
|
|
105
|
+
current: (ctx: {
|
|
106
|
+
auth: import("convex/server").Auth;
|
|
107
|
+
}) => Promise<import("convex/values").GenericId<"session"> | null>;
|
|
108
|
+
invalidate: <DataModel extends import("convex/server").GenericDataModel>(ctx: import("convex/server").GenericActionCtx<DataModel>, args: {
|
|
109
|
+
userId: import("convex/values").GenericId<"user">;
|
|
110
|
+
except?: import("convex/values").GenericId<"session">[];
|
|
111
|
+
}) => Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
/** Provider helpers */
|
|
114
|
+
get provider(): {
|
|
115
|
+
signIn: <DataModel extends import("convex/server").GenericDataModel>(ctx: import("convex/server").GenericActionCtx<DataModel>, provider: import("./types.js").AuthProviderConfig, args: {
|
|
116
|
+
accountId?: import("convex/values").GenericId<"account">;
|
|
117
|
+
params?: Record<string, unknown>;
|
|
118
|
+
}) => Promise<{
|
|
119
|
+
userId: import("convex/values").GenericId<"user">;
|
|
120
|
+
sessionId: import("convex/values").GenericId<"session">;
|
|
121
|
+
} | null>;
|
|
122
|
+
};
|
|
123
|
+
/** Account helpers */
|
|
124
|
+
get account(): {
|
|
125
|
+
create: <DataModel extends import("convex/server").GenericDataModel>(ctx: import("convex/server").GenericActionCtx<DataModel>, args: {
|
|
126
|
+
provider: string;
|
|
127
|
+
account: {
|
|
128
|
+
id: string;
|
|
129
|
+
secret?: string;
|
|
130
|
+
};
|
|
131
|
+
profile: Record<string, unknown>;
|
|
132
|
+
shouldLinkViaEmail?: boolean;
|
|
133
|
+
shouldLinkViaPhone?: boolean;
|
|
134
|
+
}) => Promise<{
|
|
135
|
+
account: import("./implementation/types.js").Doc<"account">;
|
|
136
|
+
user: import("./implementation/types.js").Doc<"user">;
|
|
137
|
+
}>;
|
|
138
|
+
get: <DataModel extends import("convex/server").GenericDataModel>(ctx: import("convex/server").GenericActionCtx<DataModel>, args: {
|
|
139
|
+
provider: string;
|
|
140
|
+
account: {
|
|
141
|
+
id: string;
|
|
142
|
+
secret?: string;
|
|
143
|
+
};
|
|
144
|
+
}) => Promise<{
|
|
145
|
+
account: import("./implementation/types.js").Doc<"account">;
|
|
146
|
+
user: import("./implementation/types.js").Doc<"user">;
|
|
147
|
+
}>;
|
|
148
|
+
updateCredentials: <DataModel extends import("convex/server").GenericDataModel>(ctx: import("convex/server").GenericActionCtx<DataModel>, args: {
|
|
149
|
+
provider: string;
|
|
150
|
+
account: {
|
|
151
|
+
id: string;
|
|
152
|
+
secret: string;
|
|
153
|
+
};
|
|
154
|
+
}) => Promise<void>;
|
|
155
|
+
};
|
|
156
|
+
/** Group helpers */
|
|
157
|
+
get group(): {
|
|
158
|
+
create: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, data: {
|
|
159
|
+
name: string;
|
|
160
|
+
slug?: string;
|
|
161
|
+
parentGroupId?: string;
|
|
162
|
+
extend?: Record<string, unknown>;
|
|
163
|
+
}) => Promise<string>;
|
|
164
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, groupId: string) => Promise<any>;
|
|
165
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts?: {
|
|
166
|
+
parentGroupId?: string;
|
|
167
|
+
}) => Promise<any>;
|
|
168
|
+
update: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, groupId: string, data: Record<string, unknown>) => Promise<void>;
|
|
169
|
+
delete: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, groupId: string) => Promise<void>;
|
|
170
|
+
member: {
|
|
171
|
+
add: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, data: {
|
|
172
|
+
groupId: string;
|
|
173
|
+
userId: string;
|
|
174
|
+
role?: string;
|
|
175
|
+
status?: string;
|
|
176
|
+
extend?: Record<string, unknown>;
|
|
177
|
+
}) => Promise<string>;
|
|
178
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, memberId: string) => Promise<any>;
|
|
179
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
180
|
+
groupId: string;
|
|
181
|
+
}) => Promise<any>;
|
|
182
|
+
remove: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, memberId: string) => Promise<void>;
|
|
183
|
+
update: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, memberId: string, data: Record<string, unknown>) => Promise<void>;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
/** Invite helpers */
|
|
187
|
+
get invite(): {
|
|
188
|
+
create: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, data: {
|
|
189
|
+
groupId?: string;
|
|
190
|
+
invitedByUserId?: string;
|
|
191
|
+
email?: string;
|
|
192
|
+
tokenHash: string;
|
|
193
|
+
role?: string;
|
|
194
|
+
status: "pending" | "accepted" | "revoked" | "expired";
|
|
195
|
+
expiresTime?: number;
|
|
196
|
+
extend?: Record<string, unknown>;
|
|
197
|
+
}) => Promise<string>;
|
|
198
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, inviteId: string) => Promise<any>;
|
|
199
|
+
getByTokenHash: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, tokenHash: string) => Promise<any>;
|
|
200
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts?: {
|
|
201
|
+
groupId?: string;
|
|
202
|
+
status?: "pending" | "accepted" | "revoked" | "expired";
|
|
203
|
+
}) => Promise<any>;
|
|
204
|
+
accept: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, inviteId: string, acceptedByUserId?: string) => Promise<void>;
|
|
205
|
+
revoke: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, inviteId: string) => Promise<void>;
|
|
206
|
+
};
|
|
207
|
+
/** Passkey helpers */
|
|
208
|
+
get passkey(): {
|
|
209
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
210
|
+
userId: string;
|
|
211
|
+
}) => Promise<any>;
|
|
212
|
+
rename: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, passkeyId: string, name: string) => Promise<void>;
|
|
213
|
+
remove: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, passkeyId: string) => Promise<void>;
|
|
214
|
+
};
|
|
215
|
+
/** TOTP helpers */
|
|
216
|
+
get totp(): {
|
|
217
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
218
|
+
userId: string;
|
|
219
|
+
}) => Promise<any>;
|
|
220
|
+
remove: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, totpId: string) => Promise<void>;
|
|
221
|
+
};
|
|
222
|
+
/** API key helpers: `.create(ctx, ...)`, `.verify(ctx, ...)`, `.list(ctx, ...)`, `.revoke(ctx, ...)` */
|
|
223
|
+
get key(): {
|
|
224
|
+
create: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, opts: {
|
|
225
|
+
userId: string;
|
|
226
|
+
name: string;
|
|
227
|
+
scopes: import("./types.js").KeyScope[];
|
|
228
|
+
rateLimit?: {
|
|
229
|
+
maxRequests: number;
|
|
230
|
+
windowMs: number;
|
|
231
|
+
};
|
|
232
|
+
expiresAt?: number;
|
|
233
|
+
}) => Promise<{
|
|
234
|
+
keyId: string;
|
|
235
|
+
raw: string;
|
|
236
|
+
}>;
|
|
237
|
+
verify: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, rawKey: string) => Promise<{
|
|
238
|
+
userId: string;
|
|
239
|
+
keyId: string;
|
|
240
|
+
scopes: import("./types.js").ScopeChecker;
|
|
241
|
+
}>;
|
|
242
|
+
list: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, opts: {
|
|
243
|
+
userId: string;
|
|
244
|
+
}) => Promise<any>;
|
|
245
|
+
get: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery">, keyId: string) => Promise<any>;
|
|
246
|
+
update: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, keyId: string, data: {
|
|
247
|
+
name?: string;
|
|
248
|
+
scopes?: import("./types.js").KeyScope[];
|
|
249
|
+
rateLimit?: {
|
|
250
|
+
maxRequests: number;
|
|
251
|
+
windowMs: number;
|
|
252
|
+
};
|
|
253
|
+
}) => Promise<void>;
|
|
254
|
+
revoke: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, keyId: string) => Promise<void>;
|
|
255
|
+
remove: (ctx: Pick<import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, "runQuery" | "runMutation">, keyId: string) => Promise<void>;
|
|
256
|
+
};
|
|
257
|
+
constructor(component: AuthComponentApi, config: AuthClassConfig);
|
|
258
|
+
/**
|
|
259
|
+
* Register HTTP routes for OAuth, JWT well-known endpoints, and portal
|
|
260
|
+
* static file serving.
|
|
261
|
+
*
|
|
262
|
+
* ```ts
|
|
263
|
+
* // convex/http.ts
|
|
264
|
+
* import { httpRouter } from "convex/server";
|
|
265
|
+
* import { auth } from "./auth";
|
|
266
|
+
*
|
|
267
|
+
* const http = httpRouter();
|
|
268
|
+
* auth.addHttpRoutes(http);
|
|
269
|
+
* export default http;
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
addHttpRoutes(http: HttpRouter, opts?: {
|
|
273
|
+
pathPrefix?: string;
|
|
274
|
+
spaFallback?: boolean;
|
|
275
|
+
}): void;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Create portal function definitions from a ConvexAuth instance.
|
|
279
|
+
*
|
|
280
|
+
* This is a standalone function (not a class method) because Convex's
|
|
281
|
+
* bundler can trace through `export const { x } = fn(instance)` but
|
|
282
|
+
* cannot trace through `instance.method()`.
|
|
283
|
+
*
|
|
284
|
+
* ```ts
|
|
285
|
+
* export const { portalQuery, portalMutation, portalInternal } = Portal(auth);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export declare function Portal(auth: Auth): {
|
|
289
|
+
portalQuery: import("convex/server").RegisteredQuery<"public", {
|
|
290
|
+
action: string;
|
|
291
|
+
userId?: string;
|
|
292
|
+
}, Promise<any>>;
|
|
293
|
+
portalMutation: import("convex/server").RegisteredMutation<"public", any, Promise<any>>;
|
|
294
|
+
portalInternal: import("convex/server").RegisteredMutation<"internal", any, Promise<any>>;
|
|
295
|
+
};
|
|
296
|
+
//# sourceMappingURL=convex-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex-auth.d.ts","sourceRoot":"","sources":["../../src/server/convex-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAQH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,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