Documentation
¶
Overview ¶
FCM HTTP v1 — the Android leg of the push channel. Same contract as the APNs sender: a thin alert payload that wakes the app to fetch, never the vault's metadata. Service-account JSON in envs; OAuth2 JWT-bearer to mint send tokens — no firebase-admin dependency.
Package push sends wake-ups to registered phone devices. Two flows share the channel: an approval ask filed at the deny edge (the agent waits on the human's phone) and ops pages (monitor findings reaching the operator's lock screen instead of an unread inbox).
The payload is deliberately thin — type + ids + a generic title. No item names, no org data, no secrets: the message crosses Apple's or Google's servers, and a push should wake the app to fetch, not carry the vault's metadata through a third party.
APNs is token-auth (.p8 + key id + team id — the Apple-issued key, minted in the developer portal, held as envs). Unconfigured envs mean a nil sender and silent no-op: pushes are a wake channel, not the durable part — the request row and the email path carry the truth.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUnregistered ¶
IsUnregistered reports whether a send error means a dead token — APNs' BadDeviceToken/Unregistered reasons.
func IsUnregisteredFCM ¶
IsUnregisteredFCM reports whether the send error means the token's dead — FCM's UNREGISTERED, or a 404 which is the same verdict.
Types ¶
type Config ¶
type Config struct {
Key string // .p8 PEM contents — the Railway-able shape
KeyPath string // or a path to the .p8 file (local dev)
KeyID string
TeamID string
BundleID string // e.g. nyc.veil.phone
Prod bool // production APNs host; false = sandbox
}
Config is the APNs token-auth setup. Zero-value is a disabled sender.
func ConfigFromEnv ¶
func ConfigFromEnv() Config
ConfigFromEnv reads the APNS wiring. Key or KeyPath plus the ids set = configured.
type DeviceStore ¶
type DeviceStore interface {
PushDevices(orgID string) ([]protocol.PushDevice, error)
DeletePushDevice(orgID, token string) error
}
DeviceStore is the narrow read/write the Pusher needs — store.Store satisfies it, and so does a thin pool adapter for the monitor cron.
type FCMConfig ¶
type FCMConfig struct {
// ServiceAccount is the credential JSON's contents (env-friendly,
// same shape as the APNs .p8). ServiceAccountPath reads the file.
ServiceAccount string
ServiceAccountPath string
}
FCMConfig is the Android push setup — a Firebase service account's JSON plus the project it mints sends for. Zero-value is disabled.
type MultiSender ¶
MultiSender routes each device to its platform's sender — apns now, fcm when Android registers tokens.
type PoolDevices ¶
PoolDevices adapts a pgx pool to DeviceStore — the monitor cron has a pool, not a full Store.
func (PoolDevices) DeletePushDevice ¶
func (d PoolDevices) DeletePushDevice(orgID, token string) error
func (PoolDevices) PushDevices ¶
func (d PoolDevices) PushDevices(orgID string) ([]protocol.PushDevice, error)
type Pusher ¶
type Pusher struct {
// contains filtered or unexported fields
}
Pusher fans one notify out to every registered device of an org and prunes dead tokens — APNs reporting Unregistered means the device re-registers or is gone, and keeping it only wastes sends.
func New ¶
func New(s DeviceStore, sender Sender) *Pusher
New returns a Pusher over the org's registered devices. Sender nil = pushes are no-ops (envs unset, or a store that can't push).
func (*Pusher) NotifyOps ¶
NotifyOps pages an org's devices with monitor findings — the ops plane's own channel (findings arrive by name; the device is the page).
func (*Pusher) NotifyRequest ¶
NotifyRequest implements the app's RequestNotify shape — an approval ask wakes every registered device of the org.
type Sender ¶
type Sender interface {
Send(ctx context.Context, d protocol.PushDevice, title, body string, data map[string]string) error
}
Sender delivers one wake-up to one device. Implementations exist per platform (apns now; fcm when an Android build registers tokens).
func NewAPNSSender ¶
NewAPNSSender builds the APNs sender from the config — nil when unconfigured so callers can hold a nil Sender.
func NewFCMSender ¶
NewFCMSender builds the Android sender — nil when unconfigured.