ソースを参照

Fix reuse of init parameters (again) (#988)

The determined init parameters needed to be stored and updated later
Lennart Grahl 5 年 前
コミット
35277e2177
1 ファイル変更10 行追加5 行削除
  1. 10 5
      src/services/webclient.ts

+ 10 - 5
src/services/webclient.ts

@@ -466,11 +466,6 @@ export class WebClientService {
         if (flags.reuseKeyStoreAndTrustedKey) {
             keyStore = this.initParameters.keyStore;
             peerTrustedKey = this.initParameters.peerTrustedKey;
-        } else {
-            this.initParameters = {
-                keyStore: keyStore,
-                peerTrustedKey: peerTrustedKey,
-            };
         }
         this.log.info(`Initializing (keyStore=${keyStore !== undefined ? 'yes' : 'no'}, peerTrustedKey=` +
         `${peerTrustedKey !== undefined ? 'yes' : 'no'}, reuseKeyStoreAndTrustedKey=` +
@@ -564,6 +559,12 @@ export class WebClientService {
         this.arpLog.info('Public key:', this.salty.permanentKeyHex);
         this.arpLogV.debug('Auth token:', this.salty.authTokenHex);
 
+        // Store determined init parameters
+        this.initParameters = {
+            keyStore: keyStore,
+            peerTrustedKey: peerTrustedKey,
+        };
+
         // We want to know about state changes
         this.salty.on('state-change', (ev: saltyrtc.SaltyRTCEvent) => {
             const state: saltyrtc.SignalingState = ev.data;
@@ -585,6 +586,10 @@ export class WebClientService {
                         }
                         break;
                     case 'task':
+                        // Update stored trusted key of the peer
+                        this.initParameters.peerTrustedKey = this.salty.peerPermanentKeyBytes;
+
+                        // Task established
                         this.onTaskEstablished(resumeSession);
                         break;
                     case 'closing':