Fixed cinny verified device failed to verify other
authorAjay Bura <ajbura@gmail.com>
Sun, 8 May 2022 06:25:41 +0000 (11:55 +0530)
committerAjay Bura <ajbura@gmail.com>
Sun, 8 May 2022 06:25:41 +0000 (11:55 +0530)
src/app/organisms/emoji-verification/EmojiVerification.jsx

index 72b936397810a1b123fade58e404c8979efb4404..8f08c4893f2da8fbc0f1c663f70322f40e8a3ac8 100644 (file)
@@ -28,7 +28,10 @@ function EmojiVerificationContent({ data, requestClose }) {
   const mountStore = useStore();
 
   const beginVerification = async () => {
-    if (mx.getCrossSigningId() === null && isCrossVerified(mx.deviceId)) {
+    if (
+      isCrossVerified(mx.deviceId)
+      && (mx.getCrossSigningId() === null || await mx.crypto.crossSigningInfo.isStoredInKeyCache('self_signing') === false)
+    ) {
       if (!hasPrivateKey(getDefaultSSKey())) {
         const keyData = await accessSecretStorage('Emoji verification');
         if (!keyData) {
@@ -66,10 +69,13 @@ function EmojiVerificationContent({ data, requestClose }) {
   useEffect(() => {
     mountStore.setItem(true);
     const handleChange = () => {
+      if (request.done || request.cancelled) {
+        requestClose();
+        return;
+      }
       if (targetDevice && request.started) {
         beginVerification();
       }
-      if (request.done || request.cancelled) requestClose();
     };
 
     if (request === null) return null;
@@ -77,7 +83,7 @@ function EmojiVerificationContent({ data, requestClose }) {
     req.on('change', handleChange);
     return () => {
       req.off('change', handleChange);
-      if (!req.cancelled && !req.done) {
+      if (req.cancelled === false && req.done === false) {
         req.cancel();
       }
     };