-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile: Slow startup when there are many master keys #9331
Comments
Do you know what part of the process makes it slow? Is it because we're decrypting all the master key in startup? |
That seems to be the case. Applying this patch, diff --git a/packages/lib/services/e2ee/utils.ts b/packages/lib/services/e2ee/utils.ts
index 38c04bc0c..cd145023a 100644
--- a/packages/lib/services/e2ee/utils.ts
+++ b/packages/lib/services/e2ee/utils.ts
@@ -141,6 +141,10 @@ export async function loadMasterKeysFromSettings(service: EncryptionService) {
for (let i = 0; i < masterKeys.length; i++) {
const mk = masterKeys[i];
if (service.isMasterKeyLoaded(mk)) continue;
+ if (!masterKeyEnabled(mk)) {
+ logger.info(`Skipping disabled master key.`);
+ continue;
+ }
const password = await findMasterKeyPassword(service, mk);
if (!password) continue; then disabling most master keys (requires additional patching), seems to decrease startup time. Log with all but one key disabled
|
Another option might be to store unlocked master keys encrypted with a library like expo-secure-store. Loading master keys from |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions. |
Operating system
Android
Joplin version
2.13.7
Desktop version info
No response
Current behaviour
Steps to reproduce:
Expected behaviour
Having a large number of master keys (particularly when unused) should not make Joplin slow to start.
On one Android simulator, each master key adds about half of a second to the startup time. On a physical Android device, each master key adds about three seconds to the startup time.
Logs
Below is a modified startup log, with the number of milliseconds since the last log included.
For example,
means that
Database was open successfully
was logged at14:14:36
, and 54 milliseconds after the previous log statement.The part of this relevant to master keys decryption:
The text was updated successfully, but these errors were encountered: