@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
|
@@ -127,6 +127,82 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
127
127
|
}, "required", "sessionId" | "signature">, {
|
|
128
128
|
signature: ["signature", "_creationTime"];
|
|
129
129
|
}, {}, {}>;
|
|
130
|
+
/**
|
|
131
|
+
* WebAuthn passkey credentials. Each credential links a user to a
|
|
132
|
+
* registered authenticator (Touch ID, Face ID, security key, etc.).
|
|
133
|
+
* A user can have multiple passkeys across different devices.
|
|
134
|
+
*/
|
|
135
|
+
passkey: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
136
|
+
name?: string | undefined;
|
|
137
|
+
transports?: string[] | undefined;
|
|
138
|
+
lastUsedAt?: number | undefined;
|
|
139
|
+
userId: import("convex/values").GenericId<"user">;
|
|
140
|
+
credentialId: string;
|
|
141
|
+
publicKey: ArrayBuffer;
|
|
142
|
+
algorithm: number;
|
|
143
|
+
counter: number;
|
|
144
|
+
deviceType: string;
|
|
145
|
+
backedUp: boolean;
|
|
146
|
+
createdAt: number;
|
|
147
|
+
}, {
|
|
148
|
+
userId: import("convex/values").VId<import("convex/values").GenericId<"user">, "required">;
|
|
149
|
+
/** Base64url-encoded credential ID from the authenticator. */
|
|
150
|
+
credentialId: import("convex/values").VString<string, "required">;
|
|
151
|
+
/** Public key bytes (SEC1 uncompressed for EC, SPKI for RSA). */
|
|
152
|
+
publicKey: import("convex/values").VBytes<ArrayBuffer, "required">;
|
|
153
|
+
/** COSE algorithm identifier (-7 for ES256, -257 for RS256, -8 for EdDSA). */
|
|
154
|
+
algorithm: import("convex/values").VFloat64<number, "required">;
|
|
155
|
+
/** Signature counter for clone detection. Many authenticators return 0. */
|
|
156
|
+
counter: import("convex/values").VFloat64<number, "required">;
|
|
157
|
+
/** Authenticator transport hints (e.g. "internal", "hybrid", "usb", "ble", "nfc"). */
|
|
158
|
+
transports: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
159
|
+
/** Whether this is a single-device or multi-device (synced) credential. */
|
|
160
|
+
deviceType: import("convex/values").VString<string, "required">;
|
|
161
|
+
/** Whether the credential is backed up (synced passkey). */
|
|
162
|
+
backedUp: import("convex/values").VBoolean<boolean, "required">;
|
|
163
|
+
/** User-assigned friendly name (e.g. "MacBook Touch ID"). */
|
|
164
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
165
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
166
|
+
lastUsedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
167
|
+
}, "required", "name" | "userId" | "credentialId" | "publicKey" | "algorithm" | "counter" | "transports" | "deviceType" | "backedUp" | "createdAt" | "lastUsedAt">, {
|
|
168
|
+
userId: ["userId", "_creationTime"];
|
|
169
|
+
credentialId: ["credentialId", "_creationTime"];
|
|
170
|
+
}, {}, {}>;
|
|
171
|
+
/**
|
|
172
|
+
* TOTP two-factor authentication secrets. Each record links a user to
|
|
173
|
+
* an authenticator app. A user can have multiple TOTP enrollments
|
|
174
|
+
* (e.g. different authenticator apps) but typically has one.
|
|
175
|
+
*
|
|
176
|
+
* The `verified` flag indicates whether the user has completed setup
|
|
177
|
+
* by successfully entering a code from their authenticator app.
|
|
178
|
+
* Unverified enrollments are in-progress setup that can be discarded.
|
|
179
|
+
*/
|
|
180
|
+
totp: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
181
|
+
name?: string | undefined;
|
|
182
|
+
lastUsedAt?: number | undefined;
|
|
183
|
+
secret: ArrayBuffer;
|
|
184
|
+
userId: import("convex/values").GenericId<"user">;
|
|
185
|
+
createdAt: number;
|
|
186
|
+
digits: number;
|
|
187
|
+
period: number;
|
|
188
|
+
verified: boolean;
|
|
189
|
+
}, {
|
|
190
|
+
userId: import("convex/values").VId<import("convex/values").GenericId<"user">, "required">;
|
|
191
|
+
/** Raw TOTP secret key bytes. */
|
|
192
|
+
secret: import("convex/values").VBytes<ArrayBuffer, "required">;
|
|
193
|
+
/** Number of digits in each code (typically 6). */
|
|
194
|
+
digits: import("convex/values").VFloat64<number, "required">;
|
|
195
|
+
/** Time period in seconds for code rotation (typically 30). */
|
|
196
|
+
period: import("convex/values").VFloat64<number, "required">;
|
|
197
|
+
/** Whether setup has been confirmed with a valid code. */
|
|
198
|
+
verified: import("convex/values").VBoolean<boolean, "required">;
|
|
199
|
+
/** User-assigned friendly name (e.g. "Google Authenticator"). */
|
|
200
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
201
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
202
|
+
lastUsedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
203
|
+
}, "required", "name" | "secret" | "userId" | "createdAt" | "lastUsedAt" | "digits" | "period" | "verified">, {
|
|
204
|
+
userId: ["userId", "_creationTime"];
|
|
205
|
+
}, {}, {}>;
|
|
130
206
|
/**
|
|
131
207
|
* Rate limit tracking for OTP and password sign-in attempts.
|
|
132
208
|
*/
|
|
@@ -183,29 +259,32 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
183
259
|
userId: ["userId", "_creationTime"];
|
|
184
260
|
}, {}, {}>;
|
|
185
261
|
/**
|
|
186
|
-
*
|
|
187
|
-
* invitations to
|
|
188
|
-
*
|
|
262
|
+
* Invitations. Tracks pending, accepted, revoked, and expired
|
|
263
|
+
* invitations. Optionally scoped to a group via `groupId`, or
|
|
264
|
+
* platform-level when `groupId` is omitted.
|
|
265
|
+
*
|
|
266
|
+
* `email` and `invitedByUserId` are optional to support CLI-generated
|
|
267
|
+
* invite links where neither is known upfront (e.g. portal admin invites).
|
|
189
268
|
*/
|
|
190
269
|
invite: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
270
|
+
email?: string | undefined;
|
|
191
271
|
extend?: any;
|
|
192
272
|
groupId?: import("convex/values").GenericId<"group"> | undefined;
|
|
193
273
|
role?: string | undefined;
|
|
274
|
+
invitedByUserId?: import("convex/values").GenericId<"user"> | undefined;
|
|
275
|
+
expiresTime?: number | undefined;
|
|
194
276
|
acceptedByUserId?: import("convex/values").GenericId<"user"> | undefined;
|
|
195
277
|
acceptedTime?: number | undefined;
|
|
196
|
-
email: string;
|
|
197
278
|
status: "pending" | "accepted" | "revoked" | "expired";
|
|
198
|
-
invitedByUserId: import("convex/values").GenericId<"user">;
|
|
199
279
|
tokenHash: string;
|
|
200
|
-
expiresTime: number;
|
|
201
280
|
}, {
|
|
202
281
|
groupId: import("convex/values").VId<import("convex/values").GenericId<"group"> | undefined, "optional">;
|
|
203
|
-
invitedByUserId: import("convex/values").VId<import("convex/values").GenericId<"user"
|
|
204
|
-
email: import("convex/values").VString<string, "
|
|
282
|
+
invitedByUserId: import("convex/values").VId<import("convex/values").GenericId<"user"> | undefined, "optional">;
|
|
283
|
+
email: import("convex/values").VString<string | undefined, "optional">;
|
|
205
284
|
tokenHash: import("convex/values").VString<string, "required">;
|
|
206
285
|
role: import("convex/values").VString<string | undefined, "optional">;
|
|
207
286
|
status: import("convex/values").VUnion<"pending" | "accepted" | "revoked" | "expired", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"revoked", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
|
|
208
|
-
expiresTime: import("convex/values").VFloat64<number, "
|
|
287
|
+
expiresTime: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
209
288
|
acceptedByUserId: import("convex/values").VId<import("convex/values").GenericId<"user"> | undefined, "optional">;
|
|
210
289
|
acceptedTime: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
211
290
|
extend: import("convex/values").VAny<any, "optional", string>;
|
|
@@ -216,6 +295,86 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
216
295
|
invitedByUserIdAndStatus: ["invitedByUserId", "status", "_creationTime"];
|
|
217
296
|
groupId: ["groupId", "_creationTime"];
|
|
218
297
|
groupIdAndStatus: ["groupId", "status", "_creationTime"];
|
|
298
|
+
roleAndStatusAndAcceptedByUserId: ["role", "status", "acceptedByUserId", "_creationTime"];
|
|
299
|
+
}, {}, {}>;
|
|
300
|
+
/**
|
|
301
|
+
* API keys for programmatic access. Each key links a user to a set of
|
|
302
|
+
* scoped permissions and optional per-key rate limiting.
|
|
303
|
+
*
|
|
304
|
+
* The raw key is never stored — only a SHA-256 hash. A short prefix
|
|
305
|
+
* (e.g. "sk_live_abc1...") is kept for display in the portal.
|
|
306
|
+
*
|
|
307
|
+
* Keys support:
|
|
308
|
+
* - **Scoped permissions**: resource:action pairs (e.g. users:read)
|
|
309
|
+
* - **Per-key rate limiting**: token-bucket with configurable window
|
|
310
|
+
* - **Expiration**: optional TTL
|
|
311
|
+
* - **Soft revocation**: `revoked` flag preserves audit trail
|
|
312
|
+
*/
|
|
313
|
+
key: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
314
|
+
lastUsedAt?: number | undefined;
|
|
315
|
+
rateLimit?: {
|
|
316
|
+
maxRequests: number;
|
|
317
|
+
windowMs: number;
|
|
318
|
+
} | undefined;
|
|
319
|
+
rateLimitState?: {
|
|
320
|
+
lastAttemptTime: number;
|
|
321
|
+
attemptsLeft: number;
|
|
322
|
+
} | undefined;
|
|
323
|
+
expiresAt?: number | undefined;
|
|
324
|
+
name: string;
|
|
325
|
+
userId: import("convex/values").GenericId<"user">;
|
|
326
|
+
createdAt: number;
|
|
327
|
+
revoked: boolean;
|
|
328
|
+
prefix: string;
|
|
329
|
+
hashedKey: string;
|
|
330
|
+
scopes: {
|
|
331
|
+
resource: string;
|
|
332
|
+
actions: string[];
|
|
333
|
+
}[];
|
|
334
|
+
}, {
|
|
335
|
+
userId: import("convex/values").VId<import("convex/values").GenericId<"user">, "required">;
|
|
336
|
+
/** First chars of the key for display (e.g. "sk_live_abc1..."). */
|
|
337
|
+
prefix: import("convex/values").VString<string, "required">;
|
|
338
|
+
/** SHA-256 hex hash of the full raw key. */
|
|
339
|
+
hashedKey: import("convex/values").VString<string, "required">;
|
|
340
|
+
/** User-assigned name (e.g. "CI Pipeline", "Production API"). */
|
|
341
|
+
name: import("convex/values").VString<string, "required">;
|
|
342
|
+
/** Scoped permissions: [{ resource: "users", actions: ["read", "list"] }]. */
|
|
343
|
+
scopes: import("convex/values").VArray<{
|
|
344
|
+
resource: string;
|
|
345
|
+
actions: string[];
|
|
346
|
+
}[], import("convex/values").VObject<{
|
|
347
|
+
resource: string;
|
|
348
|
+
actions: string[];
|
|
349
|
+
}, {
|
|
350
|
+
resource: import("convex/values").VString<string, "required">;
|
|
351
|
+
actions: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
|
|
352
|
+
}, "required", "resource" | "actions">, "required">;
|
|
353
|
+
/** Optional per-key rate limit configuration. */
|
|
354
|
+
rateLimit: import("convex/values").VObject<{
|
|
355
|
+
maxRequests: number;
|
|
356
|
+
windowMs: number;
|
|
357
|
+
} | undefined, {
|
|
358
|
+
maxRequests: import("convex/values").VFloat64<number, "required">;
|
|
359
|
+
windowMs: import("convex/values").VFloat64<number, "required">;
|
|
360
|
+
}, "optional", "maxRequests" | "windowMs">;
|
|
361
|
+
/** Rate limit state tracking (token-bucket). */
|
|
362
|
+
rateLimitState: import("convex/values").VObject<{
|
|
363
|
+
lastAttemptTime: number;
|
|
364
|
+
attemptsLeft: number;
|
|
365
|
+
} | undefined, {
|
|
366
|
+
attemptsLeft: import("convex/values").VFloat64<number, "required">;
|
|
367
|
+
lastAttemptTime: import("convex/values").VFloat64<number, "required">;
|
|
368
|
+
}, "optional", "lastAttemptTime" | "attemptsLeft">;
|
|
369
|
+
/** Expiration timestamp. Null/undefined = never expires. */
|
|
370
|
+
expiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
371
|
+
lastUsedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
372
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
373
|
+
/** Soft-revoke flag. Revoked keys are kept for audit trail. */
|
|
374
|
+
revoked: import("convex/values").VBoolean<boolean, "required">;
|
|
375
|
+
}, "required", "name" | "userId" | "createdAt" | "lastUsedAt" | "revoked" | "prefix" | "hashedKey" | "scopes" | "rateLimit" | "rateLimitState" | "expiresAt" | "rateLimit.maxRequests" | "rateLimit.windowMs" | "rateLimitState.lastAttemptTime" | "rateLimitState.attemptsLeft">, {
|
|
376
|
+
userId: ["userId", "_creationTime"];
|
|
377
|
+
hashedKey: ["hashedKey", "_creationTime"];
|
|
219
378
|
}, {}, {}>;
|
|
220
379
|
}, true>;
|
|
221
380
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;;IAED;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;IAcH;;;;OAIG;;;;;;;;;;IAMH;;;;OAIG;;;;;;;;;;;;;;;;;;;IAYH;;;;;;;OAOG;;;;;;;;;;;;;;;IAaH;;OAEG;;;;;;;;;;;;;;;;;;;;;IAaH;;;OAGG;;;;;;;;;;IAMH;;OAEG;;;;;;;;;;;;IAOH;;;;OAIG;;;;;;;;;;;;;;;IAUH;;;;OAIG;;;;;;;;;;;;;;;;;;IAYH
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;;IAED;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;IAcH;;;;OAIG;;;;;;;;;;IAMH;;;;OAIG;;;;;;;;;;;;;;;;;;;IAYH;;;;;;;OAOG;;;;;;;;;;;;;;;IAaH;;OAEG;;;;;;;;;;;;;;;;;;;;;IAaH;;;OAGG;;;;;;;;;;IAMH;;;;OAIG;;;;;;;;;;;;;;;QAGD,8DAA8D;;QAE9D,iEAAiE;;QAEjE,8EAA8E;;QAE9E,2EAA2E;;QAE3E,sFAAsF;;QAEtF,2EAA2E;;QAE3E,4DAA4D;;QAE5D,6DAA6D;;;;;;;;IAQ/D;;;;;;;;OAQG;;;;;;;;;;;;QAGD,iCAAiC;;QAEjC,mDAAmD;;QAEnD,+DAA+D;;QAE/D,0DAA0D;;QAE1D,iEAAiE;;;;;;;IAOnE;;OAEG;;;;;;;;;;;;IAOH;;;;OAIG;;;;;;;;;;;;;;;IAUH;;;;OAIG;;;;;;;;;;;;;;;;;;IAYH;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BH;;;;;;;;;;;;OAYG;;;;;;;;;;;;;;;;;;;;;;;;QAGD,mEAAmE;;QAEnE,4CAA4C;;QAE5C,iEAAiE;;QAEjE,8EAA8E;;;;;;;;;;;QAO9E,iDAAiD;;;;;;;;QAOjD,gDAAgD;;;;;;;;QAOhD,4DAA4D;;;;QAI5D,+DAA+D;;;;;;;AAzQnE,wBA8QG"}
|
package/dist/component/schema.js
CHANGED
|
@@ -89,6 +89,59 @@ export default defineSchema({
|
|
|
89
89
|
sessionId: v.optional(v.id("session")),
|
|
90
90
|
signature: v.optional(v.string()),
|
|
91
91
|
}).index("signature", ["signature"]),
|
|
92
|
+
/**
|
|
93
|
+
* WebAuthn passkey credentials. Each credential links a user to a
|
|
94
|
+
* registered authenticator (Touch ID, Face ID, security key, etc.).
|
|
95
|
+
* A user can have multiple passkeys across different devices.
|
|
96
|
+
*/
|
|
97
|
+
passkey: defineTable({
|
|
98
|
+
userId: v.id("user"),
|
|
99
|
+
/** Base64url-encoded credential ID from the authenticator. */
|
|
100
|
+
credentialId: v.string(),
|
|
101
|
+
/** Public key bytes (SEC1 uncompressed for EC, SPKI for RSA). */
|
|
102
|
+
publicKey: v.bytes(),
|
|
103
|
+
/** COSE algorithm identifier (-7 for ES256, -257 for RS256, -8 for EdDSA). */
|
|
104
|
+
algorithm: v.number(),
|
|
105
|
+
/** Signature counter for clone detection. Many authenticators return 0. */
|
|
106
|
+
counter: v.number(),
|
|
107
|
+
/** Authenticator transport hints (e.g. "internal", "hybrid", "usb", "ble", "nfc"). */
|
|
108
|
+
transports: v.optional(v.array(v.string())),
|
|
109
|
+
/** Whether this is a single-device or multi-device (synced) credential. */
|
|
110
|
+
deviceType: v.string(),
|
|
111
|
+
/** Whether the credential is backed up (synced passkey). */
|
|
112
|
+
backedUp: v.boolean(),
|
|
113
|
+
/** User-assigned friendly name (e.g. "MacBook Touch ID"). */
|
|
114
|
+
name: v.optional(v.string()),
|
|
115
|
+
createdAt: v.number(),
|
|
116
|
+
lastUsedAt: v.optional(v.number()),
|
|
117
|
+
})
|
|
118
|
+
.index("userId", ["userId"])
|
|
119
|
+
.index("credentialId", ["credentialId"]),
|
|
120
|
+
/**
|
|
121
|
+
* TOTP two-factor authentication secrets. Each record links a user to
|
|
122
|
+
* an authenticator app. A user can have multiple TOTP enrollments
|
|
123
|
+
* (e.g. different authenticator apps) but typically has one.
|
|
124
|
+
*
|
|
125
|
+
* The `verified` flag indicates whether the user has completed setup
|
|
126
|
+
* by successfully entering a code from their authenticator app.
|
|
127
|
+
* Unverified enrollments are in-progress setup that can be discarded.
|
|
128
|
+
*/
|
|
129
|
+
totp: defineTable({
|
|
130
|
+
userId: v.id("user"),
|
|
131
|
+
/** Raw TOTP secret key bytes. */
|
|
132
|
+
secret: v.bytes(),
|
|
133
|
+
/** Number of digits in each code (typically 6). */
|
|
134
|
+
digits: v.number(),
|
|
135
|
+
/** Time period in seconds for code rotation (typically 30). */
|
|
136
|
+
period: v.number(),
|
|
137
|
+
/** Whether setup has been confirmed with a valid code. */
|
|
138
|
+
verified: v.boolean(),
|
|
139
|
+
/** User-assigned friendly name (e.g. "Google Authenticator"). */
|
|
140
|
+
name: v.optional(v.string()),
|
|
141
|
+
createdAt: v.number(),
|
|
142
|
+
lastUsedAt: v.optional(v.number()),
|
|
143
|
+
})
|
|
144
|
+
.index("userId", ["userId"]),
|
|
92
145
|
/**
|
|
93
146
|
* Rate limit tracking for OTP and password sign-in attempts.
|
|
94
147
|
*/
|
|
@@ -126,18 +179,21 @@ export default defineSchema({
|
|
|
126
179
|
.index("groupIdAndUserId", ["groupId", "userId"])
|
|
127
180
|
.index("userId", ["userId"]),
|
|
128
181
|
/**
|
|
129
|
-
*
|
|
130
|
-
* invitations to
|
|
131
|
-
*
|
|
182
|
+
* Invitations. Tracks pending, accepted, revoked, and expired
|
|
183
|
+
* invitations. Optionally scoped to a group via `groupId`, or
|
|
184
|
+
* platform-level when `groupId` is omitted.
|
|
185
|
+
*
|
|
186
|
+
* `email` and `invitedByUserId` are optional to support CLI-generated
|
|
187
|
+
* invite links where neither is known upfront (e.g. portal admin invites).
|
|
132
188
|
*/
|
|
133
189
|
invite: defineTable({
|
|
134
190
|
groupId: v.optional(v.id("group")),
|
|
135
|
-
invitedByUserId: v.id("user"),
|
|
136
|
-
email: v.string(),
|
|
191
|
+
invitedByUserId: v.optional(v.id("user")),
|
|
192
|
+
email: v.optional(v.string()),
|
|
137
193
|
tokenHash: v.string(),
|
|
138
194
|
role: v.optional(v.string()),
|
|
139
195
|
status: v.union(v.literal("pending"), v.literal("accepted"), v.literal("revoked"), v.literal("expired")),
|
|
140
|
-
expiresTime: v.number(),
|
|
196
|
+
expiresTime: v.optional(v.number()),
|
|
141
197
|
acceptedByUserId: v.optional(v.id("user")),
|
|
142
198
|
acceptedTime: v.optional(v.number()),
|
|
143
199
|
extend: v.optional(v.any()),
|
|
@@ -147,6 +203,56 @@ export default defineSchema({
|
|
|
147
203
|
.index("emailAndStatus", ["email", "status"])
|
|
148
204
|
.index("invitedByUserIdAndStatus", ["invitedByUserId", "status"])
|
|
149
205
|
.index("groupId", ["groupId"])
|
|
150
|
-
.index("groupIdAndStatus", ["groupId", "status"])
|
|
206
|
+
.index("groupIdAndStatus", ["groupId", "status"])
|
|
207
|
+
.index("roleAndStatusAndAcceptedByUserId", [
|
|
208
|
+
"role",
|
|
209
|
+
"status",
|
|
210
|
+
"acceptedByUserId",
|
|
211
|
+
]),
|
|
212
|
+
/**
|
|
213
|
+
* API keys for programmatic access. Each key links a user to a set of
|
|
214
|
+
* scoped permissions and optional per-key rate limiting.
|
|
215
|
+
*
|
|
216
|
+
* The raw key is never stored — only a SHA-256 hash. A short prefix
|
|
217
|
+
* (e.g. "sk_live_abc1...") is kept for display in the portal.
|
|
218
|
+
*
|
|
219
|
+
* Keys support:
|
|
220
|
+
* - **Scoped permissions**: resource:action pairs (e.g. users:read)
|
|
221
|
+
* - **Per-key rate limiting**: token-bucket with configurable window
|
|
222
|
+
* - **Expiration**: optional TTL
|
|
223
|
+
* - **Soft revocation**: `revoked` flag preserves audit trail
|
|
224
|
+
*/
|
|
225
|
+
key: defineTable({
|
|
226
|
+
userId: v.id("user"),
|
|
227
|
+
/** First chars of the key for display (e.g. "sk_live_abc1..."). */
|
|
228
|
+
prefix: v.string(),
|
|
229
|
+
/** SHA-256 hex hash of the full raw key. */
|
|
230
|
+
hashedKey: v.string(),
|
|
231
|
+
/** User-assigned name (e.g. "CI Pipeline", "Production API"). */
|
|
232
|
+
name: v.string(),
|
|
233
|
+
/** Scoped permissions: [{ resource: "users", actions: ["read", "list"] }]. */
|
|
234
|
+
scopes: v.array(v.object({
|
|
235
|
+
resource: v.string(),
|
|
236
|
+
actions: v.array(v.string()),
|
|
237
|
+
})),
|
|
238
|
+
/** Optional per-key rate limit configuration. */
|
|
239
|
+
rateLimit: v.optional(v.object({
|
|
240
|
+
maxRequests: v.number(),
|
|
241
|
+
windowMs: v.number(),
|
|
242
|
+
})),
|
|
243
|
+
/** Rate limit state tracking (token-bucket). */
|
|
244
|
+
rateLimitState: v.optional(v.object({
|
|
245
|
+
attemptsLeft: v.number(),
|
|
246
|
+
lastAttemptTime: v.number(),
|
|
247
|
+
})),
|
|
248
|
+
/** Expiration timestamp. Null/undefined = never expires. */
|
|
249
|
+
expiresAt: v.optional(v.number()),
|
|
250
|
+
lastUsedAt: v.optional(v.number()),
|
|
251
|
+
createdAt: v.number(),
|
|
252
|
+
/** Soft-revoke flag. Revoked keys are kept for audit trail. */
|
|
253
|
+
revoked: v.boolean(),
|
|
254
|
+
})
|
|
255
|
+
.index("userId", ["userId"])
|
|
256
|
+
.index("hashedKey", ["hashedKey"]),
|
|
151
257
|
});
|
|
152
258
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC;;;;;;GAMG;AACH,eAAe,YAAY,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,qBAAqB,EAAE,C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+
/**
|
|
3
|
+
* Passkey (WebAuthn) authentication provider.
|
|
4
|
+
*
|
|
5
|
+
* Enables passwordless authentication via biometrics, security keys,
|
|
6
|
+
* and synced passkeys using the Web Authentication API.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import passkey from "@robelest/convex-auth/providers/passkey";
|
|
10
|
+
*
|
|
11
|
+
* export const { auth, signIn, signOut, store } = Auth({
|
|
12
|
+
* component: components.auth,
|
|
13
|
+
* providers: [passkey()],
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param config Optional configuration for the relying party and credential options.
|
|
18
|
+
*/
|
|
19
|
+
export default function passkey(config?: Partial<PasskeyProviderConfig["options"]>): PasskeyProviderConfig;
|
|
20
|
+
//# sourceMappingURL=passkey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,GACjD,qBAAqB,CAavB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passkey (WebAuthn) authentication provider.
|
|
3
|
+
*
|
|
4
|
+
* Enables passwordless authentication via biometrics, security keys,
|
|
5
|
+
* and synced passkeys using the Web Authentication API.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import passkey from "@robelest/convex-auth/providers/passkey";
|
|
9
|
+
*
|
|
10
|
+
* export const { auth, signIn, signOut, store } = Auth({
|
|
11
|
+
* component: components.auth,
|
|
12
|
+
* providers: [passkey()],
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param config Optional configuration for the relying party and credential options.
|
|
17
|
+
*/
|
|
18
|
+
export default function passkey(config) {
|
|
19
|
+
return {
|
|
20
|
+
id: "passkey",
|
|
21
|
+
type: "passkey",
|
|
22
|
+
options: {
|
|
23
|
+
attestation: "none",
|
|
24
|
+
userVerification: "required",
|
|
25
|
+
residentKey: "preferred",
|
|
26
|
+
algorithms: [-7, -257], // ES256, RS256
|
|
27
|
+
challengeExpirationMs: 300_000, // 5 minutes
|
|
28
|
+
...config,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=passkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../../src/providers/passkey.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,MAAkD;IAElD,OAAO;QACL,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,OAAO,EAAE;YACP,WAAW,EAAE,MAAM;YACnB,gBAAgB,EAAE,UAAU;YAC5B,WAAW,EAAE,WAAW;YACxB,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,eAAe;YACvC,qBAAqB,EAAE,OAAO,EAAE,YAAY;YAC5C,GAAG,MAAM;SACV;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TotpProviderConfig } from "../server/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Add TOTP (Time-based One-Time Password) authentication.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import TOTP from "@robelest/convex-auth/providers/totp";
|
|
7
|
+
*
|
|
8
|
+
* export const { auth, signIn, signOut, store } = Auth({
|
|
9
|
+
* providers: [TOTP({ issuer: "My App" })],
|
|
10
|
+
* });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export default function totp(config?: Partial<TotpProviderConfig["options"]>): TotpProviderConfig;
|
|
14
|
+
//# sourceMappingURL=totp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp.d.ts","sourceRoot":"","sources":["../../src/providers/totp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,GAC9C,kBAAkB,CAUpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add TOTP (Time-based One-Time Password) authentication.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* import TOTP from "@robelest/convex-auth/providers/totp";
|
|
6
|
+
*
|
|
7
|
+
* export const { auth, signIn, signOut, store } = Auth({
|
|
8
|
+
* providers: [TOTP({ issuer: "My App" })],
|
|
9
|
+
* });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export default function totp(config) {
|
|
13
|
+
return {
|
|
14
|
+
id: "totp",
|
|
15
|
+
type: "totp",
|
|
16
|
+
options: {
|
|
17
|
+
issuer: config?.issuer ?? "ConvexAuth",
|
|
18
|
+
digits: config?.digits ?? 6,
|
|
19
|
+
period: config?.period ?? 30,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=totp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp.js","sourceRoot":"","sources":["../../src/providers/totp.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,MAA+C;IAE/C,OAAO;QACL,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE;YACP,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,YAAY;YACtC,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;YAC3B,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;SAC7B;KACF,CAAC;AACJ,CAAC"}
|