Skip to content

feat(baileys): add passkey companion-linking ceremony#2628

Open
mateus2001ferreira wants to merge 1 commit into
evolution-foundation:mainfrom
mateus2001ferreira:feat/passkey-companion-linking
Open

feat(baileys): add passkey companion-linking ceremony#2628
mateus2001ferreira wants to merge 1 commit into
evolution-foundation:mainfrom
mateus2001ferreira:feat/passkey-companion-linking

Conversation

@mateus2001ferreira

Copy link
Copy Markdown

Description

Adds opt-in support for WhatsApp's passkey (Shortcake/CRSC) companion-linking flow, which some numbers now require when linking a device. Implemented on top of Baileys' public API — no fork or patch of Baileys needed.

How it works:

  • A browser helper extension performs the WebAuthn assertion on the web.whatsapp.com origin.
  • PasskeyCeremony handles the server's passkey_prologue_request / crsc_continuation notifications and replies with the matching IQs (passkey_prologue, companion_nonce, encrypted_pairing_request).
  • Public endpoints GET/POST /passkey-ceremony/:token[/response|/confirm] let the extension read the challenge and submit the assertion; the current stage and open URL are exposed via connectionState.

Gated behind PASSKEY_CEREMONY_ENABLED=true (default off), since a malformed IQ can get a number banned. Also requires:

  • PASSKEY_PUBLIC_URL — API base reachable by the browser running WhatsApp Web
  • CORS_ORIGIN allowing * or https://web.whatsapp.com

Crypto is an independent reimplementation of whatsmeow's pair-passkey.go (MPL-2.0); no code copied. No dependency changes (works on the current Baileys 7.0.0-rc.9).

Type of Change

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have made corresponding changes to the documentation
  • I have manually tested my changes thoroughly
  • Any dependent changes have been merged and published

Additional Notes

The feature ships a small browser helper extension (public/passkey-helper.zip) that performs the WebAuthn assertion. Happy to discuss whether shipping it in-repo, as source, or as a separate distribution is preferable. Also glad to add the two env vars to .env.example if the approach is accepted.

Add opt-in support for WhatsApp's passkey (Shortcake/CRSC) companion-linking
flow, implemented on top of Baileys' public API without forking it. A browser
helper extension performs the WebAuthn assertion; the ceremony is driven via
public /passkey-ceremony endpoints and exposed through connectionState.
Gated behind PASSKEY_CEREMONY_ENABLED (default off) since a malformed IQ can
get the number banned. Requires PASSKEY_PUBLIC_URL reachable by the browser.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @mateus2001ferreira, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant