diff --git a/playwright/e2e/crypto/utils.ts b/playwright/e2e/crypto/utils.ts index c1afa49570f..0f87876b7c3 100644 --- a/playwright/e2e/crypto/utils.ts +++ b/playwright/e2e/crypto/utils.ts @@ -139,14 +139,14 @@ export async function checkDeviceIsCrossSigned(app: ElementAppPage): Promise { // Sanity check the given backup version: if it's null, something went wrong earlier in the test. if (!expectedBackupVersion) { @@ -160,20 +160,18 @@ export async function checkDeviceIsConnectedKeyBackup( if (!crypto) return; const backupInfo = await crypto.getKeyBackupInfo(); - const backupKeyStored = Boolean(await client.isKeyBackupKeyStored()); - const backupKeyFromCache = await crypto.getSessionBackupPrivateKey(); - const backupKeyCached = Boolean(backupKeyFromCache); - const backupKeyWellFormed = backupKeyFromCache instanceof Uint8Array; + const backupKeyIn4S = Boolean(await client.isKeyBackupKeyStored()); + const backupPrivateKeyFromCache = await crypto.getSessionBackupPrivateKey(); const activeBackupVersion = await crypto.getActiveSessionBackupVersion(); - return { backupInfo, backupKeyStored, backupKeyCached, backupKeyWellFormed, activeBackupVersion }; + return { backupInfo, backupPrivateKeyFromCache, backupKeyIn4S, activeBackupVersion }; }); if (!backupData) { - throw new Error("Crypo module is not available"); + throw new Error("Crypto module is not available"); } - const { backupInfo, backupKeyStored, backupKeyCached, backupKeyWellFormed, activeBackupVersion } = backupData; + const { backupInfo, backupKeyIn4S, backupPrivateKeyFromCache, activeBackupVersion } = backupData; // We have a key backup expect(backupInfo).toBeDefined(); @@ -182,13 +180,13 @@ export async function checkDeviceIsConnectedKeyBackup( // The active backup version is as expected expect(activeBackupVersion).toBe(expectedBackupVersion); // The backup key is stored in 4S - expect(backupKeyStored).toBe(true); + expect(backupKeyIn4S).toBe(true); - if (checkBackupKeyInCache) { + if (checkBackupPrivateKeyInCache) { // The backup key is available locally - expect(backupKeyCached).toBe(true); + expect(Boolean(backupPrivateKeyFromCache)).toBe(true); // The backup key is well-formed - expect(backupKeyWellFormed).toBe(true); + expect(backupPrivateKeyFromCache instanceof Uint8Array).toBe(true); } }