Skip to content

Support legacy Firebase IID registrations - #5

Open
iFixRobots wants to merge 1 commit into
mainfrom
codex/wechat-native-fcm
Open

iFixRobots wants to merge 1 commit into
mainfrom
codex/wechat-native-fcm

Conversation

@iFixRobots

Copy link
Copy Markdown
Contributor

WeChat accepted sender-only push tokens, but notifications never arrived. Add optional legacy Firebase IID metadata to Google registration and reuse the same instance ID when renewing or unregistering. Existing Chrome registrations keep their current behavior.

Windows and Linux build/vet passed. The isolated registration diagnostic received two account-matching WeChat pushes with the existing linked session. Runtime validation of the new library path is still pending.

@indent

indent Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
PR Summary

Adds an optional legacy Firebase Instance ID (IID) registration path so a client (WeChat) can register with c2dm/register3 as a real Android application instead of a Chrome browser subtype, fixing the case where sender-only tokens were accepted but notifications never arrived. The legacy path is opt-in via a new LegacyIID field; existing Chrome-style registrations are byte-for-byte unchanged.

  • Adds LegacyIIDConfig (package name, signing-cert SHA1, Firebase app id, app/GMS/OS versions, device/build) plus Validate() and NewLegacyInstanceID() in the new legacy_iid.go.
  • RegisterGCM: when opts.LegacyIID is set, builds the register3 form with Android-application params (X-appid=instance id, X-subtype/sender, X-gmp_app_id, versions) and adds app + User-Agent headers.
  • UnregisterGCM: gains a variadic options ...*GCMRegistrationOpts (backward compatible); the legacy branch sends delete=1 and confirms deletion against the package name.
  • Instance-ID generation and validation agree on the Android IID format (8 bytes, 0x70 version marker, canonical RawURL base64), and metadata is validated to prevent header injection before any header is set.

Issues

No issues found.

CI Checks

All CI checks passed on 4056115.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant