Documentation
¶
Overview ¶
Package axmwebhook composes signed AXM callback receipt with durable inventory refresh. The host supplies an encrypted inventory backend, HTTP routing, administration and worker supervision. Receipt and pending work commit together; Apple callbacks are retained separately from subsequently fetched evidence. Subscription provisioning is explicit and uncertain POST outcomes are never automatically resubmitted. The package does not implement outbound native webhooks.
Index ¶
- Constants
- type Binding
- type Coordinator
- func (c *Coordinator) Binding(ctx context.Context, account, id string) (Binding, error)
- func (c *Coordinator) Bindings(ctx context.Context, account, after string) ([]Binding, error)
- func (c *Coordinator) Prepare(ctx context.Context, accountID, publicURL string) (Binding, error)
- func (c *Coordinator) Receipts(ctx context.Context, account, id, after string, raw bool) ([]Receipt, error)
- func (c *Coordinator) Receive(ctx context.Context, id string, req *http.Request) (Receipt, error)
- func (c *Coordinator) Rotate(ctx context.Context, b Binding, overlap time.Duration) (Binding, error)
- func (c *Coordinator) SetState(ctx context.Context, b Binding, state, remoteID string) (Binding, error)
- func (c *Coordinator) SigningSecret(ctx context.Context, b Binding) ([]byte, error)
- type Receipt
Constants ¶
const CallbackPath = "/axm/notifications/"
CallbackPath is mounted on the public server; IDs select keys, not authority.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct {
ID string `json:"id"`
AccountID string `json:"account_id"`
AccountCreatedAt time.Time `json:"account_created_at"`
AccountRevision int64 `json:"account_revision"`
Revision int64 `json:"revision"`
RemoteID string `json:"remote_id,omitempty"`
CallbackURL string `json:"callback_url"`
State string `json:"state"`
CreatedAt time.Time `json:"created_at"`
LastReceivedAt time.Time `json:"last_received_at,omitzero"`
}
Binding is safe local subscription metadata. Revision fences administrative updates.
type Coordinator ¶
type Coordinator struct{ Repository *inventory.Repository }
Coordinator requires a backend whose persistence/encryption contract is supplied by the host. The reference app enables it only with encrypted SQL storage.
func (*Coordinator) Binding ¶
Binding returns safe local metadata for an explicitly selected account.
func (*Coordinator) Prepare ¶
Prepare stores a signing key and provisioning intent before the Apple POST. A caller retries by inspecting this ID, never by issuing another create.
func (*Coordinator) Receipts ¶
func (c *Coordinator) Receipts(ctx context.Context, account, id, after string, raw bool) ([]Receipt, error)
Receipts returns a bounded selected-binding page; raw controls body disclosure.
func (*Coordinator) Receive ¶
Receive verifies and commits receipt and work atomically. Repeated identical provider identities are harmless; different bytes under an existing ID conflict.
func (*Coordinator) Rotate ¶
func (c *Coordinator) Rotate(ctx context.Context, b Binding, overlap time.Duration) (Binding, error)
Rotate persists a new signing key before an explicit remote update. Failed updates remain uncertain and require reconciliation. Overlap is at most a day.
func (*Coordinator) SetState ¶
func (c *Coordinator) SetState(ctx context.Context, b Binding, state, remoteID string) (Binding, error)
SetState fences stale credentials/account incarnations before recording remote results. State is active, uncertain or disabled. Remote network I/O stays outside the transaction. Reconciliation supplies a verified remote ID explicitly.
func (*Coordinator) SigningSecret ¶
SigningSecret is only for an already-authorized provisioning call, never reads.
type Receipt ¶
type Receipt struct {
ID string `json:"id"`
BindingID string `json:"binding_id"`
EventID string `json:"event_id"`
Type string `json:"type"`
Digest string `json:"digest"`
At time.Time `json:"at"`
Body []byte `json:"body"`
JobID string `json:"job_id,omitempty"`
}
Receipt retains exact original bytes independently from inventory observations. Hosts must apply raw-data authority before exposing Body.