implement message reporting tokens (#1906)
* feat: implement message reporting tokens and privacy token handling * feat: add support for privacy tokens in profile picture requests and history sync * chore: pr feedback purpshell * fix: improve privacy token handling and error messaging in socket configuration * feat: enhance privacy token handling with improved sender mapping * chore: removing tc token in favor of #2080 * chore: revert some unecessary changes * feat(reporting): enhance reporting token extraction and compilation logic * feat(reporting): add unit tests for reporting token utilities * fix(reporting): streamline reporting token attachment logic in message sending * fix: adjust reporting token inclusion logic to prevent retries * chore: add return type to shouldIncludeReportingToken and improve getToken function type safety
This commit is contained in:
committed by
GitHub
parent
4e681d3219
commit
c9c3481817
@@ -40,6 +40,7 @@ import {
|
||||
getRawMediaUploadData,
|
||||
type MediaDownloadOptions
|
||||
} from './messages-media'
|
||||
import { shouldIncludeReportingToken } from './reporting-utils'
|
||||
|
||||
type MediaUploadData = {
|
||||
media: WAMediaUpload
|
||||
@@ -617,6 +618,13 @@ export const generateWAMessageContent = async (
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldIncludeReportingToken(m)) {
|
||||
m.messageContextInfo = m.messageContextInfo || {}
|
||||
if (!m.messageContextInfo.messageSecret) {
|
||||
m.messageContextInfo.messageSecret = randomBytes(32)
|
||||
}
|
||||
}
|
||||
|
||||
return WAProto.Message.create(m)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user