-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
When I run the script it errors out after a while with a message that looks like this:
Importing keys. This may take a while...
Traceback (most recent call last):
File "/home/foo/resources/code/matrix-archive/venv/lib/python3.9/site-packages/nio/crypto/olm_machine.py", line 1990, in import_keys_static
validate_json(session_list, Schemas.megolm_key_import)
File "/home/foo/resources/code/matrix-archive/venv/lib/python3.9/site-packages/nio/schemas.py", line 69, in validate_json
Validator(schema, format_checker=FormatChecker()).validate(instance)
File "/home/foo/resources/code/matrix-archive/venv/lib/python3.9/site-packages/jsonschema/validators.py", line 310, in validate
raise error
jsonschema.exceptions.ValidationError: 'sender_claimed_keys' is a required property
Failed validating 'required' in schema['items']:
{'properties': {'algorithm': {'type': 'string'},
'forwarding_curve25519_key_chain': {'items': {'type': 'string'},
'type': 'array'},
'room_id': {'type': 'string'},
'sender_claimed_keys': {'properties': {'ed25519': {'type': 'string'}},
'required': ['ed25519'],
'type': 'object'},
'sender_key': {'type': 'string'},
'session_key': {'type': 'string'}},
'required': ['algorithm',
'session_key',
'sender_key',
'room_id',
'sender_claimed_keys',
'forwarding_curve25519_key_chain'],
'type': 'object'}
On instance[26]:
{'algorithm': 'm.megolm.v1.aes-sha2',
'forwarding_curve25519_key_chain': [],
'org.matrix.msc3061.shared_history': False,
'room_id': '!<redacted>:matrix.org',
'sender_key': '<redacted>',
'session_id': '<redacted>',
'session_key': '<redacted>'}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/foo/resources/code/matrix-archive/./matrix-archive.py", line 369, in main
client = await create_client()
File "/home/foo/resources/code/matrix-archive/./matrix-archive.py", line 198, in create_client
await client.import_keys(room_keys_path, room_keys_password)
File "/home/foo/resources/code/matrix-archive/venv/lib/python3.9/site-packages/nio/client/async_client.py", line 2087, in import_keys
sessions = await loop.run_in_executor(None, import_keys)
File "/nix/store/x9na3pxf7134pq7dkn1kgy9df6lf1z4v-python3-3.9.13/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/foo/resources/code/matrix-archive/venv/lib/python3.9/site-packages/nio/crypto/olm_machine.py", line 1993, in import_keys_static
raise EncryptionError(f"Error parsing key file: {str(e)}")
nio.exceptions.EncryptionError: Error parsing key file: 'sender_claimed_keys' is a required property
Failed validating 'required' in schema['items']:
{'properties': {'algorithm': {'type': 'string'},
'forwarding_curve25519_key_chain': {'items': {'type': 'string'},
'type': 'array'},
'room_id': {'type': 'string'},
'sender_claimed_keys': {'properties': {'ed25519': {'type': 'string'}},
'required': ['ed25519'],
'type': 'object'},
'sender_key': {'type': 'string'},
'session_key': {'type': 'string'}},
'required': ['algorithm',
'session_key',
'sender_key',
'room_id',
'sender_claimed_keys',
'forwarding_curve25519_key_chain'],
'type': 'object'}
On instance[26]:
{'algorithm': 'm.megolm.v1.aes-sha2',
'forwarding_curve25519_key_chain': [],
'org.matrix.msc3061.shared_history': False,
'room_id': '!redacted:matrix.org',
'sender_key': '<redacted>',
'session_id': '<redacted>',
'session_key': '<redacted>'}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/foo/resources/code/matrix-archive/./matrix-archive.py", line 401, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "/nix/store/x9na3pxf7134pq7dkn1kgy9df6lf1z4v-python3-3.9.13/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/foo/resources/code/matrix-archive/./matrix-archive.py", line 391, in main
await client.logout()
UnboundLocalError: local variable 'client' referenced before assignment
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fe5d1c57b80>
I'm wondering if Element changed the export format of keys? Any idea what the problem is or how I can work around it?
EDIT: Perhaps it's related to a change in matrix-nio. I found a potentially related bug report: matrix-nio/matrix-nio#358.
EDIT 2: It does appear to be an issue with the Element export. There is a workaround here: matrix-nio/matrix-nio#357
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels