Auto-verify/blacklist accounts within same client
This commit is contained in:
parent
9edfba8f18
commit
b0e2533bb9
5
TODO.md
5
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- get devices for members with no shared E2E room?
|
- highlight when logging in to new account
|
||||||
|
- warn about no E2E room shared if no devices
|
||||||
- keyboard controls
|
- keyboard controls
|
||||||
- remove useless Base imports in Base components
|
- remove useless Base imports in Base components
|
||||||
- HTile enter trigger leftClicked()
|
- HTile enter trigger leftClicked()
|
||||||
|
@ -186,10 +187,8 @@
|
||||||
- Live-reloading accounts.json
|
- Live-reloading accounts.json
|
||||||
|
|
||||||
- E2E
|
- E2E
|
||||||
- List and verify other users's devices
|
|
||||||
- SAS verification
|
- SAS verification
|
||||||
- Request room keys from own other devices
|
- Request room keys from own other devices
|
||||||
- Auto-trust accounts within the same client
|
|
||||||
- Provide help when undecryptable messages occur, including:
|
- Provide help when undecryptable messages occur, including:
|
||||||
- Trigger `nio.AsyncClient.request_room_key`
|
- Trigger `nio.AsyncClient.request_room_key`
|
||||||
- Option to export-logout-login-import to fix one-time key problems
|
- Option to export-logout-login-import to fix one-time key problems
|
||||||
|
|
|
@ -323,6 +323,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
self.no_unknown_events_filter["room"]["timeline"]["not_types"],
|
self.no_unknown_events_filter["room"]["timeline"]["not_types"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await self.auto_verify_all_other_accounts()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
self.sync_task = asyncio.ensure_future(self.sync_forever(
|
self.sync_task = asyncio.ensure_future(self.sync_forever(
|
||||||
|
@ -1381,6 +1383,32 @@ class MatrixClient(nio.AsyncClient):
|
||||||
self.blacklist_device(self.device_store[user_id][device_id])
|
self.blacklist_device(self.device_store[user_id][device_id])
|
||||||
|
|
||||||
|
|
||||||
|
async def auto_verify_all_other_accounts(self) -> None:
|
||||||
|
"""Automatically verify/blacklist our other accounts's devices."""
|
||||||
|
|
||||||
|
for client in self.backend.clients.values():
|
||||||
|
await self.auto_verify_account(client)
|
||||||
|
|
||||||
|
|
||||||
|
async def auto_verify_account(self, client: "MatrixClient") -> None:
|
||||||
|
"""Automatically verify/blacklist one of our accounts's devices."""
|
||||||
|
|
||||||
|
if client.user_id == self.user_id:
|
||||||
|
return
|
||||||
|
|
||||||
|
for device in self.device_store.active_user_devices(client.user_id):
|
||||||
|
if device.device_id != client.device_id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if device.verified or device.blacklisted:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if device.ed25519 == client.olm.account.identity_keys["ed25519"]:
|
||||||
|
self.verify_device(device)
|
||||||
|
else:
|
||||||
|
self.blacklist_device(device)
|
||||||
|
|
||||||
|
|
||||||
async def delete_devices_with_password(
|
async def delete_devices_with_password(
|
||||||
self, device_ids: List[str], password: str,
|
self, device_ids: List[str], password: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
@ -109,12 +109,16 @@ class NioCallbacks:
|
||||||
|
|
||||||
async def onKeysQueryResponse(self, resp: nio.KeysQueryResponse) -> None:
|
async def onKeysQueryResponse(self, resp: nio.KeysQueryResponse) -> None:
|
||||||
refresh_rooms = {}
|
refresh_rooms = {}
|
||||||
|
clients = self.client.backend.clients
|
||||||
|
|
||||||
for user_id in resp.changed:
|
for user_id in resp.changed:
|
||||||
for room in self.client.rooms.values():
|
for room in self.client.rooms.values():
|
||||||
if user_id in room.users:
|
if user_id in room.users:
|
||||||
refresh_rooms[room.room_id] = room
|
refresh_rooms[room.room_id] = room
|
||||||
|
|
||||||
|
if user_id != self.user_id and user_id in clients:
|
||||||
|
await self.client.auto_verify_account(clients[user_id])
|
||||||
|
|
||||||
for room_id, room in refresh_rooms.items():
|
for room_id, room in refresh_rooms.items():
|
||||||
room_item = self.models[self.user_id, "rooms"].get(room_id)
|
room_item = self.models[self.user_id, "rooms"].get(room_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user