Skip to content

Conversation

@vinikjkkj
Copy link
Collaborator

@vinikjkkj vinikjkkj commented Sep 20, 2025

I created a new libsignal that uses Whatsapp Web native methods, I need that you test.

Need to Work:

  • Replace libsignal/curve calls
  • Investigate first decryption error on 1:1

This libsignal will break your session-* sender-key*, delete them to reuse an existent session

@whiskeysockets-bot
Copy link
Contributor

whiskeysockets-bot commented Sep 20, 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#new-libsignal

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

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

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

@jlucaso1
Copy link
Collaborator

great job @vinikjkkj
Just check the yarn.lock too (i think you regenerated using yarn v1 so this caused a lot of changes) You can restore as default and readd you dependency

@vinikjkkj
Copy link
Collaborator Author

fixed, i'll work on the rest later

@Salientekill
Copy link

fixed, i'll work on the rest later

Can I download and test it? Is it usable?

@jlucaso1
Copy link
Collaborator

@Salientekill only 1-1 dm messages are working, so is not stable yet

@vinikjkkj
Copy link
Collaborator Author

it's working on dm and groups

@jlucaso1
Copy link
Collaborator

@vinikjkkj oops I misunderstood, sorry

@Salientekill
Copy link

Deu erro ao tentar utilizar:

node:internal/modules/esm/resolve:999
    throw error;
    ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/root/sung/node_modules/libsig
nal-waweb/dist/registry' imported from /root/sung/node_modules/libsignal-waweb/d
ist/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:859:10)
    at defaultResolve (node:internal/modules/esm/resolve:983:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:717:20)
    at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:753
:38)
    at ModuleLoader.resolveSync (node:internal/modules/esm/loader:776:52)
    at #cachedResolveSync (node:internal/modules/esm/loader:736:25)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:457
:50)
    at new ModuleJobSync (node:internal/modules/esm/module_job:395:34)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:516
:11) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///root/sung/node_modules/libsignal-waweb/dist/registry'
}
Node.js v22.19.0

@Salientekill
Copy link

I did the test, I only had problems with freezing, I sent messages in private and then in the group it stopped responding, and from time to time the messages were being ignored in the groups

@purpshell
Copy link
Member

I did the test, I only had problems with freezing, I sent messages in private and then in the group it stopped responding, and from time to time the messages were being ignored in the groups

did you clear your sessions & sender key states?

@purpshell
Copy link
Member

This libsignal will break your session- sender-key, delete them to reuse an existent session**

Can we migrate this somehow? I don't think we can merge a change like this while having it break.

@Salientekill
Copy link

I did the test, I only had problems with freezing, I sent messages in private and then in the group it stopped responding, and from time to time the messages were being ignored in the groups

did you clear your sessions & sender key states?

I deleted the connection and connected again to generate everything new, so I didn't have any problems, but I had this crash issue, João is in my group and I told him about it, it could be my code

@purpshell purpshell force-pushed the master branch 2 times, most recently from 038216d to 54db127 Compare October 7, 2025 17:29
@Salientekill
Copy link

I found it interesting, and as soon as Jlucaso's PR from ctoken is merged, I will test this one because it seems quite promising, and perhaps it will solve current freezing and other problems I've been having.

@Salientekill
Copy link

Salientekill commented Nov 2, 2025

@vinikjkkj I tried to install it to test it, but unfortunately I'm unable to download it. Could you please contact Pushmaster and fix the problems? error:

root@vmi2552617:~/bot3/SUNGBOT# npm install @whiskeysockets/baileys@WhiskeySockets/baileys#new-libsignal
npm error code 2
npm error git dep preparation failed
npm error command /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/root/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error > [email protected] preinstall
npm error > node ./engine-requirements.js
npm error
npm error
npm error > [email protected] prepare
npm error > npm run build
npm error
npm error
npm error > [email protected] build
npm error > tsc -P tsconfig.build.json && tsc-esm-fix --tsconfig=tsconfig.build.json --ext=.js
npm error
npm error src/Signal/Group/group_cipher.ts(3,31): error TS2307: Cannot find module './sender-key-name' or its corresponding type declarations.
npm error src/Signal/Group/sender-chain-key.ts(2,34): error TS2307: Cannot find module './sender-message-key' or its corresponding type declarations.
npm error src/Signal/Group/sender-key-distribution-message.ts(2,35): error TS2307: Cannot find module './ciphertext-message' or its corresponding type declarations.
npm error src/Signal/Group/sender-key-distribution-message.ts(49,51): error TS2339: Property 'CURRENT_VERSION' does not exist on type 'SenderKeyDistributionMessage'.
npm error src/Signal/Group/sender-key-distribution-message.ts(49,73): error TS2339: Property 'CURRENT_VERSION' does not exist on type 'SenderKeyDistributionMessage'.
npm error src/Signal/Group/sender-key-distribution-message.ts(77,15): error TS2339: Property 'SENDERKEY_DISTRIBUTION_TYPE' does not exist on type 'SenderKeyDistributionMessage'.
npm error src/Signal/Group/sender-key-message.ts(3,35): error TS2307: Cannot find module './ciphertext-message' or its corresponding type declarations.
npm error src/Signal/Group/sender-key-message.ts(45,28): error TS2339: Property 'CURRENT_VERSION' does not exist on type 'SenderKeyMessage'.
npm error src/Signal/Group/sender-key-message.ts(45,57): error TS2339: Property 'CURRENT_VERSION' does not exist on type 'SenderKeyMessage'.
npm error src/Signal/Group/sender-key-message.ts(58,31): error TS2339: Property 'CURRENT_VERSION' does not exist on type 'SenderKeyMessage'.
npm error src/Signal/Group/sender-key-state.ts(2,34): error TS2307: Cannot find module './sender-message-key' or its corresponding type declarations.
npm error src/Signal/libsignal.ts(296,24): error TS2339: Property 'haveOpenSession' does not exist on type 'SessionRecord'.
npm error src/Socket/socket.ts(859,12): error TS2339: Property 'reply' does not exist on type 'Promise<{ creds: Partial<AuthenticationCreds>; reply: BinaryNode; }>'.
npm error src/Socket/socket.ts(859,19): error TS2339: Property 'creds' does not exist on type 'Promise<{ creds: Partial<AuthenticationCreds>; reply: BinaryNode; }>'.
npm error src/Utils/signal.ts(179,10): error TS2339: Property 'newPreKeys' does not exist on type 'Promise<{ newPreKeys: { [id: number]: KeyPair; }; lastPreKeyId: number; preKeysRange: readonly [number, number]; }>'.
npm error src/Utils/signal.ts(179,22): error TS2339: Property 'lastPreKeyId' does not exist on type 'Promise<{ newPreKeys: { [id: number]: KeyPair; }; lastPreKeyId: number; preKeysRange: readonly [number, number]; }>'.
npm error src/Utils/signal.ts(179,36): error TS2339: Property 'preKeysRange' does not exist on type 'Promise<{ newPreKeys: { [id: number]: KeyPair; }; lastPreKeyId: number; preKeysRange: readonly [number, number]; }>'.
npm error npm warn using --force Recommended protections disabled.
npm error npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm error npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm error npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm error npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm error npm warn deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm error npm warn deprecated [email protected]: Use your platform's native DOMException instead
npm error npm warn using --force Recommended protections disabled.
npm error npm error code 2
npm error npm error path /root/.npm/_cacache/tmp/git-cloneunJB45
npm error npm error command failed
npm error npm error command sh -c npm run build
npm error npm error A complete log of this run can be found in: /root/.npm/_logs/2025-11-02T21_15_25_500Z-debug-0.log
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-11-02T21_15_19_375Z-debug-0.log

Copy link
Member

@purpshell purpshell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, jlucaso1 finished up most of his Rust implementation and I believe it is a better fit for the project since:

  1. if WhatsApp makes some breaking change in their library, it will cascade down eventually to our code which is a vector
  2. It could be an automation detection vector somehow eventually
  3. It could be a security / enc risk
  4. Performance gain is minimal compared to Rust based WASM
  5. We can control the source code and execution context, we might turn the WASM approach back into N-API if we wished so, additionally we can make more performance improvements than simply relying on whatsapp web's signal which assumes each session has gigabytes of ram and lots of CPU to play with.

Other than that, I believe your ideas are super creative and I love this one specifically. Keep tinkering man!!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2025

This PR is stale because it has been open for 14 days with no activity. Remove the stale label or comment or this will be closed in 14 days

@github-actions github-actions bot added the Stale label Dec 7, 2025
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.

6 participants