@hiroosy/baileys-lite 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WAProto/index.js +1530 -1514
- package/package.json +1 -1
- package/src/binary/wa-binary.js +4 -2
- package/src/defaults.js +2 -1
- package/src/foundation/cache.js +99 -24
- package/src/foundation/memory.js +103 -0
- package/src/signal/libsignal.js +1 -8
- package/src/signal/signal-repository.js +6 -4
- package/src/socket/chats.js +2 -0
- package/src/socket/messages-recv.js +5 -3
- package/src/socket/messages-send.js +2 -2
- package/src/socket/socket-core.js +3 -0
- package/src/utils/auth-state-core.js +2 -1
- package/src/utils/chat-sync.js +4 -0
- package/src/utils/media.js +13 -8
- package/src/utils/message-processing.js +22 -6
- package/src/utils/wa-protocol-core.js +6 -5
- package/src/wam/wam-constants.js +22 -22851
- package/src/wam/wam-data.json +1 -0
|
@@ -717,7 +717,8 @@ export const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publi
|
|
|
717
717
|
let decKey = hash
|
|
718
718
|
let counter = 0
|
|
719
719
|
let sentIntro = false
|
|
720
|
-
|
|
720
|
+
const EMPTY_BYTES = Buffer.alloc(0)
|
|
721
|
+
let inBytes = EMPTY_BYTES
|
|
721
722
|
let transport = null
|
|
722
723
|
let isWaitingForTransport = false
|
|
723
724
|
let pendingOnFrame = null
|
|
@@ -785,7 +786,7 @@ export const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publi
|
|
|
785
786
|
size = (inBytes[0] << 16) | (inBytes[1] << 8) | inBytes[2]
|
|
786
787
|
if (inBytes.length < size + 3) return
|
|
787
788
|
let frame = inBytes.subarray(3, size + 3)
|
|
788
|
-
inBytes = inBytes.subarray(size + 3)
|
|
789
|
+
inBytes = inBytes.length === size + 3 ? EMPTY_BYTES : inBytes.subarray(size + 3)
|
|
789
790
|
if (transport) {
|
|
790
791
|
const result = transport.decrypt(frame) // gagal decrypt = counter tidak sinkron lagi -> biarkan melempar (fatal)
|
|
791
792
|
try {
|
|
@@ -863,11 +864,11 @@ export const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publi
|
|
|
863
864
|
inBytes = Buffer.concat([inBytes, newData])
|
|
864
865
|
pendingOnFrame = onFrame
|
|
865
866
|
} else {
|
|
866
|
-
inBytes = inBytes.length === 0 ?
|
|
867
|
+
inBytes = inBytes.length === 0 ? newData : Buffer.concat([inBytes, newData])
|
|
867
868
|
}
|
|
868
869
|
if (inBytes.length > MAX_IN_BYTES) {
|
|
869
870
|
logger.error({ bufferedBytes: inBytes.length, max: MAX_IN_BYTES }, 'noise handler inBytes buffer exceeded cap, clearing')
|
|
870
|
-
inBytes =
|
|
871
|
+
inBytes = EMPTY_BYTES
|
|
871
872
|
pendingOnFrame = null
|
|
872
873
|
return
|
|
873
874
|
}
|
|
@@ -882,7 +883,7 @@ export const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publi
|
|
|
882
883
|
|
|
883
884
|
destroy: () => {
|
|
884
885
|
destroyed = true
|
|
885
|
-
inBytes =
|
|
886
|
+
inBytes = EMPTY_BYTES
|
|
886
887
|
pendingOnFrame = null
|
|
887
888
|
transport = null
|
|
888
889
|
}
|