element-web/src
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
accessibility
actions
async-components/views/dialogs
audio
autocomplete
components
contexts
customisations
dispatcher
editor
effects
emojipicker
events
hooks
i18n/strings
indexing
integrations
mjolnir
models
modules
notifications
performance
rageshake
resizer
settings
slash-commands
stores
toasts
usercontent
utils Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
voice-broadcast
widgets
workers
AddThreepid.ts
AsyncWrapper.tsx
Avatar.ts
BasePlatform.ts Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
BlurhashEncoder.ts
ContentMessages.ts
DateUtils.ts
DecryptionFailureTracker.ts
DeviceListener.ts
Editing.ts
HtmlUtils.tsx
IConfigOptions.ts
IdentityAuthClient.tsx
ImageUtils.ts
KeyBindingsDefaults.ts
KeyBindingsManager.ts
Keyboard.ts
LegacyCallHandler.tsx
Lifecycle.ts Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
Linkify.tsx
Livestream.ts
Login.ts
Markdown.ts
MatrixClientPeg.ts Element-R: pass pickleKey in as raw key for indexeddb encryption (#12543) 2024-06-05 08:52:28 +00:00
MediaDeviceHandler.ts
Modal.tsx
NodeAnimator.tsx
Notifier.ts
PageTypes.ts
PasswordReset.ts
PlatformPeg.ts
PlaybackEncoder.ts
PosthogAnalytics.ts
PosthogTrackers.ts
Presence.ts
Registration.tsx
Resend.ts
Roles.ts
RoomAliasCache.ts
RoomInvite.tsx
RoomNotifs.ts
Rooms.ts
ScalarAuthClient.ts
ScalarMessaging.ts
SdkConfig.ts
Searching.ts
SecurityManager.ts
SendHistoryManager.ts
SlashCommands.tsx
SlidingSyncManager.ts
Terms.ts
TextForEvent.tsx
Typeguards.ts
Unread.ts
UserActivity.ts
UserAddress.ts
Views.ts
VoipUserMapper.ts
WhoIsTyping.ts
WorkerManager.ts
boundThreepids.ts
call-types.ts
createRoom.ts
email.ts
identifiers.ts
index.ts
languageHandler.tsx
linkify-matrix.ts
phonenumber.ts
sendTimePerformanceMetrics.ts
sentry.ts
shouldHideEvent.ts
theme.ts
verification.ts