Fix create_account bug
This commit is contained in:
parent
22d079f079
commit
def53187e8
1 changed files with 6 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ from keycloak import KeycloakAdmin
|
|||
from keycloak.exceptions import KeycloakError
|
||||
|
||||
from mautrix.client import Client
|
||||
from mautrix.crypto import OlmMachine
|
||||
from mautrix.crypto import OlmMachine, Account
|
||||
from mautrix.crypto.store import MemoryCryptoStore
|
||||
from mautrix.client.state_store import MemoryStateStore
|
||||
from mautrix.types import (
|
||||
|
|
@ -429,10 +429,12 @@ async def main():
|
|||
"device_id": client.device_id
|
||||
}, f)
|
||||
|
||||
# Create a new Olm account if one wasn't loaded from the crypto store
|
||||
if not client.crypto.account:
|
||||
# Ensure an Olm crypto account exists in the store
|
||||
account = await client.crypto.store.get_account(client.mxid)
|
||||
if not account:
|
||||
log.info("Creating new Olm account...")
|
||||
await client.crypto.create_account()
|
||||
account = Account.generate()
|
||||
await client.crypto.store.put_account(account)
|
||||
|
||||
# Register Event Handlers
|
||||
client.add_event_handler(EventType.ROOM_MEMBER, on_invite)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue