Documentation
¶
Overview ¶
Package push is the native mobile-push side of the companion app: a provider-agnostic Sender port plus the APNs adapter (apns.go) that implements it. It carries NO approval authority — a push is only a WAKE ("you have a pending approval"); the approve/deny happens in-app over the authenticated WebSocket, so the signed HITL decision never leaves the daemon. Which devices are reachable is the auth store's (a push token lives on the paired device); this package only delivers to tokens the caller supplies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APNS ¶
type APNS struct {
// contains filtered or unexported fields
}
APNS delivers pushes to Apple Push Notification service over HTTP/2 with a token-based (ES256 JWT) authorization. It implements Sender. The provider auth token is cached and reused up to APNs' one-hour ceiling (regenerated at ~50 minutes). Safe for concurrent use.
func APNSFromEnv ¶
APNSFromEnv builds the adapter from NOCTURN_APNS_KEY / _KEY_ID / _TEAM_ID / _BUNDLE_ID (and the optional NOCTURN_APNS_PRODUCTION). It returns (nil, nil) when NOCTURN_APNS_KEY is unset — push is simply off — so the caller falls back to a no-op.
func NewAPNS ¶
func NewAPNS(cfg APNSConfig) (*APNS, error)
NewAPNS parses the .p8 signing key and builds the adapter. It fails if the key is missing, not PEM, or not an ECDSA PKCS#8 key.
type APNSConfig ¶
type APNSConfig struct {
Key string
KeyID string
TeamID string
BundleID string
Production bool
OnBadToken func(token string)
// Host overrides the APNs host:port. Empty selects the live/sandbox host from Production.
Host string
// HTTPClient overrides the HTTP/2 client. Nil uses the default, which negotiates HTTP/2 via ALPN.
HTTPClient *http.Client
// contains filtered or unexported fields
}
APNSConfig configures the Apple Push adapter. Key is the token-signing key (a PKCS#8 EC private key downloaded from the Apple Developer portal) — either its PEM content or a path to the .p8; KeyID and TeamID identify it; BundleID is the app's bundle identifier (the apns-topic). Production selects the live APNs host vs the sandbox. OnBadToken, if set, is called with any token APNs reports permanently invalid, so the caller can drop it.