applicationpackages

package
v0.10.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package applicationpackages hosts verified installer revisions for native MDM and DDM delivery through enrollment-scoped download grants.

Design

Host uses the applications library for metadata, content and manifest integrity. Prepare validates the enrolled device's capabilities and creates a bounded grant for one immutable revision. Only the grant token's hash is stored. Fetch checks expiry, revocation, enrollment status and package availability on every request. Download URLs are bearer credentials and require HTTPS and access-log redaction.

The reference server authorizes operators, dispatches the prepared MDM command or DDM publication and observes device results. Preparing or queuing a package does not establish installation. Revoke removes download access; removing a DDM assignment or uninstalling an application remains a separate device operation.

References

Index

Constants

View Source
const Path = "/applications/download/"

Path is the public download prefix. Redact the next path component before logs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Packages  *applications.Manager
	State     state.Store
	BaseURL   string
	Now       func() time.Time
	Target    func(context.Context, mdm.EnrollmentID) (support.Target, error)
	Authorize func(context.Context, mdm.EnrollmentID) error
}

Config separates verified content from enrollment authorization and dispatch.

type Grant

type Grant struct {
	ID              string           `json:"id"`
	Enrollment      mdm.EnrollmentID `json:"enrollment"`
	PackageID       string           `json:"packageId"`
	ContentRevision string           `json:"contentRevision"`
	Method          string           `json:"method"`
	ExpiresAt       time.Time        `json:"expiresAt"`
}

Grant describes one expiring download capability. Its bearer token is never retained; ID is the token hash used for explicit revocation by the operator.

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host prepares device-specific delivery and authorizes immutable downloads.

func New

func New(cfg Config) (*Host, error)

New validates the HTTPS hosting origin and required enrollment hooks.

func (*Host) Content

func (h *Host) Content(ctx context.Context, token string) (applications.Content, Grant, error)

Content returns immutable metadata after authenticating the download grant.

func (*Host) Manifest

func (h *Host) Manifest(ctx context.Context, token string) ([]byte, Grant, error)

Manifest returns the library-generated plist for the grant's immutable revision.

func (*Host) Open

func (h *Host) Open(ctx context.Context, token string, offset, length int64) (io.ReadCloser, applications.Content, error)

Open checks grant liveness and opens the selected bounded package range.

func (*Host) Prepare

func (h *Host) Prepare(ctx context.Context, id mdm.EnrollmentID, packageID, revision, method string, ttl time.Duration) (Plan, error)

Prepare validates metadata and Apple's platform rules before creating a grant. method is mdm or ddm. TTL defaults to one hour and may not exceed seven days. DDM requests a required install; optional self-service policy is not implied.

func (*Host) Revoke

func (h *Host) Revoke(ctx context.Context, id mdm.EnrollmentID, grantID string) error

Revoke removes one capability only when it belongs to the addressed enrollment. Revocation is idempotent after the grant expires or has already been removed.

type Plan

type Plan struct {
	Grant       Grant
	ManifestURL string
	Command     *mdm.Command
	Publication ddm.SetPublication
}

Plan contains the exact protocol payload to dispatch after preparation. The server returns Grant and dispatch IDs to operators; URLs and payloads are secrets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL