Skip to content

feat: add push notification subscription TrUAPI methods#187

Draft
pgherveou wants to merge 2 commits into
mainfrom
worktree-push-subscriptions
Draft

feat: add push notification subscription TrUAPI methods#187
pgherveou wants to merge 2 commits into
mainfrom
worktree-push-subscriptions

Conversation

@pgherveou

Copy link
Copy Markdown
Collaborator

Summary

Exposes the v2 push backend's rule-management endpoints to products as TrUAPI:
push_add_rules, push_remove_rules, push_list_rules, push_set_rules, and
the interim push_broadcast direct submit. Rules are (signer, topic) pairs;
add/set require the Notifications device permission, remove/list/
broadcast do not. The host attests the broadcast signer.

Spec: Push Notification Subscriptions RFC (notification-subscriptions repo, docs/rfcs/push-notification-subscriptions.md).

Changes

  • New protocol/v1/pushSubscription.ts with PushRule and five SCALE codecs; registered in impl.ts.
  • Five new HostApi methods and matching Container slots/handlers.
  • Wrapper modules pushSubscription.ts (rule mgmt) and pushBroadcast.ts (interim broadcast).
  • Extended makeDevicePermissionGatedRequestSlot with an optional makePermissionDeniedError so callers with a dedicated PermissionDenied variant return the right error (default preserves existing behavior).
  • 28 new tests covering round-trips, idempotency, permission gating, default not-implemented behavior, and the host-attested broadcast signer constraint.

Follow-up (separate PRs in each host repo)

Each host (polkadot-app-ios-v2, polkadot-app-android-v2) needs to wire container.handlePushAddRules / RemoveRules / ListRules / SetRules / Broadcast in its product-container/src/index.ts and add the matching native bridge methods.


Authored with assistance from Claude Code.

pgherveou added 2 commits May 28, 2026 11:12
Adds five new TrUAPI methods exposing the v2 push backend's
rule-management endpoints: push_add_rules, push_remove_rules,
push_list_rules, push_set_rules, plus the interim push_broadcast
direct submit path. Rules are (signer, topic) pairs grouped per
publisher; add/set require the Notifications device permission,
remove/list/broadcast do not. The host attests the broadcast
signer, so the product cannot supply it.

Also extends makeDevicePermissionGatedRequestSlot with an optional
makePermissionDeniedError so callers whose error enum has a
PermissionDenied variant can return the correct error when permission
is denied vs when the host has not implemented the method.
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