Created
June 23, 2021 00:02
-
-
Save aaronraimist/d36a73a284463444dfd7e0b08271db92 to your computer and use it in GitHub Desktop.
Decrypt Matrix key export file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import asyncio | |
import getpass | |
import json | |
import os | |
import sys | |
import nio | |
KEY_FILE = "element-keys.txt" | |
async def main() -> None: | |
if not os.path.exists(KEY_FILE): | |
sys.exit("Did not find file " + KEY_FILE) | |
passphrase = getpass.getpass("Enter passphrase: ") | |
plaintext = nio.crypto.key_export.decrypt_and_read(KEY_FILE, passphrase) | |
obj = json.loads(plaintext) | |
print(json.dumps(obj, indent=4)) | |
asyncio.get_event_loop().run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment