@robelest/convex-auth 0.0.2-preview.1 → 0.0.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/dist/bin.cjs +466 -63
- package/dist/client/index.d.ts +211 -30
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +673 -59
- 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 +93 -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 -3
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/index.js +5 -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 +193 -9
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +204 -33
- package/dist/component/public.js.map +1 -1
- package/dist/component/schema.d.ts +89 -9
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +68 -7
- package/dist/component/schema.js.map +1 -1
- package/dist/providers/{Anonymous.d.ts → anonymous.d.ts} +8 -8
- package/dist/providers/{Anonymous.d.ts.map → anonymous.d.ts.map} +1 -1
- package/dist/providers/{Anonymous.js → anonymous.js} +9 -10
- package/dist/providers/anonymous.js.map +1 -0
- package/dist/providers/{ConvexCredentials.d.ts → credentials.d.ts} +11 -11
- package/dist/providers/credentials.d.ts.map +1 -0
- package/dist/providers/{ConvexCredentials.js → credentials.js} +8 -8
- package/dist/providers/credentials.js.map +1 -0
- package/dist/providers/{Email.d.ts → email.d.ts} +6 -6
- package/dist/providers/email.d.ts.map +1 -0
- package/dist/providers/{Email.js → email.js} +6 -6
- package/dist/providers/email.js.map +1 -0
- 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/{Password.d.ts → password.d.ts} +10 -10
- package/dist/providers/{Password.d.ts.map → password.d.ts.map} +1 -1
- package/dist/providers/{Password.js → password.js} +19 -20
- package/dist/providers/password.js.map +1 -0
- package/dist/providers/{Phone.d.ts → phone.d.ts} +3 -3
- package/dist/providers/{Phone.d.ts.map → phone.d.ts.map} +1 -1
- package/dist/providers/{Phone.js → phone.js} +3 -3
- package/dist/providers/{Phone.js.map → phone.js.map} +1 -1
- 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 +243 -0
- package/dist/server/convex-auth.d.ts.map +1 -0
- package/dist/server/convex-auth.js +365 -0
- package/dist/server/convex-auth.js.map +1 -0
- package/dist/server/implementation/index.d.ts +153 -166
- package/dist/server/implementation/index.d.ts.map +1 -1
- package/dist/server/implementation/index.js +162 -105
- 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/sessions.d.ts +2 -20
- package/dist/server/implementation/sessions.d.ts.map +1 -1
- package/dist/server/implementation/sessions.js +2 -20
- package/dist/server/implementation/sessions.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 +26 -1
- 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 +18 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +255 -0
- 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/portal.d.ts +116 -0
- package/dist/server/portal.d.ts.map +1 -0
- package/dist/server/portal.js +294 -0
- package/dist/server/portal.js.map +1 -0
- package/dist/server/provider_utils.d.ts +1 -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 +128 -11
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/cli/index.ts +48 -6
- package/src/cli/portal-link.ts +112 -0
- package/src/cli/portal-upload.ts +411 -0
- package/src/client/index.ts +823 -109
- package/src/component/_generated/api.ts +72 -1
- package/src/component/_generated/component.ts +180 -4
- package/src/component/convex.config.ts +3 -0
- package/src/component/index.ts +5 -10
- package/src/component/portalBridge.ts +116 -0
- package/src/component/public.ts +231 -37
- package/src/component/schema.ts +70 -7
- package/src/providers/{Anonymous.ts → anonymous.ts} +10 -11
- package/src/providers/{ConvexCredentials.ts → credentials.ts} +11 -11
- package/src/providers/{Email.ts → email.ts} +5 -5
- package/src/providers/passkey.ts +35 -0
- package/src/providers/{Password.ts → password.ts} +22 -27
- package/src/providers/{Phone.ts → phone.ts} +2 -2
- package/src/providers/totp.ts +26 -0
- package/src/server/convex-auth.ts +470 -0
- package/src/server/implementation/index.ts +228 -239
- package/src/server/implementation/passkey.ts +650 -0
- package/src/server/implementation/redirects.ts +4 -11
- package/src/server/implementation/sessions.ts +2 -20
- package/src/server/implementation/signIn.ts +39 -1
- package/src/server/implementation/totp.ts +366 -0
- package/src/server/index.ts +373 -0
- package/src/server/portal-email.ts +95 -0
- package/src/server/portal.ts +375 -0
- package/src/server/provider_utils.ts +42 -1
- package/src/server/types.ts +161 -10
- package/dist/providers/Anonymous.js.map +0 -1
- package/dist/providers/ConvexCredentials.d.ts.map +0 -1
- package/dist/providers/ConvexCredentials.js.map +0 -1
- package/dist/providers/Email.d.ts.map +0 -1
- package/dist/providers/Email.js.map +0 -1
- package/dist/providers/Password.js.map +0 -1
- package/providers/Anonymous/package.json +0 -6
- package/providers/ConvexCredentials/package.json +0 -6
- package/providers/Email/package.json +0 -6
- package/providers/Password/package.json +0 -6
- package/providers/Phone/package.json +0 -6
- package/server/package.json +0 -6
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Auth,
|
|
2
|
-
import { GenericId
|
|
3
|
-
import { FunctionReferenceFromExport
|
|
4
|
-
import { AuthProviderConfig, ConvexAuthConfig
|
|
1
|
+
import { Auth, GenericActionCtx, GenericDataModel, HttpRouter } from "convex/server";
|
|
2
|
+
import { GenericId } from "convex/values";
|
|
3
|
+
import { FunctionReferenceFromExport } from "../convex_types.js";
|
|
4
|
+
import { AuthProviderConfig, ConvexAuthConfig } from "../types.js";
|
|
5
5
|
import { Tokens } from "./types.js";
|
|
6
6
|
export { Doc, Tokens } from "./types.js";
|
|
7
|
-
export { getAuthSessionId } from "./sessions.js";
|
|
8
7
|
/**
|
|
9
8
|
* The type of the signIn Convex Action returned from the auth() helper.
|
|
10
9
|
*
|
|
@@ -90,6 +89,75 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
90
89
|
}) => Promise<any>;
|
|
91
90
|
};
|
|
92
91
|
};
|
|
92
|
+
session: {
|
|
93
|
+
/**
|
|
94
|
+
* Get the current session ID from the auth context, or `null` if
|
|
95
|
+
* not signed in.
|
|
96
|
+
*/
|
|
97
|
+
current: (ctx: {
|
|
98
|
+
auth: Auth;
|
|
99
|
+
}) => Promise<GenericId<"session"> | null>;
|
|
100
|
+
/**
|
|
101
|
+
* Invalidate sessions for a user, optionally preserving specific sessions.
|
|
102
|
+
*/
|
|
103
|
+
invalidate: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
104
|
+
userId: GenericId<"user">;
|
|
105
|
+
except?: GenericId<"session">[];
|
|
106
|
+
}) => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
account: {
|
|
109
|
+
/**
|
|
110
|
+
* Create an account and user for a credentials provider.
|
|
111
|
+
*/
|
|
112
|
+
create: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
113
|
+
provider: string;
|
|
114
|
+
account: {
|
|
115
|
+
id: string;
|
|
116
|
+
secret?: string;
|
|
117
|
+
};
|
|
118
|
+
profile: Record<string, unknown>;
|
|
119
|
+
shouldLinkViaEmail?: boolean;
|
|
120
|
+
shouldLinkViaPhone?: boolean;
|
|
121
|
+
}) => Promise<{
|
|
122
|
+
account: import("./types.js").Doc<"account">;
|
|
123
|
+
user: import("./types.js").Doc<"user">;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Retrieve an account and user for a credentials provider.
|
|
127
|
+
*/
|
|
128
|
+
get: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
129
|
+
provider: string;
|
|
130
|
+
account: {
|
|
131
|
+
id: string;
|
|
132
|
+
secret?: string;
|
|
133
|
+
};
|
|
134
|
+
}) => Promise<{
|
|
135
|
+
account: import("./types.js").Doc<"account">;
|
|
136
|
+
user: import("./types.js").Doc<"user">;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Update credentials for an existing account.
|
|
140
|
+
*/
|
|
141
|
+
updateCredentials: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
142
|
+
provider: string;
|
|
143
|
+
account: {
|
|
144
|
+
id: string;
|
|
145
|
+
secret: string;
|
|
146
|
+
};
|
|
147
|
+
}) => Promise<void>;
|
|
148
|
+
};
|
|
149
|
+
provider: {
|
|
150
|
+
/**
|
|
151
|
+
* Sign in via another provider, typically from a credentials flow.
|
|
152
|
+
*/
|
|
153
|
+
signIn: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, provider: AuthProviderConfig, args: {
|
|
154
|
+
accountId?: GenericId<"account">;
|
|
155
|
+
params?: Record<string, unknown>;
|
|
156
|
+
}) => Promise<{
|
|
157
|
+
userId: GenericId<"user">;
|
|
158
|
+
sessionId: GenericId<"session">;
|
|
159
|
+
} | null>;
|
|
160
|
+
};
|
|
93
161
|
/**
|
|
94
162
|
* Hierarchical group management. Groups can nest arbitrarily deep
|
|
95
163
|
* via `parentGroupId`. A root group has no parent.
|
|
@@ -198,12 +266,15 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
198
266
|
* Create a new invitation.
|
|
199
267
|
*
|
|
200
268
|
* @param data.groupId - Optional group to invite the user into.
|
|
201
|
-
* @param data.invitedByUserId -
|
|
202
|
-
*
|
|
269
|
+
* @param data.invitedByUserId - Optional user sending the invitation
|
|
270
|
+
* (omit for CLI-generated invites).
|
|
271
|
+
* @param data.email - Optional email of the invitee (omit for
|
|
272
|
+
* CLI-generated invite links where the email is unknown upfront).
|
|
203
273
|
* @param data.tokenHash - Hashed token for secure acceptance.
|
|
204
274
|
* @param data.role - Optional role to assign on acceptance.
|
|
205
275
|
* @param data.status - Initial status (typically "pending").
|
|
206
|
-
* @param data.expiresTime -
|
|
276
|
+
* @param data.expiresTime - Optional expiration timestamp (omit for
|
|
277
|
+
* single-use, non-expiring invites).
|
|
207
278
|
* @param data.extend - Optional arbitrary JSON extension data.
|
|
208
279
|
* @throws ConvexError with code `DUPLICATE_INVITE` if a pending invite
|
|
209
280
|
* already exists for this email and scope.
|
|
@@ -211,18 +282,22 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
211
282
|
*/
|
|
212
283
|
create: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, data: {
|
|
213
284
|
groupId?: string;
|
|
214
|
-
invitedByUserId
|
|
215
|
-
email
|
|
285
|
+
invitedByUserId?: string;
|
|
286
|
+
email?: string;
|
|
216
287
|
tokenHash: string;
|
|
217
288
|
role?: string;
|
|
218
289
|
status: "pending" | "accepted" | "revoked" | "expired";
|
|
219
|
-
expiresTime
|
|
290
|
+
expiresTime?: number;
|
|
220
291
|
extend?: Record<string, unknown>;
|
|
221
292
|
}) => Promise<string>;
|
|
222
293
|
/**
|
|
223
294
|
* Retrieve an invite by its ID. Returns `null` if not found.
|
|
224
295
|
*/
|
|
225
296
|
get: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery">, inviteId: string) => Promise<any>;
|
|
297
|
+
/**
|
|
298
|
+
* Retrieve an invite by its token hash. Returns `null` if not found.
|
|
299
|
+
*/
|
|
300
|
+
getByTokenHash: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery">, tokenHash: string) => Promise<any>;
|
|
226
301
|
/**
|
|
227
302
|
* List invites, optionally filtered by group and/or status.
|
|
228
303
|
*/
|
|
@@ -261,7 +336,7 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
261
336
|
* });
|
|
262
337
|
* ```
|
|
263
338
|
*/
|
|
264
|
-
accept: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, inviteId: string) => Promise<void>;
|
|
339
|
+
accept: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, inviteId: string, acceptedByUserId?: string) => Promise<void>;
|
|
265
340
|
/**
|
|
266
341
|
* Revoke a pending invitation.
|
|
267
342
|
*
|
|
@@ -272,6 +347,65 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
272
347
|
*/
|
|
273
348
|
revoke: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, inviteId: string) => Promise<void>;
|
|
274
349
|
};
|
|
350
|
+
/**
|
|
351
|
+
* Manage passkey credentials for users.
|
|
352
|
+
*
|
|
353
|
+
* ```ts
|
|
354
|
+
* const passkeys = await auth.passkey.list(ctx, { userId });
|
|
355
|
+
* await auth.passkey.rename(ctx, passkeyId, "MacBook Touch ID");
|
|
356
|
+
* await auth.passkey.remove(ctx, passkeyId);
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
passkey: {
|
|
360
|
+
/**
|
|
361
|
+
* List all passkeys for a user.
|
|
362
|
+
*
|
|
363
|
+
* @param opts.userId - The user whose passkeys to list.
|
|
364
|
+
* @returns Array of passkey records with credentialId, name, deviceType,
|
|
365
|
+
* backedUp, createdAt, and lastUsedAt.
|
|
366
|
+
*/
|
|
367
|
+
list: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery">, opts: {
|
|
368
|
+
userId: string;
|
|
369
|
+
}) => Promise<any>;
|
|
370
|
+
/**
|
|
371
|
+
* Rename a passkey (set a user-friendly display name).
|
|
372
|
+
*
|
|
373
|
+
* @param passkeyId - The passkey document ID.
|
|
374
|
+
* @param name - New display name (e.g. "MacBook Touch ID").
|
|
375
|
+
*/
|
|
376
|
+
rename: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, passkeyId: string, name: string) => Promise<void>;
|
|
377
|
+
/**
|
|
378
|
+
* Delete a passkey credential.
|
|
379
|
+
*
|
|
380
|
+
* @param passkeyId - The passkey document ID to remove.
|
|
381
|
+
*/
|
|
382
|
+
remove: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, passkeyId: string) => Promise<void>;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Manage TOTP two-factor authentication enrollments for users.
|
|
386
|
+
*
|
|
387
|
+
* ```ts
|
|
388
|
+
* const enrollments = await auth.totp.list(ctx, { userId });
|
|
389
|
+
* await auth.totp.remove(ctx, totpId);
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
totp: {
|
|
393
|
+
/**
|
|
394
|
+
* List all TOTP enrollments for a user.
|
|
395
|
+
*
|
|
396
|
+
* @param opts.userId - The user whose enrollments to list.
|
|
397
|
+
* @returns Array of TOTP enrollment records.
|
|
398
|
+
*/
|
|
399
|
+
list: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery">, opts: {
|
|
400
|
+
userId: string;
|
|
401
|
+
}) => Promise<any>;
|
|
402
|
+
/**
|
|
403
|
+
* Delete a TOTP enrollment.
|
|
404
|
+
*
|
|
405
|
+
* @param totpId - The TOTP document ID to remove.
|
|
406
|
+
*/
|
|
407
|
+
remove: (ctx: Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation">, totpId: string) => Promise<void>;
|
|
408
|
+
};
|
|
275
409
|
/**
|
|
276
410
|
* Add HTTP actions for JWT verification and OAuth sign-in.
|
|
277
411
|
*
|
|
@@ -316,6 +450,13 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
316
450
|
verifier?: string;
|
|
317
451
|
tokens?: Tokens | null;
|
|
318
452
|
started?: boolean;
|
|
453
|
+
options?: Record<string, any>;
|
|
454
|
+
totpRequired?: boolean;
|
|
455
|
+
totpSetup?: {
|
|
456
|
+
uri: string;
|
|
457
|
+
secret: string;
|
|
458
|
+
totpId: string;
|
|
459
|
+
};
|
|
319
460
|
}>>;
|
|
320
461
|
/**
|
|
321
462
|
* Action called by the client to invalidate the current session.
|
|
@@ -404,158 +545,4 @@ export declare function Auth(config_: ConvexAuthConfig): {
|
|
|
404
545
|
user: import("./types.js").Doc<"user">;
|
|
405
546
|
} | null>>;
|
|
406
547
|
};
|
|
407
|
-
/**
|
|
408
|
-
* Return the currently signed-in user's ID.
|
|
409
|
-
*
|
|
410
|
-
* ```ts filename="convex/myFunctions.tsx"
|
|
411
|
-
* import { mutation } from "./_generated/server";
|
|
412
|
-
* import { getAuthUserId } from "@robelest/convex-auth/component";
|
|
413
|
-
*
|
|
414
|
-
* export const doSomething = mutation({
|
|
415
|
-
* args: {/* ... *\/},
|
|
416
|
-
* handler: async (ctx, args) => {
|
|
417
|
-
* const userId = await getAuthUserId(ctx);
|
|
418
|
-
* if (userId === null) {
|
|
419
|
-
* throw new Error("Client is not authenticated!")
|
|
420
|
-
* }
|
|
421
|
-
* const user = await ctx.db.get(userId);
|
|
422
|
-
* // ...
|
|
423
|
-
* },
|
|
424
|
-
* });
|
|
425
|
-
* ```
|
|
426
|
-
*
|
|
427
|
-
* @param ctx query, mutation or action `ctx`
|
|
428
|
-
* @returns the user ID or `null` if the client isn't authenticated
|
|
429
|
-
*/
|
|
430
|
-
export declare function getAuthUserId(ctx: {
|
|
431
|
-
auth: Auth;
|
|
432
|
-
}): Promise<GenericId<"user"> | null>;
|
|
433
|
-
/**
|
|
434
|
-
* Use this function from a
|
|
435
|
-
* [`ConvexCredentials`](https://labs.convex.dev/auth/api_reference/providers/ConvexCredentials)
|
|
436
|
-
* provider to create an account and a user with a unique account "id" (OAuth
|
|
437
|
-
* provider ID, email address, phone number, username etc.).
|
|
438
|
-
*
|
|
439
|
-
* @returns user ID if it successfully creates the account
|
|
440
|
-
* or throws an error.
|
|
441
|
-
*/
|
|
442
|
-
export declare function createAccount<DataModel extends GenericDataModel = GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
443
|
-
/**
|
|
444
|
-
* The provider ID (like "password"), used to disambiguate accounts.
|
|
445
|
-
*
|
|
446
|
-
* It is also used to configure account secret hashing via the provider's
|
|
447
|
-
* `crypto` option.
|
|
448
|
-
*/
|
|
449
|
-
provider: string;
|
|
450
|
-
account: {
|
|
451
|
-
/**
|
|
452
|
-
* The unique external ID for the account, for example email address.
|
|
453
|
-
*/
|
|
454
|
-
id: string;
|
|
455
|
-
/**
|
|
456
|
-
* The secret credential to store for this account, if given.
|
|
457
|
-
*/
|
|
458
|
-
secret?: string;
|
|
459
|
-
};
|
|
460
|
-
/**
|
|
461
|
-
* The profile data to store for the user.
|
|
462
|
-
* These must fit the `users` table schema.
|
|
463
|
-
*/
|
|
464
|
-
profile: WithoutSystemFields<DocumentByName<DataModel, "user">>;
|
|
465
|
-
/**
|
|
466
|
-
* If `true`, the account will be linked to an existing user
|
|
467
|
-
* with the same verified email address.
|
|
468
|
-
* This is only safe if the returned account's email is verified
|
|
469
|
-
* before the user is allowed to sign in with it.
|
|
470
|
-
*/
|
|
471
|
-
shouldLinkViaEmail?: boolean;
|
|
472
|
-
/**
|
|
473
|
-
* If `true`, the account will be linked to an existing user
|
|
474
|
-
* with the same verified phone number.
|
|
475
|
-
* This is only safe if the returned account's phone is verified
|
|
476
|
-
* before the user is allowed to sign in with it.
|
|
477
|
-
*/
|
|
478
|
-
shouldLinkViaPhone?: boolean;
|
|
479
|
-
}): Promise<{
|
|
480
|
-
account: GenericDoc<DataModel, "account">;
|
|
481
|
-
user: GenericDoc<DataModel, "user">;
|
|
482
|
-
}>;
|
|
483
|
-
/**
|
|
484
|
-
* Use this function from a
|
|
485
|
-
* [`ConvexCredentials`](https://labs.convex.dev/auth/api_reference/providers/ConvexCredentials)
|
|
486
|
-
* provider to retrieve a user given the account provider ID and
|
|
487
|
-
* the provider-specific account ID.
|
|
488
|
-
*
|
|
489
|
-
* @returns the retrieved user document, or `null` if there is no account
|
|
490
|
-
* for given account ID or throws if the provided
|
|
491
|
-
* secret does not match.
|
|
492
|
-
*/
|
|
493
|
-
export declare function retrieveAccount<DataModel extends GenericDataModel = GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
494
|
-
/**
|
|
495
|
-
* The provider ID (like "password"), used to disambiguate accounts.
|
|
496
|
-
*
|
|
497
|
-
* It is also used to configure account secret hashing via the provider's
|
|
498
|
-
* `crypto` option.
|
|
499
|
-
*/
|
|
500
|
-
provider: string;
|
|
501
|
-
account: {
|
|
502
|
-
/**
|
|
503
|
-
* The unique external ID for the account, for example email address.
|
|
504
|
-
*/
|
|
505
|
-
id: string;
|
|
506
|
-
/**
|
|
507
|
-
* The secret that should match the stored credential, if given.
|
|
508
|
-
*/
|
|
509
|
-
secret?: string;
|
|
510
|
-
};
|
|
511
|
-
}): Promise<{
|
|
512
|
-
account: GenericDoc<DataModel, "account">;
|
|
513
|
-
user: GenericDoc<DataModel, "user">;
|
|
514
|
-
}>;
|
|
515
|
-
/**
|
|
516
|
-
* Use this function to modify the account credentials
|
|
517
|
-
* from a [`ConvexCredentials`](https://labs.convex.dev/auth/api_reference/providers/ConvexCredentials)
|
|
518
|
-
* provider.
|
|
519
|
-
*/
|
|
520
|
-
export declare function modifyAccountCredentials<DataModel extends GenericDataModel = GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
521
|
-
/**
|
|
522
|
-
* The provider ID (like "password"), used to disambiguate accounts.
|
|
523
|
-
*
|
|
524
|
-
* It is also used to configure account secret hashing via the `crypto` option.
|
|
525
|
-
*/
|
|
526
|
-
provider: string;
|
|
527
|
-
account: {
|
|
528
|
-
/**
|
|
529
|
-
* The unique external ID for the account, for example email address.
|
|
530
|
-
*/
|
|
531
|
-
id: string;
|
|
532
|
-
/**
|
|
533
|
-
* The new secret credential to store for this account.
|
|
534
|
-
*/
|
|
535
|
-
secret: string;
|
|
536
|
-
};
|
|
537
|
-
}): Promise<void>;
|
|
538
|
-
/**
|
|
539
|
-
* Use this function to invalidate existing sessions.
|
|
540
|
-
*/
|
|
541
|
-
export declare function invalidateSessions<DataModel extends GenericDataModel = GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
542
|
-
userId: GenericId<"user">;
|
|
543
|
-
except?: GenericId<"session">[];
|
|
544
|
-
}): Promise<void>;
|
|
545
|
-
/**
|
|
546
|
-
* Use this function from a
|
|
547
|
-
* [`ConvexCredentials`](https://labs.convex.dev/auth/api_reference/providers/ConvexCredentials)
|
|
548
|
-
* provider to sign in the user via another provider (usually
|
|
549
|
-
* for email verification on sign up or password reset).
|
|
550
|
-
*
|
|
551
|
-
* Returns the user ID if the sign can proceed,
|
|
552
|
-
* or `null`.
|
|
553
|
-
*/
|
|
554
|
-
export declare function signInViaProvider<DataModel extends GenericDataModel = GenericDataModel>(ctx: GenericActionCtxWithAuthConfig<DataModel>, provider: AuthProviderConfig, args: {
|
|
555
|
-
accountId?: GenericId<"account">;
|
|
556
|
-
params?: Record<string, Value | undefined>;
|
|
557
|
-
}): Promise<{
|
|
558
|
-
userId: GenericId<"user">;
|
|
559
|
-
sessionId: GenericId<"session">;
|
|
560
|
-
} | null>;
|
|
561
548
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/implementation/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EACJ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/implementation/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EAIX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAe,SAAS,EAAK,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAMjE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAA0B,MAAM,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AA4BzC;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,2BAA2B,CACpD,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,CAClC,CAAC;AACF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,2BAA2B,CACrD,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,SAAS,CAAC,CACnC,CAAC;AACF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,gBAAgB;IAmwB1C;;OAEG;;;YAptBD;;;eAGG;2BACkB;gBAAE,IAAI,EAAE,IAAI,CAAA;aAAE;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