when send group message, it takes 30 seconds to send, when I trace the code, the bug happend at mongoAuthState.js
const writeData = (data, id) => {
this fucntion when data is array, it is not writen, need to change to object.
2nd part is :
const BufferJSON = {
replacer: (k, value) => {
here add type:buffer is not working, because it is changed to string before add type:buffer. don' know how to fix. in stead, in reviver ,I add the code to change base64 code to buffer.
else if ((k === 'seed' || k === 'public' || k === 'private') && typeof value === 'string') {
// Convert the base64 string back to a Buffer
return Buffer.from(value, 'base64');
}
@whiskeysockets/baileys/lib/Signal/libsignal.js
here when loadSenderKey, the key should be array, but mongoAuthState send the object, temporaly I change to array here to array.
loadSenderKey: async (keyId) => {
const { [keyId]: key } = await keys.get('sender-key', [keyId]);
if (key) {
if(typeof key==='object'){
let testkey4 = convertObjectToArray(key)
let record=new WASignalGroup_1.SenderKeyRecord(testkey4)
return record;
}else{
let record=new WASignalGroup_1.SenderKeyRecord(key)
return record;
}
}
},
this is the full code i change in 2 file, it is just temporly work around, hope somebody could rewrite the mongoAuthState to save the key and read the key correctly in array and handle the buffer data correctly
Downloads.zip
when send group message, it takes 30 seconds to send, when I trace the code, the bug happend at mongoAuthState.js const writeData = (data, id) => {
this fucntion when data is array, it is not writen, need to change to object.
const writeData = (data, id) => { // console.log('write data array') // console.log(data) if (Array.isArray(data)) { const obj = {}; data.forEach((value, index) => { obj[index] = value; }); data = obj; }
2nd part is : const BufferJSON = { replacer: (k, value) => {
here add type:buffer is not working, because it is changed to string before add type:buffer. don' know how to fix. in stead, in reviver ,I add the code to change base64 code to buffer.
else if ((k === 'seed' || k === 'public' || k === 'private') && typeof value === 'string') { // Convert the base64 string back to a Buffer return Buffer.from(value, 'base64'); }
@whiskeysockets/baileys/lib/Signal/libsignal.js here when loadSenderKey, the key should be array, but mongoAuthState send the object, temporaly I change to array here to array.
loadSenderKey: async (keyId) => {
this is the full code i change in 2 file, it is just temporly work around, hope somebody could rewrite the mongoAuthState to save the key and read the key correctly in array and handle the buffer data correctly Downloads.zip