diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-06-21 11:32:42 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-06-21 11:32:42 +0000 |
| commit | 10d45e8d14cdc3672cc65dc7f5ae79e63fb2da1a (patch) | |
| tree | c7718fa75a07a7aa166db6a1a1b2e93030732b1e /packages/e2e_tests/tests | |
| parent | f1f665f89cba21d4d448d27471d01a4d78a184ff (diff) | |
| download | karakeep-10d45e8d14cdc3672cc65dc7f5ae79e63fb2da1a.tar.zst | |
fix: Change public image's signed tokens to be time aligned for better caching
Diffstat (limited to 'packages/e2e_tests/tests')
| -rw-r--r-- | packages/e2e_tests/tests/api/public.test.ts | 8 |
1 files changed, 8 insertions, 0 deletions
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<typeof zAssetSignedTokenSchema>, + 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<typeof zAssetSignedTokenSchema>, + SINGING_SECRET, Date.now() + 1000, // Expires in 1 second ); @@ -256,6 +261,7 @@ describe("Public API", () => { assetId: anotherAssetId, userId, } as z.infer<typeof zAssetSignedTokenSchema>, + 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<typeof zAssetSignedTokenSchema>, + SINGING_SECRET, Date.now() + 60000, ); @@ -307,6 +314,7 @@ describe("Public API", () => { assetId: nonExistentAssetId, userId, // Valid userId from the primary user } as z.infer<typeof zAssetSignedTokenSchema>, + SINGING_SECRET, Date.now() + 60000, ); |
