Skip to content

Commit 5d50e05

Browse files
committed
prettier
1 parent 45c6da4 commit 5d50e05

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

export-and-sign/index.test.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,11 @@ describe("Encryption Escrow", () => {
11851185

11861186
// Signing should fail (key not in memory)
11871187
try {
1188-
await onSignTransaction(requestId, serializedTransaction, "wallet-addr-1");
1188+
await onSignTransaction(
1189+
requestId,
1190+
serializedTransaction,
1191+
"wallet-addr-1"
1192+
);
11891193
} catch (e) {
11901194
expect(e.toString()).toContain("key bytes not found");
11911195
}
@@ -1219,9 +1223,7 @@ describe("Encryption Escrow", () => {
12191223
callCount++;
12201224
if (callCount === 1) {
12211225
// First call: decrypting the escrow key bundle -> returns JWK bytes
1222-
return Promise.resolve(
1223-
mockEscrowKeyBytes
1224-
);
1226+
return Promise.resolve(mockEscrowKeyBytes);
12251227
}
12261228
// Subsequent calls: decrypting wallet bundles -> returns key bytes
12271229
return Promise.resolve(new Uint8Array(64).fill(9));
@@ -1253,9 +1255,7 @@ describe("Encryption Escrow", () => {
12531255
});
12541256

12551257
it("handles empty localStorage gracefully", async () => {
1256-
const HpkeDecryptMock = jest.fn().mockResolvedValue(
1257-
mockEscrowKeyBytes
1258-
);
1258+
const HpkeDecryptMock = jest.fn().mockResolvedValue(mockEscrowKeyBytes);
12591259

12601260
await onInjectDecryptionKeyBundle(
12611261
requestId,
@@ -1299,9 +1299,7 @@ describe("Encryption Escrow", () => {
12991299
callCount++;
13001300
if (callCount === 1) {
13011301
// First call: escrow key
1302-
return Promise.resolve(
1303-
mockEscrowKeyBytes
1304-
);
1302+
return Promise.resolve(mockEscrowKeyBytes);
13051303
}
13061304
// Fail for the second wallet bundle (callCount 3 = wallet2-bad)
13071305
if (callCount === 3) {
@@ -1579,9 +1577,7 @@ describe("Encryption Escrow", () => {
15791577
const HpkeDecryptMock = jest.fn().mockImplementation(() => {
15801578
callCount++;
15811579
if (callCount === 1) {
1582-
return Promise.resolve(
1583-
mockEscrowKeyBytes
1584-
);
1580+
return Promise.resolve(mockEscrowKeyBytes);
15851581
}
15861582
return Promise.resolve(new Uint8Array(64).fill(9));
15871583
});

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,12 @@ async function onStoreEncryptedBundle(
388388
receiverPrivJwk: decryptionKey,
389389
});
390390

391-
await loadKeyIntoMemory(address, keyBytes, resolvedKeyFormat, organizationId);
391+
await loadKeyIntoMemory(
392+
address,
393+
keyBytes,
394+
resolvedKeyFormat,
395+
organizationId
396+
);
392397
}
393398

394399
TKHQ.sendMessageUp("ENCRYPTED_BUNDLE_STORED", true, requestId);
@@ -453,16 +458,10 @@ async function onInjectDecryptionKeyBundle(
453458
) {
454459
// Decrypt the private key using the iframe's embedded key.
455460
// The decrypted payload is a raw 32-byte P-256 private key scalar.
456-
const keyBytes = await decryptBundle(
457-
bundle,
458-
organizationId,
459-
HpkeDecrypt
460-
);
461+
const keyBytes = await decryptBundle(bundle, organizationId, HpkeDecrypt);
461462

462463
// Convert raw P-256 bytes to a full JWK (derives public key via WebCrypto)
463-
const keyJwk = await rawP256PrivateKeyToJwk(
464-
new Uint8Array(keyBytes)
465-
);
464+
const keyJwk = await rawP256PrivateKeyToJwk(new Uint8Array(keyBytes));
466465

467466
// Store in module-level variable (memory only)
468467
decryptionKey = keyJwk;
@@ -851,9 +850,7 @@ function initMessageEventListener(HpkeDecrypt) {
851850
}
852851
}
853852
if (event.data && event.data["type"] == "INJECT_DECRYPTION_KEY_BUNDLE") {
854-
TKHQ.logMessage(
855-
`⬇️ Received message ${event.data["type"]}`
856-
);
853+
TKHQ.logMessage(`⬇️ Received message ${event.data["type"]}`);
857854
try {
858855
await onInjectDecryptionKeyBundle(
859856
event.data["requestId"],

0 commit comments

Comments
 (0)