From 199c19ea8512dfcea90767b13e786a382d86f9a7 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Thu, 23 Jan 2025 11:02:35 +0000 Subject: [PATCH] test: add test for deterministic encryption key --- tests/specs/onboarding/onboarding.spec.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/specs/onboarding/onboarding.spec.ts b/tests/specs/onboarding/onboarding.spec.ts index 94979157267..e1c44752864 100644 --- a/tests/specs/onboarding/onboarding.spec.ts +++ b/tests/specs/onboarding/onboarding.spec.ts @@ -101,4 +101,27 @@ test.describe('Onboarding an existing user', () => { }); }); }); + + // Functionality is important for backwards compatibility with older wallet versions + test.describe('Encryption key values', () => { + test.beforeEach(async ({ extensionId, globalPage, onboardingPage }) => { + await globalPage.setupAndUseApiCalls(extensionId); + await onboardingPage.signInWithTestAccount(extensionId); + }); + + test('that the encryption key is generated correctly against a known working value', async ({ + globalPage, + }) => { + const encryptionKey = await globalPage.page.evaluate(async () => { + const { encryptionKey } = await chrome.storage.session.get('encryptionKey'); + return encryptionKey; + }); + + test + .expect(encryptionKey) + .toEqual( + 'd904f412b8d116540017c302f3f7033813c95902af5a067c7befcc34fa5e5290709f157f80548603a1e4f8edc2c0d5d7' + ); + }); + }); });