riot-web/test
Richard van der Hoff 0a01320fca
Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543)
* Element-R: pass pickleKey in as raw key for indexeddb encryption

Currently, we pass the `pickleKey` to the rust library for use as a passphrase
for encrypting its crypto store. The Rust libary then passes that passphrase
through 200000 rounds of PBKDF2 to generate an encryption key, which is
(deliberately) slow.

However, the pickleKey is actually 32 bytes of random data (base64-encoded). By
passing the raw key into the rust library, we can therefore save the PBKDF
operation.

Backwards-compatibility with existing sessions is maintained, because if the
rust library discovers that the store was previously encrypted with a key based
on a PBKDF, it will re-base64 and PBKDF the key we provide, thus reconstructing
the right key.

* Update src/Lifecycle.ts

Co-authored-by: Florian Duros <florianduros@element.io>

* Lifecycle-test: clean up test setup

Rely less on the unit under test for setting up the test preconditions -- not
least because we don't really want to fire up matrix clients and the like
during test setup.

* Factor out "encryptPickleKey" method

For a start it makes it easier to grok what's going on, but also I went to use
this in a test

* Improve tests for `Lifecycle.restoreFromLocalStorage`

---------

Co-authored-by: Florian Duros <florianduros@element.io>
2024-06-05 08:52:28 +00:00
..
@types
__snapshots__
accessibility
actions/handlers
audio Stop using deprecated methods, fields & exports (#12524) 2024-05-15 14:58:28 +00:00
autocomplete
components Close the release announcement when a dialog is opened (#12559) 2024-05-29 07:22:50 +00:00
contexts
dispatcher
editor Use `*` for italics as it doesn't break when used mid-word (#12523) 2024-05-15 09:01:45 +00:00
events
hooks Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
i18n
images
img
models
modules
notifications
settings
setup
stores Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
test-utils Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
toasts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
utils Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
voice-broadcast
widgets
Avatar-test.ts
ContentMessages-test.ts
DecryptionFailureTracker-test.ts Only report undecryptable events once (#12501) 2024-05-20 14:53:50 +00:00
DeviceListener-test.ts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
HtmlUtils-test.tsx
Image-test.ts
KeyBindingsManager-test.ts
LegacyCallHandler-test.ts
Lifecycle-test.ts Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
Markdown-test.ts
MatrixClientPeg-test.ts Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
MediaDeviceHandler-test.ts
Notifier-test.ts
PosthogAnalytics-test.ts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
PreferredRoomVersions-test.ts
Reply-test.ts
RoomNotifs-test.ts
Rooms-test.ts
ScalarAuthClient-test.ts
SdkConfig-test.ts
SecurityManager-test.ts
SlashCommands-test.tsx
SlidingSyncManager-test.ts
Terms-test.tsx
TestSdkContext.ts
TextForEvent-test.ts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
Unread-test.ts
UserActivity-test.ts
WorkerManager-test.ts
createRoom-test.ts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
email-test.ts
globalSetup.ts
languageHandler-test.tsx
linkify-matrix-test.ts
predictableRandom.ts
setupTests.ts
slowReporter.js
submit-rageshake-test.ts Avoid using deprecated exports, fields, and duplicate code (#12555) 2024-05-28 08:41:20 +01:00
theme-test.ts
useTopic-test.tsx