This commit is contained in:
@@ -323,3 +323,36 @@ export const invoiceItems = sqliteTable(
|
||||
invoiceIdIdx: index("invoice_items_invoice_id_idx").on(table.invoiceId),
|
||||
}),
|
||||
);
|
||||
|
||||
export const passkeys = sqliteTable(
|
||||
"passkeys",
|
||||
{
|
||||
id: text("id").primaryKey(), // The Credential ID
|
||||
userId: text("user_id").notNull(),
|
||||
publicKey: text("public_key").notNull(), // Base64 encoded public key
|
||||
counter: integer("counter").notNull(),
|
||||
deviceType: text("device_type").notNull(), // 'singleDevice' or 'multiDevice'
|
||||
backedUp: integer("backed_up", { mode: "boolean" }).notNull(),
|
||||
transports: text("transports"), // JSON stringified array
|
||||
lastUsedAt: integer("last_used_at", { mode: "timestamp" }),
|
||||
createdAt: integer("created_at", { mode: "timestamp" }).$defaultFn(
|
||||
() => new Date(),
|
||||
),
|
||||
},
|
||||
(table: any) => ({
|
||||
userFk: foreignKey({
|
||||
columns: [table.userId],
|
||||
foreignColumns: [users.id],
|
||||
}),
|
||||
userIdIdx: index("passkeys_user_id_idx").on(table.userId),
|
||||
}),
|
||||
);
|
||||
|
||||
export const passkeyChallenges = sqliteTable("passkey_challenges", {
|
||||
id: text("id")
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
challenge: text("challenge").notNull().unique(),
|
||||
userId: text("user_id"),
|
||||
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user