diff --git a/prisma/migrations/20250827045037_add_reuse_key_to_file/migration.sql b/prisma/migrations/20250827045037_add_reuse_key_to_file/migration.sql new file mode 100644 index 0000000..a4681ba --- /dev/null +++ b/prisma/migrations/20250827045037_add_reuse_key_to_file/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "UploadedFile" ADD COLUMN "reuseKey" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 49b8849..dc3ba3c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -212,6 +212,7 @@ model UploadedFile { accountId String account Account @relation(fields: [accountId], references: [id]) path String + reuseKey String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt diff --git a/sources/app/api.ts b/sources/app/api.ts index 567be9d..d27ace3 100644 --- a/sources/app/api.ts +++ b/sources/app/api.ts @@ -249,7 +249,7 @@ export async function startApi(): Promise<{ app: FastifyInstance; io: Server }> }) } }, async (request, reply) => { - const tweetnacl = await import("tweetnacl"); + const tweetnacl = (await import("tweetnacl")).default; const publicKey = privacyKit.decodeBase64(request.body.publicKey); const challenge = privacyKit.decodeBase64(request.body.challenge); const signature = privacyKit.decodeBase64(request.body.signature); @@ -291,7 +291,7 @@ export async function startApi(): Promise<{ app: FastifyInstance; io: Server }> } } }, async (request, reply) => { - const tweetnacl = await import("tweetnacl"); + const tweetnacl = (await import("tweetnacl")).default; const publicKey = privacyKit.decodeBase64(request.body.publicKey); const isValid = tweetnacl.box.publicKeyLength === publicKey.length; if (!isValid) { @@ -330,7 +330,7 @@ export async function startApi(): Promise<{ app: FastifyInstance; io: Server }> } }, async (request, reply) => { log({ module: 'auth-response' }, `Auth response endpoint hit - user: ${request.userId}, publicKey: ${request.body.publicKey.substring(0, 20)}...`); - const tweetnacl = await import("tweetnacl"); + const tweetnacl = (await import("tweetnacl")).default; const publicKey = privacyKit.decodeBase64(request.body.publicKey); const isValid = tweetnacl.box.publicKeyLength === publicKey.length; if (!isValid) { @@ -604,7 +604,7 @@ export async function startApi(): Promise<{ app: FastifyInstance; io: Server }> } } }, async (request, reply) => { - const tweetnacl = await import("tweetnacl"); + const tweetnacl = (await import("tweetnacl")).default; const publicKey = privacyKit.decodeBase64(request.body.publicKey); const isValid = tweetnacl.box.publicKeyLength === publicKey.length; if (!isValid) { @@ -639,7 +639,7 @@ export async function startApi(): Promise<{ app: FastifyInstance; io: Server }> }) } }, async (request, reply) => { - const tweetnacl = await import("tweetnacl"); + const tweetnacl = (await import("tweetnacl")).default; const publicKey = privacyKit.decodeBase64(request.body.publicKey); const isValid = tweetnacl.box.publicKeyLength === publicKey.length; if (!isValid) {