Implementation
static Map<String, Object?> syncResponse = {
'next_batch': Random().nextDouble().toString(),
'rooms': {
'join': {
'!726s6s6q:example.com': {
'summary': {
'm.heroes': ['@alice:example.com', '@bob:example.com'],
'm.joined_member_count': 2,
'm.invited_member_count': 0
},
'unread_notifications': {
'highlight_count': 2,
'notification_count': 2,
},
'state': {
'events': [
{
'sender': '@alice:example.com',
'type': 'm.room.member',
'state_key': '@alice:example.com',
'content': {
'membership': 'join',
'avatar_url': 'mxc://example.org/SEsfnsuifSDFSSEF',
'displayname': 'Alice Margatroid',
},
'origin_server_ts': 1417731086795,
'event_id': '66697273743031:example.com'
},
{
'sender': '@alice:example.com',
'type': 'm.room.canonical_alias',
'content': {
'alias': '#famedlyContactDiscovery:fakeServer.notExisting'
},
'state_key': '',
'origin_server_ts': 1417731086796,
'event_id': '66697273743032:example.com'
},
{
'sender': '@alice:example.com',
'type': 'm.room.encryption',
'state_key': '',
'content': {'algorithm': AlgorithmTypes.megolmV1AesSha2},
'origin_server_ts': 1417731086795,
'event_id': '666972737430353:example.com'
},
{
'content': {
'pinned': ['1234:bla']
},
'type': 'm.room.pinned_events',
'event_id': '21432735824443PhrSn:example.org',
'room_id': '!1234:example.com',
'sender': '@example:example.org',
'origin_server_ts': 1432735824653,
'unsigned': {'age': 1234},
'state_key': ''
},
]
},
'timeline': {
'events': [
{
'sender': '@bob:example.com',
'type': 'm.room.member',
'state_key': '@bob:example.com',
'content': {'membership': 'join'},
'prev_content': {'membership': 'invite'},
'origin_server_ts': 1417731086795,
'event_id': '7365636s6r6432:example.com',
'unsigned': {'foo': 'bar'}
},
{
'sender': '@alice:example.com',
'type': 'm.room.message',
'content': {'body': 'I am a fish', 'msgtype': 'm.text'},
'origin_server_ts': 1417731086797,
'event_id': '74686972643033:example.com'
}
],
'limited': true,
'prev_batch': 't34-23535_0_0'
},
'ephemeral': {
'events': [
{
'type': 'm.typing',
'content': {
'user_ids': ['@alice:example.com']
}
},
{
'content': {
'7365636s6r6432:example.com': {
'm.read': {
'@alice:example.com': {'ts': 1436451550453}
}
}
},
'room_id': '!726s6s6q:example.com',
'type': 'm.receipt'
}
]
},
'account_data': {
'events': [
{
'type': 'm.tag',
'content': {
'tags': {
'work': {'order': 1}
}
}
},
{
'type': 'org.example.custom.room.config',
'content': {'custom_config_key': 'custom_config_value'}
}
]
}
}
},
'invite': {
'!696r7674:example.com': {
'invite_state': {
'events': [
{
'sender': '@alice:example.com',
'type': 'm.room.name',
'state_key': '',
'content': {'name': 'My Room Name'}
},
{
'sender': '@alice:example.com',
'type': 'm.room.member',
'state_key': '@bob:example.com',
'content': {'membership': 'invite'}
}
]
}
}
},
'leave': {
'!726s6s6f:example.com': {
'state': {
'events': [
{
'sender': '@charley:example.com',
'type': 'm.room.name',
'state_key': '',
'content': {'name': 'left room'},
'origin_server_ts': 1417731086795,
'event_id': '66697273743031:example.com'
},
]
},
'timeline': {
'events': [
{
'sender': '@bob:example.com',
'type': 'm.room.message',
'content': {'text': 'Hallo'},
'origin_server_ts': 1417731086795,
'event_id': '7365636s6r64300:example.com',
'unsigned': {'foo': 'bar'}
},
],
'limited': true,
'prev_batch': 't34-23535_0_0'
},
'account_data': {
'events': [
{
'type': 'm.tag',
'content': {
'tags': {
'work': {'order': 1}
}
}
},
{
'type': 'org.example.custom.room.config',
'content': {'custom_config_key': 'custom_config_value'}
}
]
}
}
},
},
'presence': {
'events': [
{
'sender': '@alice:example.com',
'type': 'm.presence',
'content': {'presence': 'online'}
}
]
},
'account_data': {
'events': [
{
'content': {
'global': {
'content': [
{
'actions': [
'notify',
{'set_tweak': 'sound', 'value': 'default'},
{'set_tweak': 'highlight'}
],
'default': true,
'enabled': true,
'pattern': 'alice',
'rule_id': '.m.rule.contains_user_name'
}
],
'override': [
{
'actions': ['dont_notify'],
'conditions': <Map<String, Object?>>[],
'default': true,
'enabled': false,
'rule_id': '.m.rule.master'
},
{
'actions': ['dont_notify'],
'conditions': [
{
'key': 'content.msgtype',
'kind': 'event_match',
'pattern': 'm.notice'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.suppress_notices'
}
],
'room': [
{
'actions': ['dont_notify'],
'conditions': [
{
'key': 'room_id',
'kind': 'event_match',
'pattern': '!localpart:server.abc',
}
],
'default': true,
'enabled': true,
'rule_id': '!localpart:server.abc'
}
],
'sender': <Map<String, Object?>>[],
'underride': [
{
'actions': [
'notify',
{'set_tweak': 'sound', 'value': 'ring'},
{'set_tweak': 'highlight', 'value': false}
],
'conditions': [
{
'key': 'type',
'kind': 'event_match',
'pattern': 'm.call.invite'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.call'
},
{
'actions': [
'notify',
{'set_tweak': 'sound', 'value': 'default'},
{'set_tweak': 'highlight'}
],
'conditions': [
{'kind': 'contains_display_name'}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.contains_display_name'
},
{
'actions': [
'notify',
{'set_tweak': 'sound', 'value': 'default'},
{'set_tweak': 'highlight', 'value': false}
],
'conditions': [
{'is': '2', 'kind': 'room_member_count'},
{
'key': 'type',
'kind': 'event_match',
'pattern': 'm.room.message'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.room_one_to_one'
},
{
'actions': [
'notify',
{'set_tweak': 'sound', 'value': 'default'},
{'set_tweak': 'highlight', 'value': false}
],
'conditions': [
{
'key': 'type',
'kind': 'event_match',
'pattern': 'm.room.member'
},
{
'key': 'content.membership',
'kind': 'event_match',
'pattern': 'invite'
},
{
'key': 'state_key',
'kind': 'event_match',
'pattern': '@alice:example.com'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.invite_for_me'
},
{
'actions': [
'notify',
{'set_tweak': 'highlight', 'value': false}
],
'conditions': [
{
'key': 'type',
'kind': 'event_match',
'pattern': 'm.room.member'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.member_event'
},
{
'actions': [
'notify',
{'set_tweak': 'highlight', 'value': false}
],
'conditions': [
{
'key': 'type',
'kind': 'event_match',
'pattern': 'm.room.message'
}
],
'default': true,
'enabled': true,
'rule_id': '.m.rule.message'
}
]
}
},
'type': 'm.push_rules'
},
{
'type': 'org.example.custom.config',
'content': {'custom_config_key': 'custom_config_value'}
},
{
'content': {
'@bob:example.com': [
'!726s6s6q:example.com',
'!hgfedcba:example.com'
]
},
'type': 'm.direct'
},
{
'type': EventTypes.SecretStorageDefaultKey,
'content': {'key': '0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3'}
},
{
'type': 'm.secret_storage.key.0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3',
'content': {
'algorithm': AlgorithmTypes.secretStorageV1AesHmcSha2,
'passphrase': {
'algorithm': AlgorithmTypes.pbkdf2,
'iterations': 500000,
'salt': 'F4jJ80mr0Fc8mRwU9JgA3lQDyjPuZXQL'
},
'iv': 'HjbTgIoQH2pI7jQo19NUzA==',
'mac': 'QbJjQzDnAggU0cM4RBnDxw2XyarRGjdahcKukP9xVlk='
}
},
{
'type': 'm.cross_signing.master',
'content': {
'encrypted': {
'0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3': {
'iv': 'eIb2IITxtmcq+1TrT8D5eQ==',
'ciphertext':
'lWRTPo5qxf4LAVwVPzGHOyMcP181n7bb9/B0lvkLDC2Oy4DvAL0eLx2x3bY=',
'mac': 'Ynx89tIxPkx0o6ljMgxszww17JOgB4tg4etmNnMC9XI='
}
}
}
},
{
'type': EventTypes.CrossSigningSelfSigning,
'content': {
'encrypted': {
'0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3': {
'iv': 'YqU2XIjYulYZl+bkZtGgVw==',
'ciphertext':
'kM2TSoy/jR/4d357ZoRPbpPypxQl6XRLo3FsEXz+f7vIOp82GeRp28RYb3k=',
'mac': 'F+DZa5tAFmWsYSryw5EuEpzTmmABRab4GETkM85bGGo='
}
}
}
},
{
'type': EventTypes.CrossSigningUserSigning,
'content': {
'encrypted': {
'0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3': {
'iv': 'D7AM3LXFu7ZlyGOkR+OeqQ==',
'ciphertext':
'bYA2+OMgsO6QB1E31aY+ESAWrT0fUBTXqajy4qmL7bVDSZY4Uj64EXNbHuA=',
'mac': 'j2UtyPo/UBSoiaQCWfzCiRZXp3IRt0ZZujuXgUMjnw4='
}
}
}
},
{
'type': EventTypes.MegolmBackup,
'content': {
'encrypted': {
'0FajDWYaM6wQ4O60OZnLvwZfsBNu4Bu3': {
'iv': 'cL/0MJZaiEd3fNU+I9oJrw==',
'ciphertext':
'WL73Pzdk5wZdaaSpaeRH0uZYKcxkuV8IS6Qa2FEfA1+vMeRLuHcWlXbMX0w=',
'mac': '+xozp909S6oDX8KRV8D8ZFVRyh7eEYQpPP76f+DOsnw='
}
}
}
}
]
},
'to_device': {
'events': [
{
'sender': '@alice:example.com',
'type': 'm.new_device',
'content': {
'device_id': 'XYZABCDE',
'rooms': ['!726s6s6q:example.com']
}
},
// {
// 'sender': '@othertest:fakeServer.notExisting',
// 'content': {
// 'algorithm': AlgorithmTypes.megolmV1AesSha2,
// 'room_id': '!726s6s6q:example.com',
// 'session_id': 'ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU',
// 'session_key':
// 'AgAAAAAQcQ6XrFJk6Prm8FikZDqfry/NbDz8Xw7T6e+/9Yf/q3YHIPEQlzv7IZMNcYb51ifkRzFejVvtphS7wwG2FaXIp4XS2obla14iKISR0X74ugB2vyb1AydIHE/zbBQ1ic5s3kgjMFlWpu/S3FQCnCrv+DPFGEt3ERGWxIl3Bl5X53IjPyVkz65oljz2TZESwz0GH/QFvyOOm8ci0q/gceaF3S7Dmafg3dwTKYwcA5xkcc+BLyrLRzB6Hn+oMAqSNSscnm4mTeT5zYibIhrzqyUTMWr32spFtI9dNR/RFSzfCw'
// },
// 'type': 'm.room_key'
// },
{
// this is the commented out m.room_key event - only encrypted
'sender': '@othertest:fakeServer.notExisting',
'content': {
'algorithm': AlgorithmTypes.olmV1Curve25519AesSha2,
'sender_key': 'JBG7ZaPn54OBC7TuIEiylW3BZ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iKD0xRMst+8f9aTjaWwh8ZvELE1ZOhhCbF3RXhxi3x2Nu8ORIz+vhEQ1NOlMc7UIo98Fk/96T36vL/fviowT4C/0AlaapZDJBmKwhmwqisMjY2n1vY29oM2p5BzY1iwP7q9BYdRFst6xwo57TNSuRwQw7IhFsf0k+ABuPEZy5xB5nPHyIRTf/pr3Hw',
},
},
},
'type': 'm.room.encrypted',
},
]
},
'device_lists': {
'changed': [
'@alice:example.com',
],
'left': [
'@bob:example.com',
],
},
'device_one_time_keys_count': {'curve25519': 10, 'signed_curve25519': 20},
};