## 0.25.4

- The PBKDF2Salt is no longer corrupted when attempting replication while the device is offline (#686)
This commit is contained in:
vorotamoroz
2025-07-29 12:45:28 +01:00
parent 3dccf2076f
commit f94653e60e
2 changed files with 7 additions and 3 deletions

Submodule src/lib updated: 6a8d1738bb...a5ac735c6f

View File

@@ -32,6 +32,7 @@ import { EVENT_FILE_SAVED, EVENT_SETTING_SAVED, eventHub } from "../../common/ev
import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator"; import type { LiveSyncAbstractReplicator } from "../../lib/src/replication/LiveSyncAbstractReplicator";
import { globalSlipBoard } from "../../lib/src/bureau/bureau"; import { globalSlipBoard } from "../../lib/src/bureau/bureau";
import { $msg } from "../../lib/src/common/i18n"; import { $msg } from "../../lib/src/common/i18n";
import { clearHandlers } from "../../lib/src/replication/SyncParamsHandler";
const KEY_REPLICATION_ON_EVENT = "replicationOnEvent"; const KEY_REPLICATION_ON_EVENT = "replicationOnEvent";
const REPLICATION_ON_EVENT_FORECASTED_TIME = 5000; const REPLICATION_ON_EVENT_FORECASTED_TIME = 5000;
@@ -66,6 +67,8 @@ export class ModuleReplicator extends AbstractModule implements ICoreModule {
this.core.replicator = replicator; this.core.replicator = replicator;
this._replicatorType = this.settings.remoteType; this._replicatorType = this.settings.remoteType;
await yieldMicrotask(); await yieldMicrotask();
// Clear any existing sync parameter handlers (means clearing key-deriving salt).
clearHandlers();
return true; return true;
} }
@@ -88,8 +91,9 @@ export class ModuleReplicator extends AbstractModule implements ICoreModule {
async $everyBeforeReplicate(showMessage: boolean): Promise<boolean> { async $everyBeforeReplicate(showMessage: boolean): Promise<boolean> {
// Checking salt // Checking salt
if (!(await this.ensureReplicatorPBKDF2Salt(showMessage))) { // Showing message is false: that because be shown here. (And it is a fatal error, no way to hide it).
Logger("Failed to ensure PBKDF2 salt for replication.", LOG_LEVEL_NOTICE); if (!(await this.ensureReplicatorPBKDF2Salt(false))) {
Logger("Failed to initialise the encryption key, preventing replication.", LOG_LEVEL_NOTICE);
return false; return false;
} }
await this.loadQueuedFiles(); await this.loadQueuedFiles();