Add Android push notifications via Firebase Cloud Messaging#3
Merged
Add Android push notifications via Firebase Cloud Messaging#3
Conversation
Implement processAndroidNotification() using the Firebase Admin Go SDK (firebase.google.com/go/v4). The Firebase messaging client is initialized once at worker startup from a service account credentials file and reused for every notification. If no credentials file is configured the service degrades gracefully with a warning log. - Notification payload mirrors APNs: title "Vultisig Keysign request", body "Vault: <name>", and QR code data passed as a data field - Stale/unregistered FCM tokens (IsUnregistered error) trigger automatic device cleanup from the database, matching APNs behaviour - Add FirebaseCredentials field to Config (firebase-credentials key) - Update NewNotificationService constructor with credentials parameter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Combines Android Firebase Cloud Messaging (this branch) with VAPID web push notifications from the merged branch. Both features are preserved: Firebase for Android devices, VAPID for web browsers. - NotificationService struct now holds both firebaseMessaging client and VAPID key fields - Constructor accepts firebaseCredentials + vapidPublicKey/PrivateKey/Subscriber - Config struct includes both firebase-credentials and vapid-* keys - go.mod/go.sum regenerated cleanly via go mod tidy Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
processAndroidNotification()using the official Firebase Admin Go SDK (firebase.google.com/go/v4)*messaging.Clientis initialised once at worker startup from a service account credentials file and reused for every notification (no per-request re-initialisation)firebase-credentialsis empty/unset the worker starts normally and android notifications are skipped with a warning log (graceful degradation)Changes
service/notification.gofirebaseMessagingfield, update constructor, implementprocessAndroidNotification()config/config.goFirebaseCredentialsmapped tofirebase-credentialsconfig keycmd/worker/main.gocfg.FirebaseCredentialsto service constructorgo.mod/go.sumfirebase.google.com/go/v4dependencyNotification payload
Mirrors the existing APNs notification:
"Vultisig Keysign request""Vault: <vault_name>"{"message": "<qr_code_data>"}Stale tokens (
IsUnregisteredFCM error) trigger automatic device removal from the database, matching the existing APNs behaviour.Test plan
cmd/worker/firebase-service-account.jsonand set"firebase-credentials"inconfig.jsonPOST /registerwithdevice_type: "android"POST /notifywith the matchingvault_idand confirm the device receives the notificationgo test ./...🤖 Generated with Claude Code