Skip to content

Commit 326c7a5

Browse files
committed
renamed injectedDecryptionKey -> injectedEmbeddedKey
1 parent 4a78757 commit 326c7a5

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

export-and-sign/dist/bundle.9876c027ef7327c209f1.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

export-and-sign/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ describe("Decryption Key Override", () => {
944944
});
945945

946946
afterEach(() => {
947-
// Reset module-level injectedDecryptionKey
947+
// Reset module-level injectedEmbeddedKey
948948
onResetToDefaultEmbeddedKey("cleanup");
949949
jest.useRealTimers();
950950
jest.restoreAllMocks();

export-and-sign/src/event-handlers.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import * as nobleHashes from "@noble/hashes/sha512";
66
// Persist keys in memory via mapping of { address --> pk }
77
let inMemoryKeys = {};
88

9-
// Injected decryption key -- held in memory only, never persisted.
9+
// Injected embedded key -- held in memory only, never persisted.
1010
// When set, decryptBundle uses this P-256 JWK instead of the iframe's embedded key.
11-
let injectedDecryptionKey = null;
11+
let injectedEmbeddedKey = null;
1212

1313
export const DEFAULT_TTL_MILLISECONDS = 1000 * 24 * 60 * 60; // 24 hours or 86,400,000 milliseconds
1414

@@ -95,9 +95,9 @@ async function decryptBundle(bundle, organizationId, HpkeDecrypt) {
9595
);
9696
const ciphertextBuf = TKHQ.uint8arrayFromHexString(signedData.ciphertext);
9797

98-
// Use the injected decryption key if available, otherwise fall back to the embedded key
98+
// Use the injected embedded key if available, otherwise fall back to the embedded key
9999
const receiverPrivJwk =
100-
injectedDecryptionKey || (await TKHQ.getEmbeddedKey());
100+
injectedEmbeddedKey || (await TKHQ.getEmbeddedKey());
101101
return await HpkeDecrypt({
102102
ciphertextBuf,
103103
encappedKeyBuf,
@@ -363,18 +363,18 @@ async function onSetEmbeddedKeyOverride(
363363
const keyJwk = await rawP256PrivateKeyToJwk(new Uint8Array(keyBytes));
364364

365365
// Store in module-level variable (memory only)
366-
injectedDecryptionKey = keyJwk;
366+
injectedEmbeddedKey = keyJwk;
367367

368368
TKHQ.sendMessageUp("EMBEDDED_KEY_OVERRIDE_SET", true, requestId);
369369
}
370370

371371
/**
372372
* Handler for RESET_TO_DEFAULT_EMBEDDED_KEY events.
373-
* Clears the embedded decryption key from memory, replacing it with the iframe's default embedded key.
373+
* Clears the embedded key from memory, replacing it with the iframe's default embedded key.
374374
* @param {string} requestId
375375
*/
376376
function onResetToDefaultEmbeddedKey(requestId) {
377-
injectedDecryptionKey = null;
377+
injectedEmbeddedKey = null;
378378
TKHQ.sendMessageUp("RESET_TO_DEFAULT_EMBEDDED_KEY", true, requestId);
379379
}
380380

0 commit comments

Comments
 (0)