File sharing

This commit is contained in:
2026-10-29 20:44:26 -03:00
parent b65d8efad8
commit de1ad70068
18 changed files with 582 additions and 59 deletions
+12
View File
@@ -21,15 +21,27 @@ export interface StoredFile extends Record<string, unknown> {
metadata: string;
}
export interface StoredShare extends Record<string, unknown> {
user_id: string;
file_id: string;
// The file metadata encrypted with the secret in the share link
metadata: string;
// The link secret encrypted with the owner's master key
secret: string;
}
// boksy's partial entry types lose the field types
export type FileRow = Model & StoredFile;
export type ShareRow = Model & StoredShare;
type Schema = {
users: User;
files: StoredFile;
shares: StoredShare;
};
export const db = await Database.open<Schema>(DATABASE_PATH ?? ":memory:", {
users: ["code"],
files: ["user_id"],
shares: ["user_id", "file_id"],
});