DEK를 AES-256-KW를 이용해 암호화하는 것으로 변경

This commit is contained in:
static
2025-01-02 06:41:01 +09:00
parent b07d67b958
commit baf48579b8
12 changed files with 39 additions and 30 deletions

View File

@@ -4,8 +4,8 @@ import { user } from "./user";
const ciphertext = (name: string) =>
text(name, { mode: "json" }).$type<{
ciphertext: string;
iv: string;
ciphertext: string; // Base64
iv: string; // Base64
}>();
export const directory = sqliteTable(
@@ -18,7 +18,7 @@ export const directory = sqliteTable(
.notNull()
.references(() => user.id),
mekVersion: integer("master_encryption_key_version").notNull(),
encDek: ciphertext("encrypted_data_encryption_key").notNull().unique(),
encDek: text("encrypted_data_encryption_key").notNull().unique(), // Base64
encryptedAt: integer("encrypted_at", { mode: "timestamp_ms" }).notNull(),
encName: ciphertext("encrypted_name").notNull(),
},
@@ -45,7 +45,7 @@ export const file = sqliteTable(
.notNull()
.references(() => user.id),
mekVersion: integer("master_encryption_key_version").notNull(),
encDek: ciphertext("encrypted_data_encryption_key").notNull().unique(),
encDek: text("encrypted_data_encryption_key").notNull().unique(), // Base64
encryptedAt: integer("encrypted_at", { mode: "timestamp_ms" }).notNull(),
encName: ciphertext("encrypted_name").notNull(),
},