Most Go services pull in third-party Web Push libraries to deliver offline browser notifications. With Go 1.26 (crypto/ecdh, crypto/hkdf, crypto/aes, crypto/cipher, crypto/ecdsa), you can implement the full RFC 8291 (aes128gcm) encryption and RFC 8292 (VAPID ES256 JWT) stack in ~180 lines of pure standard library code with zero external dependencies.
We just shipped this in production at AsianScore to push live kickoff, goal, and full-time football & NBA alerts directly to browsers even after users close the tab.
1. Why Zero-Dependency Web Push Matters in Production
When running a lightweight single-binary live scoreboard (AsianScore Live Scores), keeping the dependency tree minimal avoids supply-chain churn and keeps container images tiny.
The browser Web Push protocol requires only two cryptographic building blocks:
- RFC 8292 VAPID ES256 JWT: Authenticates your application server to FCM / Apple Web Push / Mozilla Autopush using a persistent P-256 keypair.
- RFC 8291
aes128gcmPayload Encryption: Performs ephemeral ECDH key agreement against the browser'sp256dhpublic key, derives the 16-byte Content Encryption Key (CEK) and 12-byte nonce via HKDF-SHA256, and seals the payload with AES-128-GCM.
2. Core RFC 8291 Encryption in Pure Go 1.26
// RFC 8291 §3.3 + RFC 8188 aes128gcm using Go 1.26 stdlib crypto/ecdh & crypto/hkdf keyInfo := append(append([]byte("WebPush: info\x00"), uaPubBytes...), asPubBytes...) ikm, _ := hkdf.Key(sha256.New, ecdhSecret, authSecret, string(keyInfo), 32) cek, _ := hkdf.Key(sha256.New, ikm, salt, "Content-Encoding: aes128gcm\x00", 16) nonce, _ := hkdf.Key(sha256.New, ikm, salt, "Content-Encoding: nonce\x00", 12) block, _ := aes.NewCipher(cek) gcm, _ := cipher.NewGCM(block) padded := append(append([]byte(nil), plaintext...), 0x02) // final record delimiter ciphertext := gcm.Seal(nil, nonce, padded, nil) Notice how clean crypto/hkdf in modern Go makes RFC 8291 — no manual HMAC-Extract/Expand boilerplate and zero external packages in go.mod.
3. Verifying End-to-End with Live Match Telemetry & Public SHA-256 Ledger
On the frontend, our Service Worker (/sw.js) receives the decrypted JSON payload ({ title, body, url, tag }) and opens the exact match page with real-time events, boxscores, and lineups.
We pair this real-time stack with two open resources for sports developers and quantitative researchers:
- Public SHA-256 Pre-Match Prediction Audit Ledger (currently 355 locked / 253 settled, 56.92% Top-1 hit rate, 0.1783 mean Brier Score using our
hybrid-xg-elo-v2Power De-Vig + Dixon-Coles Bivariate Poisson model): https://asianscore.com/models.html#ledger - Zero-Auth Open REST API:
GET https://asianscore.com/api/ledgerandGET https://asianscore.com/api/scores - Client-Side Quant Tools Lab (Bivariate Poisson xG Matrix, Overround De-Vig, Half-Kelly, and free Shadow DOM live widget): https://asianscore.com/tools.html
- CC BY 4.0 Dataset Mirror: github.com/AIYIXIU/asianscore-xg-ledger-dataset
Feel free to test the public endpoints or inspect the live scoreboard at asianscore.com/scores.html!
