From 10d45e8d14cdc3672cc65dc7f5ae79e63fb2da1a Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 21 Jun 2025 11:32:42 +0000 Subject: fix: Change public image's signed tokens to be time aligned for better caching --- packages/e2e_tests/tests/api/public.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/e2e_tests') diff --git a/packages/e2e_tests/tests/api/public.test.ts b/packages/e2e_tests/tests/api/public.test.ts index 54ef79ea..94e65633 100644 --- a/packages/e2e_tests/tests/api/public.test.ts +++ b/packages/e2e_tests/tests/api/public.test.ts @@ -8,6 +8,8 @@ import { createTestUser, uploadTestAsset } from "../../utils/api"; import { waitUntil } from "../../utils/general"; import { getTrpcClient } from "../../utils/trpc"; +const SINGING_SECRET = "secret"; + describe("Public API", () => { const port = inject("karakeepPort"); @@ -174,6 +176,7 @@ describe("Public API", () => { assetId, userId, } as z.infer, + SINGING_SECRET, Date.now() + 60000, // Expires in 60 seconds ); const res = await fetch( @@ -208,6 +211,7 @@ describe("Public API", () => { }; const token = createSignedToken( malformedInnerPayload, + SINGING_SECRET, Date.now() + 60000, ); const res = await fetch( @@ -225,6 +229,7 @@ describe("Public API", () => { assetId, userId, } as z.infer, + SINGING_SECRET, Date.now() + 1000, // Expires in 1 second ); @@ -256,6 +261,7 @@ describe("Public API", () => { assetId: anotherAssetId, userId, } as z.infer, + SINGING_SECRET, Date.now() + 60000, ); @@ -285,6 +291,7 @@ describe("Public API", () => { assetId: assetId, // assetId belongs to user1 (userId) userId: userIdUser2, // token claims user2 is accessing it } as z.infer, + SINGING_SECRET, Date.now() + 60000, ); @@ -307,6 +314,7 @@ describe("Public API", () => { assetId: nonExistentAssetId, userId, // Valid userId from the primary user } as z.infer, + SINGING_SECRET, Date.now() + 60000, ); -- cgit v1.2.3-70-g09d2