From 53d311756fc1fb1de0deff61c397993bfb1b2ae0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Prud'homme <42589969+jmarc101@users.noreply.github.com> Date: Mon, 12 May 2025 15:00:06 -0400 Subject: [PATCH] Revert "read new key last (#200)" This reverts commit a1c1f0bbc12aa0f9d8af56c96b3f3f663c091d55. --- lib/core/storage-keys.test.js | 6 +++--- lib/core/storage-keys.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/storage-keys.test.js b/lib/core/storage-keys.test.js index e091ade..d10298e 100644 --- a/lib/core/storage-keys.test.js +++ b/lib/core/storage-keys.test.js @@ -50,9 +50,9 @@ describe("Storage Key Generation", () => { expect(keys).toEqual({ write: ["OPTABLE_PASSPORT_" + encodeBase64("example.com/node1")], read: [ + "OPTABLE_PASSPORT_" + encodeBase64("example.com/node1"), "OPTABLE_PASSPORT_" + encodeBase64("legacy.example.com"), "OPTABLE_PASS_" + encodeBase64("legacy.example.com/site1"), - "OPTABLE_PASSPORT_" + encodeBase64("example.com/node1"), ], }); }); @@ -63,9 +63,9 @@ describe("Storage Key Generation", () => { expect(keys).toEqual({ write: ["OPTABLE_PASSPORT_" + encodeBase64("example.com")], read: [ + "OPTABLE_PASSPORT_" + encodeBase64("example.com"), "OPTABLE_PASSPORT_" + encodeBase64("legacy.example.com"), "OPTABLE_PASS_" + encodeBase64("legacy.example.com/site1"), - "OPTABLE_PASSPORT_" + encodeBase64("example.com"), ], }); }); @@ -76,8 +76,8 @@ describe("Storage Key Generation", () => { expect(keys).toEqual({ write: ["OPTABLE_PASSPORT_" + encodeBase64("example.com/node1")], read: [ - "OPTABLE_PASS_" + encodeBase64("example.com/site1"), "OPTABLE_PASSPORT_" + encodeBase64("example.com/node1"), + "OPTABLE_PASS_" + encodeBase64("example.com/site1"), ], }); }); diff --git a/lib/core/storage-keys.ts b/lib/core/storage-keys.ts index 3a7b577..d84a767 100644 --- a/lib/core/storage-keys.ts +++ b/lib/core/storage-keys.ts @@ -53,6 +53,7 @@ function generatePassportKeys(config: ResolvedConfig): StorageKeys { const writeKey = `OPTABLE_PASSPORT_${getWriteKeyBase64FromConfig(config)}`; write.push(writeKey); + read.push(writeKey); // We keep `OPTABLE_PASS` keys for backward compatibility // Once all clients are updated, we can remove them on next tag @@ -63,7 +64,6 @@ function generatePassportKeys(config: ResolvedConfig): StorageKeys { read.push(`OPTABLE_PASS_${encodeBase64(`${config.host}/${config.site}`)}`); } - read.push(writeKey); return { write, read }; }