-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
implement message reporting tokens #1906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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 worksIf you’ve tested this PR, please comment below with: This helps us speed up the review and merge process. 📦 To test this PR locally:If you encounter any issues or have feedback, feel free to comment as well. |
34ac312 to
02f329b
Compare
96f2b48 to
a2330d2
Compare
src/Utils/history.ts
Outdated
|
|
||
| if (chat.tcToken) { | ||
| privacyTokens.push({ | ||
| jid: jidNormalizedUser(chat.id!), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to verify LID/PN discrepancy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the best way to handle that? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can handle same as #1912
9156372 to
ae1c039
Compare
|
I got banned for adding the bot to a group with 514 members. If this solves it, it will be of great help. I look forward to this beautiful work. |
ae1c039 to
8dd1315
Compare
51c7201 to
79f3938
Compare
…to reporting-tctoken-elements
…to reporting-tctoken-elements
|
up |
- Add reporting token and privacy token handling - Implement tcToken elements for message reporting - Add support for reportingTokens in messages - Update message processing for privacy tokens 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Maybe we can get some inspirations here: canove/whaileys#51 |
…ns and privacy token handling This PR adds support for message reporting tokens and privacy token handling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…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]>
…ns and privacy token handling Implements comprehensive privacy token and message reporting token handling to match whatsmeow implementation. New features: - Message reporting token generation for eligible messages - Privacy token storage and retrieval (in-memory by default) - Trusted contact token (tcToken) support for profile pictures and messages - LID (Local Identity) mapping support for privacy tokens Files changed: - NEW: src/Utils/reporting-utils.ts (262 lines) - Modified: 11 files across Socket/, Types/, and Utils/ directories Key improvements: - Automatic message secret generation for reporting-eligible messages - Privacy token handling in message send/receive - Enhanced history sync with privacy token extraction - Profile picture requests now support tcToken parameter All conflicts resolved and build successful. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
… privacy token handling
|
Any updates @jlucaso1 |
|
Removed tctoken in favor of #2080 |
|
is the changes in |
|
@vinikjkkj thank you. I didnt noticed that. Reverting. |
|
Tested and working ✅ |
|
@jlucaso1 left a few coments. I asked Claude code to check and optimize reporting-utils, and, according to him, there was an improvement in performance. The changes it made seem to make sense, mainly because it avoids the |
|
instead of creating a "mini-protobuf" implementation (decode/encode varint), we cannot just use existent proto.ReportingTokenInfo? |
I think is not simple like that. Check what waweb does (WABinary/WAWebReportingTokenProtobufUtils) |
|
@canove applied your suggestion, thank you! extra: added some unit tests to evict regressions |
src/Socket/messages-send.ts
Outdated
|
|
||
| if (!isNewsletter) { | ||
| if ( | ||
| reportingMessage && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you could put everything in a single if statement to avoid nesting; just add !isNewsletter to the inner if statement.
src/Socket/messages-send.ts
Outdated
| reportingMessage && | ||
| shouldIncludeReportingToken(reportingMessage) && | ||
| reportingMessage.messageContextInfo?.messageSecret && | ||
| msgId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this msgId here; it always exists.
One question: in which cases should we NOT send the reporting token?
Seems like we are not sending on retryResponses neither newsletter. Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this msgId here; it always exists.
Nice catch, removed.
Yes, that's correct. Based on WhatsApp Web JS (isMsgTypeReportingTokenCompatible):
Should NOT send reporting token:
- reactionMessage / encReactionMessage
- pollUpdateMessage
- encEventResponseMessage
- Newsletters (different path, not E2E encrypted) (maybe we need to handle properly in the future, but need to check this logic deeper)
- Retries (reportingMessage is only set when !isRetryResend)
Should send: All other regular content messages (text, image, video, audio, document, sticker, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we can put !isRetryResend inside de if statement to make it more explicit.
Also, remove the reportingMessage &&, since checking the reportingMessage?.messageContextInfo?.messageSecret does the trick.
canove
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left a comment about adding the !isRetryResend on the if statement to make it more comprehensible. but not blocking.
lgtm
|
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 |
to match whatsmeow implementation of this elements