Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4779463
feat: implement binary node wasm
jlucaso1 Aug 19, 2025
d5076e1
fix: update whatsapp-rust-bridge dependency to version 0.1.3 (improve…
jlucaso1 Aug 19, 2025
1637b64
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Aug 19, 2025
5ca337b
refactor: initialize WASM in makeSocket and remove redundant init cal…
jlucaso1 Aug 20, 2025
dddc3e9
chore: update whatsapp-rust-bridge to version 0.1.4 and refactor asyn…
jlucaso1 Aug 20, 2025
53559e1
chore: update whatsapp-rust-bridge to version 0.1.5 and refactor enco…
jlucaso1 Sep 1, 2025
e33bcf6
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Sep 1, 2025
154f402
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Sep 19, 2025
c443704
fix: sanitize user JID format in jidToSignalProtocolAddress function
jlucaso1 Sep 19, 2025
c6cc1d0
chore: update whatsapp-rust-bridge to version 0.1.6 and refactor deco…
jlucaso1 Oct 7, 2025
35f8864
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Oct 7, 2025
dd75fff
fix: lint
jlucaso1 Oct 7, 2025
7d6bf06
chore: update whatsapp-rust-bridge to version 0.1.7
jlucaso1 Oct 7, 2025
6da42d5
chore: bump to 0.1.8 whatsapp-rust-bridge
jlucaso1 Oct 15, 2025
0ea9bd0
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Oct 15, 2025
a2468b6
fix: increase encoding buffer size to process videos correctly
jlucaso1 Oct 15, 2025
d990bc1
fix: update whatsapp-rust-bridge to version 0.1.9
jlucaso1 Oct 15, 2025
2c64c40
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Oct 15, 2025
1d5a938
fix: update whatsapp-rust-bridge to version 0.2.0
jlucaso1 Oct 15, 2025
9e6592b
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Nov 12, 2025
cec6c72
chore: upgrade bridge to 0.3.0 (improve perfomance and usability)
jlucaso1 Nov 12, 2025
3cb03de
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys in…
jlucaso1 Nov 24, 2025
a52708c
chore: bump whatsapp-rust-bridge
jlucaso1 Nov 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"p-queue": "^9.0.0",
"pino": "^9.6",
"protobufjs": "^7.2.4",
"whatsapp-rust-bridge": "^0.4.0",
"ws": "^8.13.0"
},
"devDependencies": {
Expand Down
11 changes: 6 additions & 5 deletions src/Socket/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
* - listen to messages and emit events
* - query phone connection
*/

export const makeSocket = (config: SocketConfig) => {
const {
waWebSocketUrl,
Expand Down Expand Up @@ -192,7 +191,7 @@

const msgId = node.attrs.id

const result = await promiseTimeout<any>(timeoutMs, async (resolve, reject) => {

Check warning on line 194 in src/Socket/socket.ts

View workflow job for this annotation

GitHub Actions / check-lint

Unexpected any. Specify a different type
const result = waitForMessage(msgId, timeoutMs).catch(reject)
sendNode(node)
.then(async () => resolve(await result))
Expand Down Expand Up @@ -576,7 +575,7 @@
anyTriggered = ws.emit('frame', frame)
// if it's a binary node
if (!(frame instanceof Uint8Array)) {
const msgId = frame.attrs.id
const msgId = frame.attrs?.id

if (logger.level === 'trace') {
logger.trace({ xml: binaryNodeToString(frame), msg: 'recv xml' })
Expand Down Expand Up @@ -826,7 +825,7 @@
ws.on('open', async () => {
try {
await validateConnection()
} catch (err: any) {

Check warning on line 828 in src/Socket/socket.ts

View workflow job for this annotation

GitHub Actions / check-lint

Unexpected any. Specify a different type
logger.error({ err }, 'error in validating connection')
end(err)
}
Expand Down Expand Up @@ -867,10 +866,12 @@
return
}

const ref = (refNode.content as Buffer).toString('utf-8')
const qr = [ref, noiseKeyB64, identityKeyB64, advB64].join(',')
if (refNode.content instanceof Uint8Array) {
const ref = Buffer.from(refNode.content).toString('utf-8')
const qr = [ref, noiseKeyB64, identityKeyB64, advB64].join(',')

ev.emit('connection.update', { qr })
ev.emit('connection.update', { qr })
}

qrTimer = setTimeout(genPairQR, qrMs)
qrMs = qrTimeout || 20_000 // shorter subsequent qrs
Expand All @@ -894,7 +895,7 @@
ev.emit('connection.update', { isNewLogin: true, qr: undefined })

await sendNode(reply)
} catch (error: any) {

Check warning on line 898 in src/Socket/socket.ts

View workflow job for this annotation

GitHub Actions / check-lint

Unexpected any. Specify a different type
logger.info({ trace: error.stack }, 'error in pairing')
end(error)
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/chat-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export const extractSyncdPatches = async (result: BinaryNode, options: RequestIn
snapshotNode.content = Buffer.from(Object.values(snapshotNode.content))
}

const blobRef = proto.ExternalBlobReference.decode(snapshotNode.content as Buffer)
const blobRef = proto.ExternalBlobReference.decode(snapshotNode.content as Uint8Array)
const data = await downloadExternalBlob(blobRef, options)
snapshot = proto.SyncdSnapshot.decode(data)
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/decode-wa-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ export const decryptMessageNode = (
msgBuffer = await repository.decryptGroupMessage({
group: sender,
authorJid: author,
msg: content
msg: Buffer.from(content)
})
break
case 'pkmsg':
case 'msg':
msgBuffer = await repository.decryptMessage({
jid: decryptionJid,
type: e2eType,
ciphertext: content
ciphertext: Buffer.from(content)
})
break
case 'plaintext':
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/noise-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const makeNoiseHandler = ({

return frame
},
decodeFrame: async (newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => {
decodeFrame: (newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => {
// the binary protocol uses its own framing mechanism
// on top of the WS frames
// so we get this data and separate out the frames
Expand All @@ -179,7 +179,7 @@ export const makeNoiseHandler = ({

if (isFinished) {
const result = decrypt(frame)
frame = await decodeBinaryNode(result)
frame = decodeBinaryNode(result)
}

logger.trace({ msg: (frame as BinaryNode)?.attrs?.id }, 'recv frame')
Expand Down
4 changes: 3 additions & 1 deletion src/Utils/validate-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ export const configureSuccessfulPairing = (
const jid = deviceNode.attrs.jid
const lid = deviceNode.attrs.lid

const { details, hmac, accountType } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content as Buffer)
const { details, hmac, accountType } = proto.ADVSignedDeviceIdentityHMAC.decode(
deviceIdentityNode.content as Uint8Array
)

let hmacPrefix = Buffer.from([])
if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
Expand Down
Loading
Loading