20 Mar 2024 |
Maru | This whole verification dance is really not that simple | 15:57:14 |
juju | I checked only a little bit, The error seems to be raised here in matrix-rust-sdk in element
VerificationLevel::UnsignedDevice => {
// This is a high warning. The sender hasn't verified his own device.
ShieldState::Red { message: UNSIGNED_DEVICE }
}
Which is only called if this returns false
/// Is this device cross signed by its owner?
pub fn is_cross_signed_by_owner(&self) -> bool {
self.device_owner_identity.as_ref().is_some_and(|device_identity| match device_identity {
// If it's one of our own devices, just check that
// we signed the device.
ReadOnlyUserIdentities::Own(identity) => identity.is_device_signed(&self.inner).is_ok(),
// If it's a device from someone else, check
// if the other user has signed this device.
ReadOnlyUserIdentities::Other(device_identity) => {
device_identity.is_device_signed(&self.inner).is_ok()
}
})
}
But I do not know if nio supports such device signing
| 16:11:52 |
Maru | I am testing the verification steps. what I wonder is how do I get an OlmDevice? | 20:35:35 |
Maru | for methods like verify_device | 20:35:46 |
Maru | Can I even access this from AsyncClient? | 20:55:35 |
Paarth Shah - Github Maintainer | In reply to @maru:mike.it-loops.com I am testing the verification steps. what I wonder is how do I get an OlmDevice? In this example code, olm_device is an OlmDevice | 21:06:02 |
Maru | thanks, the devices() method apparently tripped me up | 21:07:06 |
Maru | let me try again with the device_store | 21:07:14 |
Maru | hmm after login this is empty | 21:26:56 |
Maru | Redacted or Malformed Event | 21:32:24 |
Paarth Shah - Github Maintainer | In reply to @maru:mike.it-loops.com hmm after login this is empty you need to sync first. The example code calls trust_devices in a function aptly called after_first_sync : https://github.com/matrix-nio/matrix-nio/blob/81b057f8b5a8882bca3ff69651c7ca35a30ce11d/examples/manual_encrypted_verify.py#L260-L276 | 21:33:35 |
Maru | I did an await asynclient.sync() first | 21:35:43 |
Maru | but let me start from scratch completely | 21:36:04 |
Maru | nope still empty | 21:42:45 |
Maru |
| 21:42:53 |
Maru | * import nio | 21:43:05 |
Maru | * import nio
ac = nio.AsyncClient("server","user",store_path="store")
await ac.login("password")
await ac.sync()
ac.device_store.items()
dict_items([('user1, {}),.....])
| 21:45:13 |
juju | Is your bot in any room? I am guessing it only gets the devices that share a room with it | 21:50:51 |
Maru | I am trying with my account and this one is in several room | 21:52:47 |
Maru | so even after a sync with full_state=True device_store is empty for me. This is really strange | 22:04:28 |
Maru | FOUND IT | 22:09:05 |
Maru | if you run sync() and not sync_forever() you have to call keys_query() as well | 22:09:31 |
21 Mar 2024 |
Paarth Shah - Github Maintainer | In reply to @maru:mike.it-loops.com if you run sync() and not sync_forever() you have to call keys_query() as well Interesting; if there are indeed steps missing, would you want to make a PR to fix the example? Else I'd not mind checking out whatever snippet you have and doing the update | 05:00:25 |
Paarth Shah - Github Maintainer | Oh interesting:
Automatically called by sync_forever() and room_send().
| 05:01:53 |
Maru | Ok, so looking at this some more I wonder if it is even possible right now to verfiy one of your own devices. | 18:05:48 |
Adam | Shouldn't it be possible for a verified session of one device to verify the other session of that device? | 19:00:33 |
Adam | Are you saying as a matter of Matrix design or with respect to Nio specifically? | 19:00:47 |
Maru | I guess my lack of knowledge of the nio api is making it difficult to make it work. All i want is to verifs my nio created session with one of my verified ones | 20:49:38 |
Maru | But since cross signing is not supported yet, using a passphrase would work for me as well but i did not figure how and if this is possible | 20:55:47 |
23 Mar 2024 |
Paarth Shah - Github Maintainer | Have you tried using emoji verification rather than manual?
https://github.com/matrix-nio/matrix-nio/blob/main/examples%2Fverify_with_emoji.py | 21:05:53 |