support

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package support answers "is this key supported on this OS, version, channel, and enrollment context?" at runtime, from tables generated out of the supportedOS blocks in Apple's device management schema.

Why

Apple's YAML records, per key, the OS version that introduced it, deprecated it, or removed it, whether it needs supervision, and whether it is allowed on user enrollment, Shared iPad, or the user channel. Most implementations drop that data at generation time; decision record 0003 keeps it, so a server can refuse to send a key the target device will reject and an operator tool can explain a command. Generated packages register their tables in init; callers query them through Lookup or, indirectly, through the generated Validate methods when given a Target. Phase 1 of the plan of record delivers the tables with the schema packages, and phase 8's dmctl explain reads them.

The package holds the query logic and the types; the tables themselves are generated and never hand-edited.

References

Index

Constants

This section is empty.

Variables

View Source
var AllOS = []OS{IOS, MacOS, TvOS, VisionOS, WatchOS}

AllOS lists the operating systems in schema order.

View Source
var ErrVersion = errors.New("support: malformed version")

ErrVersion is returned by ParseVersion for malformed input.

Functions

func Bool

func Bool(b bool) *bool

Bool is a helper for table literals.

func Families

func Families() []string

Families lists registered families in sorted order.

func Paths

func Paths(family string) []string

Paths lists the key paths of a family in sorted order.

func Register

func Register(family string, table map[string]*Entry)

Register installs a family's table. Generated packages call it from init. Registering the same family twice replaces the table.

Types

type Channel

type Channel string

Channel is the MDM channel a message travels on.

const (
	ChannelDevice Channel = "device"
	ChannelUser   Channel = "user"
)

Channels.

type Entry

type Entry struct {
	Path string
	OS   map[OS]*OSSupport
}

Entry is the support table row for one schema key path.

func Lookup

func Lookup(family, path string) *Entry

Lookup returns the entry for a key path in a family, or nil.

func (*Entry) Check

func (e *Entry) Check(t Target) Result

Check evaluates the entry against a target.

type Mode

type Mode string

Mode is Apple's allowed/required/forbidden/ignored setting for shared iPad and user enrollment contexts. Empty means unspecified (allowed).

const (
	ModeAllowed   Mode = "allowed"
	ModeRequired  Mode = "required"
	ModeForbidden Mode = "forbidden"
	ModeIgnored   Mode = "ignored"
)

Modes.

type OS

type OS string

OS names as used in Apple's schema.

const (
	IOS      OS = "iOS"
	MacOS    OS = "macOS"
	TvOS     OS = "tvOS"
	VisionOS OS = "visionOS"
	WatchOS  OS = "watchOS"
)

Operating systems.

func OSFromProduct

func OSFromProduct(product string) OS

OSFromProduct maps a device product type (Authenticate's ProductName or MachineInfo's PRODUCT, for example "iPhone17,2", "Mac16,1", "iPad14,1", "AppleTV14,1", "RealityDevice14,1", "Watch7,1") to the OS family Apple's schema keys support on. iPadOS is keyed as iOS in the schema. Unknown prefixes return "".

type OSSupport

type OSSupport struct {
	// NotAvailable is set when Apple lists "introduced: n/a".
	NotAvailable bool
	Introduced   Version
	Deprecated   Version
	Removed      Version
	AccessRights string
	Beta         bool

	// Tri-state booleans: nil means Apple did not say.
	Multiple           *bool
	DeviceChannel      *bool
	UserChannel        *bool
	Supervised         *bool
	RequiresDEP        *bool
	UserApprovedMDM    *bool
	AllowManualInstall *bool
	AlwaysSkippable    *bool

	AllowedEnrollments []string
	AllowedScopes      []string

	SharedIPadMode          Mode
	SharedIPadDeviceChannel *bool
	SharedIPadUserChannel   *bool
	SharedIPadScopes        []string

	UserEnrollmentMode     Mode
	UserEnrollmentBehavior string
}

OSSupport is the effective support block for one key on one OS after inheritance from the enclosing payload and parent keys.

type Result

type Result struct {
	Supported  bool
	Deprecated bool
	Reason     string
	OS         *OSSupport
}

Result of a support check.

type Target

type Target struct {
	OS             OS
	Version        Version
	Channel        Channel
	Supervised     bool
	SharedIPad     bool
	UserEnrollment bool
	DEP            bool
	UserApproved   bool
}

Target describes the device a value is destined for. The zero Target disables every context check.

type Version

type Version struct {
	Major, Minor, Patch int
}

Version is a dotted OS version. The zero Version means "unspecified".

func MustVersion

func MustVersion(s string) Version

MustVersion parses or panics; for generated tables and tests.

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses "26", "26.4", or "10.15.4".

func V

func V(major, minor, patch int) Version

V builds a Version.

func (Version) Compare

func (v Version) Compare(o Version) int

Compare returns -1, 0, or 1.

func (Version) IsZero

func (v Version) IsZero() bool

IsZero reports whether the version is unspecified.

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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