Skip to content

Comments

Refactor SenderKeyMessage to use static signature length#2301

Open
Kunboruto20 wants to merge 1 commit intoWhiskeySockets:masterfrom
Kunboruto20:patch-1
Open

Refactor SenderKeyMessage to use static signature length#2301
Kunboruto20 wants to merge 1 commit intoWhiskeySockets:masterfrom
Kunboruto20:patch-1

Conversation

@Kunboruto20
Copy link

This PR refactors the SenderKeyMessage class to make it easier to work with and more consistent across environments.
Changes include:
Internal fields now consistently use Uint8Array instead of mixing Buffer and Uint8Array, making it compatible with both Node and browsers.
Added a toJSON() method for quick inspection and logging of the message content.
Added verifySignatureAsync() for async-friendly signature verification that returns a boolean instead of throwing.
Retained the original verifySignature() behavior for backwards compatibility.
Introduced helper methods for safely handling base64/hex conversions and concatenating byte arrays.

@whiskeysockets-bot
Copy link
Contributor

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@Kunboruto20/Baileys#patch-1

# Yarn (v2+)
yarn add @whiskeysockets/baileys@Kunboruto20/Baileys#patch-1

# PNPM
pnpm add @whiskeysockets/baileys@Kunboruto20/Baileys#patch-1

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

@jlucaso1
Copy link
Collaborator

One more time? #2220 (comment)

@Salientekill
Copy link

One more time? #2220 (comment)

Is there anything relevant that could be used? Extracted into a separate PR that makes sense?

@github-actions
Copy link
Contributor

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 Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants