Skip to content

Conversation

@jlucaso1
Copy link
Collaborator

@jlucaso1 jlucaso1 commented Nov 16, 2025

Working branch: WhiskeySockets/whatsapp-rust-bridge#2

Need help to test stability from dm messages (maybe is necessary to start a new session, but the idea is in the future to be 100% retro compatible)

With node 24 I've seen a perfomance in encrypting/sending message 10x faster

before:
image

after:
image

@whiskeysockets-bot
Copy link
Contributor

whiskeysockets-bot commented Nov 16, 2025

Thanks for opening this pull request and contributing to the project!

The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch.

In the meantime, anyone in the community is encouraged to test this pull request and provide feedback.

✅ How to confirm it works

If you’ve tested this PR, please comment below with:

Tested and working ✅

This helps us speed up the review and merge process.

📦 To test this PR locally:

# NPM
npm install @whiskeysockets/baileys@WhiskeySockets/Baileys#feat-libsignal-wasm

# Yarn (v2+)
yarn add @whiskeysockets/baileys@WhiskeySockets/Baileys#feat-libsignal-wasm

# PNPM
pnpm add @whiskeysockets/baileys@WhiskeySockets/Baileys#feat-libsignal-wasm

If you encounter any issues or have feedback, feel free to comment as well.

@jlucaso1 jlucaso1 force-pushed the feat-libsignal-wasm branch from cc9ae9b to 779ad19 Compare November 16, 2025 00:33
@jlucaso1 jlucaso1 changed the title feat: libsignal wasm (only dm) feat: libsignal wasm Nov 16, 2025
@Salientekill
Copy link

I'm following along and testing it out 🫡🙂

Salientekill pushed a commit to Salientekill/Baileys that referenced this pull request Nov 17, 2025
- Add WebAssembly version of libsignal
- Improve performance with WASM implementation
- Update dependencies for libsignal WASM support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@purpshell
Copy link
Member

Testing in scale this week

Salientekill pushed a commit to Salientekill/Baileys that referenced this pull request Nov 19, 2025
…ets#1969 to latest Baileys

Applied PRs:
- WhiskeySockets#2067: libsignal wasm
- WhiskeySockets#2057: emit setting events
- WhiskeySockets#1969: improve retry logic

Note: PRs WhiskeySockets#1991, WhiskeySockets#1981, WhiskeySockets#1906, WhiskeySockets#1892 have conflicts with latest Baileys version and were skipped.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@jlucaso1
Copy link
Collaborator Author

jlucaso1 commented Nov 20, 2025

Good news:

The PR is ready for testing (no need to delete sessions or sender keys anymore, this will be auto migrated, only in case reverting this is necessary)

@jlucaso1 jlucaso1 marked this pull request as ready for review November 20, 2025 06:52
Salientekill pushed a commit to Salientekill/Baileys that referenced this pull request Nov 20, 2025
… v0.4.0-alpha.3

Updated libsignal WASM implementation with latest whatsapp-rust-bridge version.

Changes:
- Updated whatsapp-rust-bridge: 0.4.0-alpha.2 → 0.4.0-alpha.3
- Core WASM implementation was already in place from previous PR
- Provides 10x faster message encryption/decryption performance

Performance benefits:
- Native-speed cryptographic operations (WASM)
- Efficient group message handling
- Better memory management

Build and dependencies verified successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@4relial
Copy link
Contributor

4relial commented Nov 21, 2025

I've tested this in a production environment. There are several cases where the bot suddenly stops receiving upsert messages, and it only starts working again after rescan. I'm still monitoring it, but for now that's the main issue I've encountered.

@Salientekill
Copy link

I've tested this in a production environment. There are several cases where the bot suddenly stops receiving upsert messages, and it only starts working again after rescan. I'm still monitoring it, but for now that's the main issue I've encountered.

It's not due to that PR, try implementing that PR and see if it continues: #2070

@Salientekill
Copy link

It was merged but the purpshell reverted.

@4relial
Copy link
Contributor

4relial commented Nov 21, 2025

I've tested this in a production environment. There are several cases where the bot suddenly stops receiving upsert messages, and it only starts working again after rescan. I'm still monitoring it, but for now that's the main issue I've encountered.

It's not due to that PR, try implementing that PR and see if it continues: #2070

Ah, I see. That was my mistake. another one of my instances running v7.0.0-rc8 had the same issue, so it wasn’t related to this PR.

@astrox11
Copy link

astrox11 commented Nov 21, 2025

This implementation is not stable, after testing it, I noticed that append in message upsert doesn't work anymore.

Then I continue to keep getting

Migrating session to: v1

@jlucaso1
Copy link
Collaborator Author

This implementation is not stable, after testing it, I noticed that append in message upsert doesn't work anymore.

Then I continue to keep getting

Migrating session to: v1

This occurs in a fresh or existing session?

Is there any error log that you can share?

@4relial
Copy link
Contributor

4relial commented Nov 21, 2025

I'm getting this error when using an existing (old) session in this pr. The issue disappears when I revert back to v7.0.0-rc6.

called `Option::unwrap()` on a `None` value
Stack:
Error
    at imports.wbg.__wbg_new_8a6f238a6ece86ea (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:1165:17)
    at wasm://wasm/0025a896:wasm-function[816]:0x77b9e
    at wasm://wasm/0025a896:wasm-function[378]:0x66427
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
=== [UNCAUGHT EXCEPTION] ===
Message: unreachable
Stack Trace:
 RuntimeError: unreachable
    at wasm://wasm/0025a896:wasm-function[378]:0x6644d
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
    at wasm://wasm/0025a896:wasm-function[704]:0x75e08
    at wasm_bindgen__convert__closures_____invoke__hc06afd87ee096bc5 (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:385:8)```

@jlucaso1
Copy link
Collaborator Author

I'm getting this error when using an existing (old) session in this pr. The issue disappears when I revert back to v7.0.0-rc6.

called `Option::unwrap()` on a `None` value
Stack:
Error
    at imports.wbg.__wbg_new_8a6f238a6ece86ea (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:1165:17)
    at wasm://wasm/0025a896:wasm-function[816]:0x77b9e
    at wasm://wasm/0025a896:wasm-function[378]:0x66427
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
=== [UNCAUGHT EXCEPTION] ===
Message: unreachable
Stack Trace:
 RuntimeError: unreachable
    at wasm://wasm/0025a896:wasm-function[378]:0x6644d
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
    at wasm://wasm/0025a896:wasm-function[704]:0x75e08
    at wasm_bindgen__convert__closures_____invoke__hc06afd87ee096bc5 (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:385:8)```

Thank you, I'll check soon

@astrox11
Copy link

This implementation is not stable, after testing it, I noticed that append in message upsert doesn't work anymore.
Then I continue to keep getting
Migrating session to: v1

This occurs in a fresh or existing session?

Is there any error log that you can share?

Occurs only on existing session I'm yet to test on a fresh session

@jlucaso1
Copy link
Collaborator Author

jlucaso1 commented Nov 21, 2025

@4relial @astrox11

Please test again with this updated version (I've just improved the error logging, will be more precise to identify what is wrong).

And thank you guys for helping <3

Salientekill pushed a commit to Salientekill/Baileys that referenced this pull request Nov 21, 2025
… v0.4.0-alpha.4

Updated to latest whatsapp-rust-bridge version released 14 minutes ago.

Changes:
- whatsapp-rust-bridge: 0.4.0-alpha.3 → 0.4.0-alpha.4

Maintains 10x faster WASM-based cryptographic operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@purpshell
Copy link
Member

It was merged but the purpshell reverted.

we need to handle it differently.

@purpshell
Copy link
Member

Would love if the logging architecture was implemented the same way

@purpshell
Copy link
Member

It was merged but the purpshell reverted.

we need to handle it differently.

Related to this @Salientekill (even though this is off topic) check out rc9

@Salientekill
Copy link

It was merged but the purpshell reverted.

we need to handle it differently.

Related to this @Salientekill (even though this is off topic) check out rc9

Ksksksks I answered you discord already (shiroe)

@purpshell
Copy link
Member

I'm getting this error when using an existing (old) session in this pr. The issue disappears when I revert back to v7.0.0-rc6.

called `Option::unwrap()` on a `None` value
Stack:
Error
    at imports.wbg.__wbg_new_8a6f238a6ece86ea (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:1165:17)
    at wasm://wasm/0025a896:wasm-function[816]:0x77b9e
    at wasm://wasm/0025a896:wasm-function[378]:0x66427
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
=== [UNCAUGHT EXCEPTION] ===
Message: unreachable
Stack Trace:
 RuntimeError: unreachable
    at wasm://wasm/0025a896:wasm-function[378]:0x6644d
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
    at wasm://wasm/0025a896:wasm-function[704]:0x75e08
    at wasm_bindgen__convert__closures_____invoke__hc06afd87ee096bc5 (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:385:8)```

@jlucaso1 This was the same .unwrap() kind of error that took cloudflare offline, be careful man 😆

@jlucaso1
Copy link
Collaborator Author

I'm getting this error when using an existing (old) session in this pr. The issue disappears when I revert back to v7.0.0-rc6.

called `Option::unwrap()` on a `None` value
Stack:
Error
    at imports.wbg.__wbg_new_8a6f238a6ece86ea (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:1165:17)
    at wasm://wasm/0025a896:wasm-function[816]:0x77b9e
    at wasm://wasm/0025a896:wasm-function[378]:0x66427
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
=== [UNCAUGHT EXCEPTION] ===
Message: unreachable
Stack Trace:
 RuntimeError: unreachable
    at wasm://wasm/0025a896:wasm-function[378]:0x6644d
    at wasm://wasm/0025a896:wasm-function[615]:0x7098d
    at wasm://wasm/0025a896:wasm-function[553]:0x6f384
    at wasm://wasm/0025a896:wasm-function[749]:0x771e1
    at wasm://wasm/0025a896:wasm-function[89]:0x6bc2
    at wasm://wasm/0025a896:wasm-function[104]:0x1fe6e
    at wasm://wasm/0025a896:wasm-function[247]:0x5694e
    at wasm://wasm/0025a896:wasm-function[655]:0x75215
    at wasm://wasm/0025a896:wasm-function[704]:0x75e08
    at wasm_bindgen__convert__closures_____invoke__hc06afd87ee096bc5 (file:///home/container/node_modules/whatsapp-rust-bridge/dist/binary.js:385:8)```

@jlucaso1 This was the same .unwrap() kind of error that took cloudflare offline, be careful man 😆

Yeah hahaha. I've just searched and removed all .unwrap from code

@jlucaso1 jlucaso1 force-pushed the feat-libsignal-wasm branch from 44400d2 to 7a43cc7 Compare December 13, 2025 13:46
@Santosl2
Copy link
Contributor

image

I’m facing the error above. When it happens, the message is not sent to the group.(I already sent it to you on Discord, but I’m sending it here as well to keep things consistent)

@jlucaso1
Copy link
Collaborator Author

image

I’m facing the error above. When it happens, the message is not sent to the group.(I already sent it to you on Discord, but I’m sending it here as well to keep things consistent)

Thank you. I need to handle this properly (hosted/coex)

@purpshell
Copy link
Member

image
I’m facing the error above. When it happens, the message is not sent to the group.(I already sent it to you on Discord, but I’m sending it here as well to keep things consistent)

Thank you. I need to handle this properly (hosted/coex)

Can't merge at all without coex you need to add it :V

@Salientekill
Copy link

When the coex is added, please let me know so I can test it.

@jlucaso1
Copy link
Collaborator Author

@Santosl2 can you test again?

@purpshell review my last commit only, check if makes sense. I don't know if this is related to libsignal wasm only (I have dont change any code with this hosted logic). But I'm forcing since deviceId 99 is reserved to be hosted.

CC: @Salientekill

@Salientekill
Copy link

@Santosl2 can you test again?

@purpshell review my last commit only, check if makes sense. I don't know if this is related to libsignal wasm only (I have dont change any code with this hosted logic). But I'm forcing since deviceId 99 is reserved to be hosted.

CC: @Salientekill

What exactly is CC?

@Santosl2
Copy link
Contributor

@Santosl2 can you test again?

@purpshell review my last commit only, check if makes sense. I don't know if this is related to libsignal wasm only (I have dont change any code with this hosted logic). But I'm forcing since deviceId 99 is reserved to be hosted.

CC: @Salientekill

i'll test it.. And you're correct, this isn't related to libsignal WASM. Its a hosted bug. Sorry, i reported in the wrong PR

@Santosl2
Copy link
Contributor

After connecting and sending a message, the messages remain in a “Waiting for this message” state on all phones (this doesn’t happen all the time, but it does happen quite often).
image

@jlucaso1
Copy link
Collaborator Author

After connecting and sending a message, the messages remain in a “Waiting for this message” state on all phones (this doesn’t happen all the time, but it does happen quite often).

This is after a long time with bot offline? There is a way to reproduce?

@Santosl2
Copy link
Contributor

After connecting and sending a message, the messages remain in a “Waiting for this message” state on all phones (this doesn’t happen all the time, but it does happen quite often).

This is after a long time with bot offline? There is a way to reproduce?

Hmm i couldn't find a way to simulate this. I simply created a new connection, connected it, and sent a message to a group. All the messages i sent stayed in the "Waiting for message" state (this appears on all devices: ios, android and whatsapp web)

@Santosl2
Copy link
Contributor

After connecting and sending a message, the messages remain in a “Waiting for this message” state on all phones (this doesn’t happen all the time, but it does happen quite often).

This is after a long time with bot offline? There is a way to reproduce?

Hmm i couldn't find a way to simulate this. I simply created a new connection, connected it, and sent a message to a group. All the messages i sent stayed in the "Waiting for message" state (this appears on all devices: ios, android and whatsapp web)

Yes exactly like that. I tested it on more than 5 instances. All of them, when connected, always get this error when sending messages to groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.