feat: 实现演示验证码和令牌轮换

This commit is contained in:
root
2026-09-14 18:43:45 +08:00
parent 6b901e074e
commit 3e04197b02
24 changed files with 1486 additions and 12 deletions
+14 -9
View File
@@ -148,17 +148,22 @@ model AuthIdentity {
}
model Session {
id String @id @default(uuid()) @db.Uuid
accountId String @map("account_id") @db.Uuid
refreshTokenHash String @unique @map("refresh_token_hash") @db.VarChar(255)
deviceId String? @map("device_id") @db.VarChar(255)
expiresAt DateTime @map("expires_at") @db.Timestamptz(3)
revokedAt DateTime? @map("revoked_at") @db.Timestamptz(3)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
id String @id @default(uuid()) @db.Uuid
accountId String @map("account_id") @db.Uuid
refreshTokenHash String @unique @map("refresh_token_hash") @db.VarChar(255)
deviceId String? @map("device_id") @db.VarChar(255)
expiresAt DateTime @map("expires_at") @db.Timestamptz(3)
revokedAt DateTime? @map("revoked_at") @db.Timestamptz(3)
tokenFamily String @map("token_family") @db.Uuid
generation Int @default(0)
previousTokenHash String? @unique @map("previous_token_hash") @db.VarChar(255)
rotatedAt DateTime? @map("rotated_at") @db.Timestamptz(3)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
@@index([accountId, expiresAt])
@@index([tokenFamily])
@@map("sessions")
}