mapToMessageEvent static method
Implementation
static dynamic mapToMessageEvent(
Map<String, dynamic> data,
bool includeRaw,
String eventType,
) {
final messageEvent = {
'event': eventType,
'origin': data['messageOrigin'],
'timestamp': data['timestamp'].toString(),
'chatId': data['chatId'],
'from': data['fromCAIP10'],
'to': [
if (data['toCAIP10'] != null) data['toCAIP10']
],
'message': {
'type': data['messageType'],
'content': data['messageContent'],
},
'meta': {
'group': data['isGroup'] ?? false,
},
'reference': data['cid'],
};
if (includeRaw) {
final rawData = {
'fromCAIP10': data['fromCAIP10'],
'toCAIP10': data['toCAIP10'],
'fromDID': data['fromDID'],
'toDID': data['toDID'],
'encType': data['encType'],
'encryptedSecret': data['encryptedSecret'],
'signature': data['signature'],
'sigType': data['sigType'],
'verificationProof': data['verificationProof'],
'previousReference': data['link'],
};
messageEvent['raw'] = rawData;
}
return messageEvent;
}