Browse Source

omemo: Publish bundle before publishing the device

Otherwise we run into a race condition where the contact's client, upon
receiving a PEP message with the new device, tries to fetch the bundle
before it's been published.

Updates #3769
JC Brand 1 month ago
parent
commit
e7fd4fd62b
2 changed files with 13 additions and 4 deletions
  1. 1 1
      src/headless/plugins/omemo/api.js
  2. 12 3
      src/types/plugins/omemo-views/fingerprints.d.ts

+ 1 - 1
src/headless/plugins/omemo/api.js

@@ -86,10 +86,10 @@ export default {
                 // Generate new device bundle and publish
                 // https://xmpp.org/extensions/attic/xep-0384-0.3.0.html#usecases-announcing
                 await omemo_store.generateBundle();
-                await devicelist.publishDevices();
                 const device = devicelist.devices.get(omemo_store.get('device_id'));
                 const fp = generateFingerprint(device);
                 await omemo_store.publishBundle();
+                await devicelist.publishDevices();
                 return fp;
             },
         },

+ 12 - 3
src/types/plugins/omemo-views/fingerprints.d.ts

@@ -3,15 +3,24 @@ export class Fingerprints extends CustomElement {
         jid: {
             type: StringConstructor;
         };
+        show_inactive_devices: {
+            type: BooleanConstructor;
+            state: boolean;
+        };
     };
     jid: any;
+    show_inactive_devices: boolean;
     initialize(): Promise<void>;
     devicelist: any;
     render(): import("lit-html").TemplateResult<1> | "";
     /**
-        * @param {Event} ev
-        */
+     * @param {Event} ev
+     */
     toggleDeviceTrust(ev: Event): void;
+    /**
+     * @param {Event} ev
+     */
+    toggleShowInactiveDevices(ev: Event): void;
 }
-import { CustomElement } from "shared/components/element.js";
+import { CustomElement } from 'shared/components/element.js';
 //# sourceMappingURL=fingerprints.d.ts.map