Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactNative / Expo 42 - Sending encrypted messages is not reliable #1800

Closed
ppulwey opened this issue Jul 20, 2021 · 10 comments
Closed

ReactNative / Expo 42 - Sending encrypted messages is not reliable #1800

ppulwey opened this issue Jul 20, 2021 · 10 comments

Comments

@ppulwey
Copy link

ppulwey commented Jul 20, 2021

Describe the bug
It took me a few days to get the SDK running with ReactNative (Expo) with E2EE ... more or less-
Sometimes it works, sometimes not. I cannot figure out the circumstances when it is working. It seems when you wait long enough for the devices to do "things" you can send encrypted messages.

But I always receive the following error message:

Caught /sync error, decryptCriticalEvents@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:176668:34
_callee$@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:176105:53
tryCatch@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:28807:23
invoke@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:28980:32
tryCatch@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:28807:23
invoke@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:28880:30
http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:28890:21
tryCallOne@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3779:16
http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3880:27
_callTimer@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:30836:17
_callImmediatesPass@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:30875:17
callImmediates@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:31092:33
__callImmediates@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3067:35
http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:2853:34
__guard@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:3050:15
flushedQueue@http://192.168.178.27:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&minify=false:2852:21
flushedQueue@[native code]
callFunctionReturnFlushedQueue@[native code]
at node_modules/matrix-js-sdk/lib/sync.js:814:6 in SyncApi#_sync
at [native code]:null in flushedQueue
at [native code]:null in callFunctionReturnFlushedQueue

And sometimes

Error decrypting event (id=$0qJW5-z2MB2XsvoTBdSklFBaxgx5khWOgsYcEjAhM6c): DecryptionError[msg: The sender's device has not sent us the keys for this message., session: L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q|2okH9d3T1rya7mJLZY8MM8Bqe1MkjFrkkrgIfddtid4]
at node_modules/matrix-js-sdk/lib/models/event.js:587:8 in MatrixEvent#decryptionLoop
at [native code]:null in flushedQueue
at [native code]:null in callFunctionReturnFlushedQueue

It is really frustrating that there is no working example on how to implement. "Go and have a look in fluffy chat" is really not enough.

I've spend days searching the internet and looking into the SDK source code to find a path through the jungle but it seems there is no way out.

I would be very grateful for help. I would also like to show my appreciation if someone can help me. But it can not go on like this.

To Reproduce

  1. Install Expo Client
  2. Have a Matrix Server with two accounts
  3. Clone repo from https://github.com/ppulwey/matrix-expo
  4. yarn
  5. Change const [joinedRoomId, setJoinedRoomId] = useState<string>( "!gmKoGceSQXuFtkresp:my.matrix.host" ); to a valid room id
  6. expo r
  7. login with two devices in different accounts
  8. Join same room
  9. Try to send messages

Expected behavior
Encrypted messages are sent reliably

Smartphone (please complete the following information):

  • Device: [Iphone 12 pro; Xiaomi Redmi]
  • OS: [e.g. iOS14.x, Android ?]
@Electrofenster
Copy link

@ppulwey any news on this? I stuck at the same point.

@ppulwey
Copy link
Author

ppulwey commented Aug 26, 2021

@Electrofenster we Switched to implementing things on our own. The SDK will be a good choice for web apps but not RN.
We skipped the matrix encryption for now and try the first steps with our own solution.
Take a look at the client server api. You need just a few http calls to get things running. It's not to hard except the encryption.

The SDK developers seem to care only for simple problems. The real nuts seem to be ignored. Tried it also on the matrix channel (hrhrhr) but same ignorance there 🤷‍♂️

@Electrofenster
Copy link

@ppulwey Yesterday I got the encryption runnig on RN with the matrix-js-sdk. I can send and read the messages in encrypted channels.
Is there any reason why there is no official SDK for RN?

@ppulwey
Copy link
Author

ppulwey commented Aug 28, 2021

@Electrofenster Did you do anything special to get encryption running?
Idk why there is no official implementation. I needed a lot of poly fills to get it running. This feels so unclean.

@Electrofenster
Copy link

@ppulwey yes. I used a few more functions that I found across tickets in GitHub.
As I understood it right, it has something to do with the deviceId which is needed for the second createClient from the response (response.device_id) from the first login with username & password.

As second thing I must remove the cryptoStore option from the second createClient-call, because olm/crypto want to call functions that doesn't exist. Without these option it used the builtin methods I guess.

the payload for the second createClient function looks like this:

const payload = {
  userId: response.user_id,
  accessToken: response.access_token,
  homeserver: BASE_URL,
  deviceId: response.device_id,
  crypto: true,
  baseUrl: BASE_URL,
  timelineSupport: true,
  store: new sdk.MemoryStore({localStorage: AsyncStorage}),
  sessionStore: {
    getLocalTrustedBackupPubKey: () => null,
  },
};

I used this two functions before loading messages of a (encrypted)room:

useEffect(() => {
 autoVerify(client, room.roomId, client.deviceId).then(() => {
   console.log('VERIFIED');
 });
}, [client, room.roomId]);

because I don't know where I found these functions I can't link it, but here's the source:

export const autoVerify = async (client, room_id, deviceId) => {
  console.log('AUTO_VERIFY');

  let room = client.getRoom(room_id);
  const e2eMembers = await room.getEncryptionTargetMembers();
  for (const member of e2eMembers) {
    const devices = client.getStoredDevicesForUser(member.userId);
    for (const device of devices) {
      if (device.isUnverified()) {
        console.log(`DEVICE_ID -> ${deviceId}`);
        console.log({device});
        await verifyDevice(client, member.userId, device.deviceId);
      }
    }
  }
};

export async function verifyDevice(client, userId, deviceId) {
  if (!userId || typeof userId !== 'string') {
    throw new Error('"userId" is required and must be a string.');
  }
  if (!deviceId || typeof deviceId !== 'string') {
    throw new Error('"deviceId" is required and must be a string.');
  }
  await client.setDeviceKnown(userId, deviceId, true);
  await client.setDeviceVerified(userId, deviceId, true);
}

I changed the deviceId in autoVerify to the one from client.deviceId. In the original source, the code get's the deviceId from a other variable. But the value was not the same, so I changed it. After that I guess, it worked.

Maybe I could share a minimal repo with setup to use it because it's really hard to setup.

FYI: You need to add a verification process after login to load old messages from a encrypted room.
For more look here: https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/components/structures/MatrixChat.tsx#L426

@King-Mob
Copy link

King-Mob commented Sep 5, 2021

@Electrofenster a minimal repo with setup would be extremely useful

@ppulwey
Copy link
Author

ppulwey commented Nov 9, 2021

@Electrofenster Have you proceed with your work? After a while I came back to the SDK giving it a try again.
I'm now able to set up encryption correctly. When I create a new room, the logs say the following:

EventTimelineSet.addLiveEvent: ignoring duplicate event $nnmNzWsGTeK3sbHdwkXwk4Ww7COE-iYrZ_OhkvNfd58
Marking device list outdated for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de
Starting key download for Array [
  "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
]
got device keys for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de: Object {
  "IBKJWVOCPE": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "IBKJWVOCPE",
    "keys": Object {
      "curve25519:IBKJWVOCPE": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:IBKJWVOCPE": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:IBKJWVOCPE": "c3TxuHe/eOehwHGgBHEAqf/bWNf7+Y9DVrd5JZbVZehIkDChLcNvslclk05QtDFHuZuDsCi53N2r8OrODf/PBA",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
  "LFBEDVVJJR": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "LFBEDVVJJR",
    "keys": Object {
      "curve25519:LFBEDVVJJR": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:LFBEDVVJJR": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:LFBEDVVJJR": "A1YmvlyYgC/tFFxslhnYab3NYLtleKQUH02UAlBlV1bUtkENtZtF8NyCL8d130aID/AjNPbxiGnuBSCeOV+XCg",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
  "UPDKLNJCCC": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "UPDKLNJCCC",
    "keys": Object {
      "curve25519:UPDKLNJCCC": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:UPDKLNJCCC": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:UPDKLNJCCC": "qLbOwZ24ZAx7k+0XClnRZNs+/bScjjhp24wc/LTJYdbKxhuMvtgL+cpHDEAWh5DXnCY1SB1KvoKMtcC0XpMUBw",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
}
got cross-signing keys for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de: Object {
  "master": undefined,
  "self_signing": undefined,
  "user_signing": undefined,
}
Completed key download for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de
Device list for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de now up to date
Saving device tracking data s6119_60244_0_168_60_126_221_12060_1
Room create result {
  "room_id": "!VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de"
}
Enabling encryption in !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de; starting to track device lists for all users therein
Starting to track devices for room !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de ...
downloadKeys: already have all necessary keys
Own device LFBEDVVJJR marked verified: signing
No self signing key: not signing device
Checking key backup status...
Own device UPDKLNJCCC marked verified: signing
No self signing key: not signing device
Checking key backup status...
Own device IBKJWVOCPE marked verified: signing
No self signing key: not signing device
Checking key backup status...
Invite event for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de in !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de
Marking device list outdated for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de
Starting key download for Array [
  "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
]
Key backup is absent or missing required data
No usable key backup: not enabling key backup
Key backup is absent or missing required data
No usable key backup: not enabling key backup
Key backup is absent or missing required data
No usable key backup: not enabling key backup
got device keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "XOTTFQACGO": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "XOTTFQACGO",
    "keys": Object {
      "curve25519:XOTTFQACGO": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:XOTTFQACGO": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de": Object {
        "ed25519:XOTTFQACGO": "V+LMc02nrG1QohAwVx9GY5nDuS/Tmwt85HAZl6uXpunwrqFt/A5CAk+eQcBzvTKyhI49Ron40TI2ysL/8e95Dg",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
  },
}
got cross-signing keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "master": undefined,
  "self_signing": undefined,
  "user_signing": undefined,
}
Completed key download for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de
Device list for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de now up to date
Enabling encryption in !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de; starting to track device lists for all users therein
Starting to track devices for room !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de ...
Join event for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de in !VcJzjIHWXnryVuDAXt:matrix-dev.blackpin.de
Marking device list outdated for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de
Starting key download for Array [
  "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
]
got device keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "XOTTFQACGO": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "XOTTFQACGO",
    "keys": Object {
      "curve25519:XOTTFQACGO": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:XOTTFQACGO": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de": Object {
        "ed25519:XOTTFQACGO": "V+LMc02nrG1QohAwVx9GY5nDuS/Tmwt85HAZl6uXpunwrqFt/A5CAk+eQcBzvTKyhI49Ron40TI2ysL/8e95Dg",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
  },
}
got cross-signing keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "master": undefined,
  "self_signing": undefined,
  "user_signing": undefined,
}
Completed key download for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de
Device list for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de now up to date
EventTimelineSet.addLiveEvent: ignoring duplicate event $b33LGTaQ_VlJ6fsj7ZLjBonPEngIw5D1OcdbmibdTJc
Marking device list outdated for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de
Marking device list outdated for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de
Starting key download for Array [
  "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
  "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
]
got device keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "XOTTFQACGO": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "XOTTFQACGO",
    "keys": Object {
      "curve25519:XOTTFQACGO": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:XOTTFQACGO": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de": Object {
        "ed25519:XOTTFQACGO": "V+LMc02nrG1QohAwVx9GY5nDuS/Tmwt85HAZl6uXpunwrqFt/A5CAk+eQcBzvTKyhI49Ron40TI2ysL/8e95Dg",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de",
  },
}
got cross-signing keys for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de: Object {
  "master": undefined,
  "self_signing": undefined,
  "user_signing": undefined,
}
got device keys for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de: Object {
  "IBKJWVOCPE": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "IBKJWVOCPE",
    "keys": Object {
      "curve25519:IBKJWVOCPE": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:IBKJWVOCPE": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:IBKJWVOCPE": "c3TxuHe/eOehwHGgBHEAqf/bWNf7+Y9DVrd5JZbVZehIkDChLcNvslclk05QtDFHuZuDsCi53N2r8OrODf/PBA",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
  "LFBEDVVJJR": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "LFBEDVVJJR",
    "keys": Object {
      "curve25519:LFBEDVVJJR": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:LFBEDVVJJR": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:LFBEDVVJJR": "A1YmvlyYgC/tFFxslhnYab3NYLtleKQUH02UAlBlV1bUtkENtZtF8NyCL8d130aID/AjNPbxiGnuBSCeOV+XCg",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
  "UPDKLNJCCC": Object {
    "algorithms": Array [
      "m.olm.v1.curve25519-aes-sha2",
      "m.megolm.v1.aes-sha2",
    ],
    "device_id": "UPDKLNJCCC",
    "keys": Object {
      "curve25519:UPDKLNJCCC": "L+V9o0fNYkMVKNqsX7spBzD/9oSvxM/C7ZCZX1jLO3Q",
      "ed25519:UPDKLNJCCC": "O2onvM62pC1io6jQKm8Nc2UyFXcd4kOmOsBIoYtZ2ik",
    },
    "signatures": Object {
      "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de": Object {
        "ed25519:UPDKLNJCCC": "qLbOwZ24ZAx7k+0XClnRZNs+/bScjjhp24wc/LTJYdbKxhuMvtgL+cpHDEAWh5DXnCY1SB1KvoKMtcC0XpMUBw",
      },
    },
    "unsigned": Object {},
    "user_id": "@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de",
  },
}
got cross-signing keys for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de: Object {
  "master": undefined,
  "self_signing": undefined,
  "user_signing": undefined,
}
Completed key download for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de,@138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de
Device list for @138_bbd2df63d3d04003ad5b790acb3e19be:matrix-dev.blackpin.de now up to date
Device list for @138_5dec115756e44e9d863664631dd93154:matrix-dev.blackpin.de now up to date
Saving device tracking data s6125_60244_0_168_60_126_221_12060_1
Saving device tracking data s6125_60244_0_168_60_126_221_12060_1

Various devices can decrypt encrypted messages only after they themselves have written a message in the room. What could be the reason for this?
Also, I am missing a wrapper for the cryptoStore in ICreateClientOpts. Is there already a solution for the AsyncStorage here?

@Electrofenster
Copy link

@ppulwey nope, but maybe I could create a sample project on this weekend. A good point to know how it is done in the matrix-react-sdk. They have a lot of great ideas how it works and how it could be done on react-native.

For your problem:

EventTimelineSet.addLiveEvent: ignoring duplicate event $nnmNzWsGTeK3sbHdwkXwk4Ww7COE-iYrZ_OhkvNfd58

It could be the cross-signing problem. You need to verify the devices after you login.
For example:

  • you login to your matrix-server with riot and create a encrypted room
  • riot creates cross-singing in the background
  • when you log in with the same account on react-native you need to verify the new device (react-native) with the other session. It could be done with emoji or security-key/passphrase. But you need to set it up correctly.

On android we've a lot of performance problems after logging in (with SSO over an IDP as Google, Okta, Auth0, ...) and loading the chat for the first time. Also we've the problem, that only a few messages are decrypted after entering a room.
But I think this and the performance problems should be possible to fix.

Currently I'm on the restoring process of the backup with a security key and it's pure pain. 😅

Various devices can decrypt encrypted messages only after they themselves have written a message in the room. What could be the reason for this?

Are you verifying each device with your device (react-native) when you enter the room? I think this could be the problem.

Also, I am missing a wrapper for the cryptoStore in ICreateClientOpts. Is there already a solution for the AsyncStorage here?

There is nothing good out there. We used the one from ditto-chat and modified it a bit to add the missing functions.

@ppulwey
Copy link
Author

ppulwey commented Nov 10, 2021

@Electrofenster Thank you for your reply. I'm "happy" that other have the same obstacles in their way. I will try what you've pointed out.
Do you see a chance that we can get in direct contact? If so please send me an email to patrick.pulwey@cloudbucket.de.

@marek-lach
Copy link

A look at an alternative implementation of ed25519 may be useful for reference here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants