Skip to content

feat: Support v2 storage and send notification for each token#4

Merged
kenstir merged 17 commits into
mainfrom
feat/json-storage
Apr 13, 2026
Merged

feat: Support v2 storage and send notification for each token#4
kenstir merged 17 commits into
mainfrom
feat/json-storage

Conversation

@kenstir
Copy link
Copy Markdown
Owner

@kenstir kenstir commented Apr 10, 2026

Overview

Add support for passing multiple time-stamped push notification tokens in
the token param as a base64url-encoded JSON object.

Details

  • Add struct TokenStore (TS), which stores a limited number of
    time-stamped push notification (PN) tokens in FIFO order
  • Make FromString support a plain PN token (v1) or a base64url-encoded
    JSON TS object (v2)
  • Treat v1 tokens as new, so old apps will stay working forever
  • Implement Add / Find for completeness even though unused
  • Add 1y cutoff after which v2 tokens are considered expired
  • Send a PN for each unexpired token in the TS

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for accepting either a legacy single push token (v1) or a JSON token-store object (v2) via the existing token parameter, enabling multi-token sends and token-age validation.

Changes:

  • Introduces TokenStore/TokenEntry with JSON marshal/unmarshal and “string-or-JSON” parsing.
  • Updates /send handler to parse token into a TokenStore, send notifications per entry, and refactors result/status classification.
  • Adds unit tests for token store behavior and updates module metadata to include go-cmp.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
token_store.go Adds token store model + JSON/string parsing helpers.
token_store_test.go Adds unit tests for token store add/find/JSON/from-string behavior.
sendmsg.go Sends to multiple tokens, adds expiry checks, refactors error→result/status logic.
go.mod Updates module path and adds github.com/google/go-cmp dependency.
buildinfo.go Adjusts build info formatting for goreleaser builds (short commit/date).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread token_store.go Outdated
Comment thread token_store.go Outdated
Comment thread sendmsg.go Outdated
Comment thread sendmsg.go
Comment thread sendmsg.go
Comment thread token_store_test.go
@kenstir kenstir changed the title feat: Support JSON token storage feat: Send multiple notifications if token a JSON token store Apr 10, 2026
@kenstir kenstir changed the title feat: Send multiple notifications if token a JSON token store feat: Send multiple notifications if token is a JSON token store Apr 10, 2026
Copy link
Copy Markdown
Owner Author

@kenstir kenstir left a comment

Choose a reason for hiding this comment

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

self-check: pass

@kenstir kenstir changed the title feat: Send multiple notifications if token is a JSON token store feat: Support v2 token storage and send notification for each token Apr 11, 2026
@kenstir kenstir changed the title feat: Support v2 token storage and send notification for each token feat: Support v2 storage and send notification for each token Apr 11, 2026
kenstir added 6 commits April 12, 2026 12:06
because EG corrupts user settings that contain double quotes.
This test uses a known good encoding to ensure that the
encoder/decoder used is compatible with other platform
implementations.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread token_store.go
Comment thread token_store.go
Comment thread token_store.go
Comment thread token_store_test.go
@kenstir kenstir merged commit 726ba64 into main Apr 13, 2026
7 checks passed
@kenstir kenstir deleted the feat/json-storage branch April 13, 2026 20:38
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.

2 participants