Skip to content

Commit

Permalink
passthrough if key not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Sep 22, 2024
1 parent 0189433 commit e96af14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/blockstore/store-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export async function addCryptoKeyToGatewayMetaPayload(uri: URI, sthis: SuperThi
const kb = await rt.kb.getKeyBag(sthis);
const res = await kb.getNamedExtractableKey(keyName, true);
if (res.isErr()) {
throw new Error(`Failed to get named extractable key: ${keyName}`);
sthis.logger.Error().Str("keyName", keyName).Msg("Failed to get named extractable key");
return body;
}
const keyData = await res.Ok().extract();
const dbMetas = await decodeGatewayMetaBytesToDbMeta(sthis, body);
Expand Down
3 changes: 2 additions & 1 deletion tests/blockstore/keyed-crypto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ describe("KeyedCryptoStore", () => {
baseUrl = URI.from("indexdb://fp-keyed-crypto-store");
} else {
kbUrl = URI.merge(`file://./dist/tests/key.bag`, sthis.env.get("FP_KEYBAG_URL"));
baseUrl = URI.merge("file://./dist/tests/keyed-crypto-store", sthis.env.get("FP_STORAGE_URL"));
// baseUrl = URI.merge("file://./dist/tests/keyed-crypto-store", sthis.env.get("FP_STORAGE_URL"));
baseUrl = URI.from(sthis.env.get("FP_STORAGE_URL"));
}
kb = await rt.kb.getKeyBag(sthis, {
url: kbUrl,
Expand Down
4 changes: 2 additions & 2 deletions tests/fireproof/fireproof.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ describe("same workload twice, same CID", function () {
let ok: DocResponse;
await sthis.start();
// todo this fails because the test setup doesn't properly configure both databases to use the same key
dbA = fireproof("test-dual-workload-a", configA);
dbA = fireproof("test-dual-workload-a");
for (const doc of docs) {
ok = await dbA.put(doc);
expect(ok).toBeTruthy();
Expand All @@ -656,7 +656,7 @@ describe("same workload twice, same CID", function () {
headA = dbA._crdt.clock.head.toString();

// todo this fails because the test setup doesn't properly configure both databases to use the same key
dbB = fireproof("test-dual-workload-b", configB);
dbB = fireproof("test-dual-workload-b");
for (const doc of docs) {
ok = await dbB.put(doc);
expect(ok).toBeTruthy();
Expand Down

0 comments on commit e96af14

Please sign in to comment.