added the ability to read ui group chat msgs

This commit is contained in:
2024-09-27 21:45:16 +03:00
parent fa0c45b9bf
commit 7086aa69a6
3 changed files with 35 additions and 11 deletions

View File

@@ -185,6 +185,27 @@ export const encryptSingle = async ({ data64, secretKeyObject, typeNumber = 1 }:
return finalEncryptedData;
};
export const decodeBase64ForUIChatMessages = (messages)=> {
console.log('messages', messages)
let msgs = []
for(const msg of messages){
try {
const decoded = atob(msg?.data);
const parseDecoded = JSON.parse(decoded)
if(parseDecoded?.messageText){
msgs.push({
...msg,
...parseDecoded
})
}
} catch (error) {
}
}
return msgs
}