From f94653e60e7b31a7c12bfe82b3d63c487cc432e3 Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Tue, 29 Jul 2025 12:45:28 +0100 Subject: [PATCH] ## 0.25.4 - The PBKDF2Salt is no longer corrupted when attempting replication while the device is offline (#686) --- src/lib | 2 +- src/modules/core/ModuleReplicator.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib b/src/lib index 6a8d173..a5ac735 160000 --- a/src/lib +++ b/src/lib @@ -1 +1 @@ -Subproject commit 6a8d1738bb47fcfd2232bbefc5ca7cadd6bfe6cc +Subproject commit a5ac735c6f69296c7691c7eb543ebc44ea3bdced diff --git a/src/modules/core/ModuleReplicator.ts b/src/modules/core/ModuleReplicator.ts index dac19d2..17ade8f 100644 --- a/src/modules/core/ModuleReplicator.ts +++ b/src/modules/core/ModuleReplicator.ts @@ -32,6 +32,7 @@ import { EVENT_FILE_SAVED, EVENT_SETTING_SAVED, eventHub } from "../../common/ev import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator"; import { globalSlipBoard } from "../../lib/src/bureau/bureau"; import { $msg } from "../../lib/src/common/i18n"; +import { clearHandlers } from "../../lib/src/replication/SyncParamsHandler"; const KEY_REPLICATION_ON_EVENT = "replicationOnEvent"; const REPLICATION_ON_EVENT_FORECASTED_TIME = 5000; @@ -66,6 +67,8 @@ export class ModuleReplicator extends AbstractModule implements ICoreModule { this.core.replicator = replicator; this._replicatorType = this.settings.remoteType; await yieldMicrotask(); + // Clear any existing sync parameter handlers (means clearing key-deriving salt). + clearHandlers(); return true; } @@ -88,8 +91,9 @@ export class ModuleReplicator extends AbstractModule implements ICoreModule { async $everyBeforeReplicate(showMessage: boolean): Promise { // Checking salt - if (!(await this.ensureReplicatorPBKDF2Salt(showMessage))) { - Logger("Failed to ensure PBKDF2 salt for replication.", LOG_LEVEL_NOTICE); + // Showing message is false: that because be shown here. (And it is a fatal error, no way to hide it). + if (!(await this.ensureReplicatorPBKDF2Salt(false))) { + Logger("Failed to initialise the encryption key, preventing replication.", LOG_LEVEL_NOTICE); return false; } await this.loadQueuedFiles();