Skip to content

Commit

Permalink
Add comments for manual sync changes in key import flow
Browse files Browse the repository at this point in the history
  • Loading branch information
yashovardhan committed Jun 12, 2024
1 parent c981178 commit 479f667
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ class ThresholdKey implements ITKey {
// provided no importKey is provided ( importKey take precedent )
if (this.serviceProvider.migratableKey && !importKey) {
// importkey from server provider need to be atomic, hence manual sync is required.
const tempStateManualSync = this.manualSync;
this.manualSync = true;
const tempStateManualSync = this.manualSync; // temp store manual sync flag
this.manualSync = true; // Setting this as true since _initializeNewKey has a check where for importkey from server provider need to be atomic, hence manual sync is required.
await this._initializeNewKey({ initializeModules: true, importedKey: this.serviceProvider.migratableKey, delete1OutOf1: true });
if (!tempStateManualSync) await this.syncLocalMetadataTransitions(); // Only sync if we were not in manual sync mode
if (!tempStateManualSync) await this.syncLocalMetadataTransitions(); // Only sync if we were not in manual sync mode, if manual sync is set by developer, they should handle it themselves
// restore manual sync flag
this.manualSync = tempStateManualSync;
} else {
Expand Down

0 comments on commit 479f667

Please sign in to comment.