Documentation
¶
Overview ¶
Package errors holds the enrollment error response bodies generated from Apple's device management schema: 5 schema files and 10 types.
Why ¶
Apple publishes the wire format of the enrollment error response bodies as YAML in https://github.com/apple/device-management, pinned here as a git submodule. Generating this package from that pinned commit keeps the wire types, validation, and support metadata identical to Apple's schema (decision record 0003). Every type carries plist and json struct tags with Apple's wire keys, a Validate method driven by the schema's constraints, and support metadata queryable through Support(path) or the schema/support package.
Nothing here is hand-edited: admgen regenerates the package and admgen verify fails when regeneration would change it or drop an exported name (schema/EXPORTED_IDENTIFIERS.lock). Protocol semantics that Apple documents only in prose live in the hand-written packages that import this one.
References ¶
- Decision record 0001: docs/research/decisions/0001-architecture.md
- Decision record 0003: docs/research/decisions/0003-schema-generator.md
- Plan of record: docs/research/implementation_plan.md (phase 1)
- Apple: https://developer.apple.com/documentation/devicemanagement/managing-connections
- Apple: https://github.com/apple/device-management/blob/release/docs/schema.md
- Schema: third_party/device-management/mdm/errors/**
- Upstream: https://github.com/apple/device-management at commit 67045e2fa06f528b196c01edee6a8bf88b844beb (schema/GENERATED_FROM.json)
Index ¶
- Constants
- Variables
- func IDs() []string
- func Support(path string) *support.Entry
- type CodePairingTokenMissing
- type CodePairingTokenMissingDetails
- type CodePlatformSSORequired
- type CodePlatformSSORequiredDetails
- type CodePlatformSSORequiredDetailsPackage
- type CodeSoftwareUpdateRequired
- type CodeSoftwareUpdateRequiredDetails
- type CodeSoftwareUpdateRequiredDetailsRequireBetaProgram
- type Entry
- type Error
- type UnrecognizedDevice
- type WellKnownFailed
Constants ¶
const ( // ErrorCodeCodePlatformSSORequired: Error Code Platform SSO Required ErrorCodeCodePlatformSSORequired = "com.apple.psso.required" // ErrorCodeCodeSoftwareUpdateRequired: Error Code Software Update Required ErrorCodeCodeSoftwareUpdateRequired = "com.apple.softwareupdate.required" // ErrorCodeUnrecognizedDevice: Error Unrecognized Device ErrorCodeUnrecognizedDevice = "com.apple.unrecognized.device" // ErrorCodeCodePairingTokenMissing: Error Code Pairing Token Missing ErrorCodeCodePairingTokenMissing = "com.apple.watch.pairing.token.missing" // #nosec G101 -- Apple wire identifier, not a credential // ErrorCodeWellKnownFailed: Error Well-known Failed ErrorCodeWellKnownFailed = "com.apple.well-known.failed" )
Wire identifiers.
Variables ¶
var Registry = map[string]Entry{ "CodePairingTokenMissing": {ID: "com.apple.watch.pairing.token.missing", Schema: "mdm/errors/watch.pairing.token.missing.yaml", Title: "Error Code Pairing Token Missing", New: func() Error { return new(CodePairingTokenMissing) }}, "CodePlatformSSORequired": {ID: "com.apple.psso.required", Schema: "mdm/errors/psso.required.yaml", Title: "Error Code Platform SSO Required", New: func() Error { return new(CodePlatformSSORequired) }}, "CodeSoftwareUpdateRequired": {ID: "com.apple.softwareupdate.required", Schema: "mdm/errors/softwareupdate.required.yaml", Title: "Error Code Software Update Required", New: func() Error { return new(CodeSoftwareUpdateRequired) }}, "UnrecognizedDevice": {ID: "com.apple.unrecognized.device", Schema: "mdm/errors/unrecognized.device.yaml", Title: "Error Unrecognized Device", New: func() Error { return new(UnrecognizedDevice) }}, "WellKnownFailed": {ID: "com.apple.well-known.failed", Schema: "mdm/errors/well-known.failed.yaml", Title: "Error Well-known Failed", New: func() Error { return new(WellKnownFailed) }}, }
Registry maps Go type names to constructors, one entry per schema file. Several schemas may share a wire identifier (for example six profile payloads use com.apple.MCX), so look up by identifier with ByID.
Functions ¶
Types ¶
type CodePairingTokenMissing ¶
type CodePairingTokenMissing struct {
// Indicates that the pairing token, which the system requires to enroll the watch, is
// missing.
Code string `plist:"code" json:"code"`
// A description of the error. Only use this for logging purposes and don't display it to
// the user.
Description *string `plist:"description,omitempty" json:"description,omitempty"`
// A description of the error to display to the user.
Message *string `plist:"message,omitempty" json:"message,omitempty"`
// A dictionary that contains additional data about the error code.
Details CodePairingTokenMissingDetails `plist:"details,omitempty" json:"details,omitempty"`
}
CodePairingTokenMissing: An error response that indicates a missing pairing token.
CodePairingTokenMissing corresponds to mdm/errors/watch.pairing.token.missing.yaml (Error Code Pairing Token Missing).
func (*CodePairingTokenMissing) ErrorCodeName ¶
func (*CodePairingTokenMissing) ErrorCodeName() string
ErrorCodeName returns "com.apple.watch.pairing.token.missing".
func (*CodePairingTokenMissing) SchemaPath ¶
func (*CodePairingTokenMissing) SchemaPath() string
SchemaPath returns the Apple schema file this type was generated from.
type CodePairingTokenMissingDetails ¶
type CodePairingTokenMissingDetails struct {
// The security token to pass to the phone's MDM server to create the pairing token. This
// token needs to be a random UUID string.
SecurityToken string `plist:"security-token" json:"security-token"`
}
CodePairingTokenMissingDetails: A dictionary that contains additional data about the error code.
type CodePlatformSSORequired ¶
type CodePlatformSSORequired struct {
// Indicates that the device needs to do Platform SSO before enrollment and setup can
// proceed.
Code string `plist:"code" json:"code"`
// A description of the error. Only use this for logging purposes and don't display it to
// the user.
Description *string `plist:"description,omitempty" json:"description,omitempty"`
// A description of the error to display to the user.
Message *string `plist:"message,omitempty" json:"message,omitempty"`
// A dictionary that contains additional data about the error code.
Details CodePlatformSSORequiredDetails `plist:"details,omitempty" json:"details,omitempty"`
}
CodePlatformSSORequired: An error response that indicates Platform SSO is required.
CodePlatformSSORequired corresponds to mdm/errors/psso.required.yaml (Error Code Platform SSO Required).
func (*CodePlatformSSORequired) ErrorCodeName ¶
func (*CodePlatformSSORequired) ErrorCodeName() string
ErrorCodeName returns "com.apple.psso.required".
func (*CodePlatformSSORequired) SchemaPath ¶
func (*CodePlatformSSORequired) SchemaPath() string
SchemaPath returns the Apple schema file this type was generated from.
type CodePlatformSSORequiredDetails ¶
type CodePlatformSSORequiredDetails struct {
// The URL of the profile containing an `ExtensibleSingleSignOn` profile payload that the
// device uses to configure the SSO extension for Platform SSO.
ProfileURL string `plist:"ProfileURL" json:"ProfileURL"`
// A dictionary that specifies the package that the device uses to install an app with the
// SSO app extension used for Platform SSO.
Package CodePlatformSSORequiredDetailsPackage `plist:"Package,omitempty" json:"Package,omitempty"`
// The URL the device uses to create an `ASWebAuthenticationSession` to trigger Platform
// SSO authentication, once the profile and app are installed.
AuthURL string `plist:"AuthURL" json:"AuthURL"`
}
CodePlatformSSORequiredDetails: A dictionary that contains additional data about the error code.
type CodePlatformSSORequiredDetailsPackage ¶
type CodePlatformSSORequiredDetailsPackage struct {
// The URL of the app manifest, which needs to begin with `https:`.
ManifestURL string `plist:"ManifestURL" json:"ManifestURL"`
// An array of DER-encoded certificates to pin the connection when fetching the
// `ManifestURL`.
PinningCerts [][]byte `plist:"PinningCerts,omitempty" json:"PinningCerts,omitempty"`
// If `true`, certificate revocation checks require a positive response when using
// certificate pinning with `PinningCerts`.
PinningRevocationCheckRequired *bool `plist:"PinningRevocationCheckRequired,omitempty" json:"PinningRevocationCheckRequired,omitempty"`
}
CodePlatformSSORequiredDetailsPackage: A dictionary that specifies the package that the device uses to install an app with the SSO app extension used for Platform SSO.
type CodeSoftwareUpdateRequired ¶
type CodeSoftwareUpdateRequired struct {
// Indicates that the device needs to perform a software update before enrollment and setup
// can proceed.
Code string `plist:"code" json:"code"`
// A description of the error. Only use this for logging purposes and don't display it to
// the user.
Description *string `plist:"description,omitempty" json:"description,omitempty"`
// A description of the error to display to the user.
Message *string `plist:"message,omitempty" json:"message,omitempty"`
// A dictionary that contains additional data about the error code.
Details CodeSoftwareUpdateRequiredDetails `plist:"details,omitempty" json:"details,omitempty"`
}
CodeSoftwareUpdateRequired: An error response that indicates the system requires a software update.
CodeSoftwareUpdateRequired corresponds to mdm/errors/softwareupdate.required.yaml (Error Code Software Update Required).
func (*CodeSoftwareUpdateRequired) ErrorCodeName ¶
func (*CodeSoftwareUpdateRequired) ErrorCodeName() string
ErrorCodeName returns "com.apple.softwareupdate.required".
func (*CodeSoftwareUpdateRequired) SchemaPath ¶
func (*CodeSoftwareUpdateRequired) SchemaPath() string
SchemaPath returns the Apple schema file this type was generated from.
type CodeSoftwareUpdateRequiredDetails ¶
type CodeSoftwareUpdateRequiredDetails struct {
// The OS version that the device needs to update to, for example, "16.1". This identifier
// can include a supplemental version identifier, for example, "16.1 (a)".
OSVersion string `plist:"OSVersion" json:"OSVersion"`
// The build version that the device needs to update to, for example, "20A242. The systems
// uses the build version for testing during seeding periods. This identifier can include a
// supplemental version identifier, for example, "20A242a". If the `BuildVersion` isn't
// consistent with the `OSVersion`, `OSVersion` take precedence.
BuildVersion *string `plist:"BuildVersion,omitempty" json:"BuildVersion,omitempty"`
// The device enrolls in the beta program, allowing enforced software updates to beta
// program OS versions. The device remains in the beta program after the system completes
// the enforced software update.
RequireBetaProgram *CodeSoftwareUpdateRequiredDetailsRequireBetaProgram `plist:"RequireBetaProgram,omitempty" json:"RequireBetaProgram,omitempty"`
}
CodeSoftwareUpdateRequiredDetails: A dictionary that contains additional data about the error code.
type CodeSoftwareUpdateRequiredDetailsRequireBetaProgram ¶
type CodeSoftwareUpdateRequiredDetailsRequireBetaProgram struct {
// A human readable description of the beta program.
Description string `plist:"Description" json:"Description"`
// The AxM seeding service token for the AxM organization the MDM server is part of. The
// system uses this token to enroll the device in the corresponding beta program.
Token string `plist:"Token" json:"Token"`
}
CodeSoftwareUpdateRequiredDetailsRequireBetaProgram: The device enrolls in the beta program, allowing enforced software updates to beta program OS versions. The device remains in the beta program after the system completes the enforced software update.
type Entry ¶
type Entry struct {
// ID is the wire identifier: RequestType, MessageType, PayloadType,
// DeclarationType, StatusItemType, error code, or type name.
ID string
// Schema is the YAML path in apple/device-management.
Schema string
Title string
// New returns a zero value of the type as Error.
New func() Error
// NewResponse returns a zero response value, or nil when the schema
// defines no response keys.
NewResponse func() any
}
Entry describes one schema in the Registry.
type Error ¶
type Error interface {
// ErrorCodeName returns the wire identifier from Apple's schema.
ErrorCodeName() string
// SchemaPath returns the schema file the type was generated from.
SchemaPath() string
// Validate checks the value against the schema for the target.
Validate(t support.Target) error
}
Error is implemented by every top-level type in this package.
type UnrecognizedDevice ¶
type UnrecognizedDevice struct {
// Indicates that the device is not recognized by the server. This causes the device to
// unenroll from MDM.
Code string `plist:"code" json:"code"`
// A description of the error. Only use this for logging purposes and don't display it to
// the user.
Description *string `plist:"description,omitempty" json:"description,omitempty"`
// A description of the error to display to the user.
Message *string `plist:"message,omitempty" json:"message,omitempty"`
}
UnrecognizedDevice: An error response that indicates a device needs to unenroll.
UnrecognizedDevice corresponds to mdm/errors/unrecognized.device.yaml (Error Unrecognized Device).
func (*UnrecognizedDevice) ErrorCodeName ¶
func (*UnrecognizedDevice) ErrorCodeName() string
ErrorCodeName returns "com.apple.unrecognized.device".
func (*UnrecognizedDevice) SchemaPath ¶
func (*UnrecognizedDevice) SchemaPath() string
SchemaPath returns the Apple schema file this type was generated from.
type WellKnownFailed ¶
type WellKnownFailed struct {
// Indicates that the well-known request has failed.
Code string `plist:"code" json:"code"`
// A description of the error. Only use this for logging purposes and don't display it to
// the user.
Description *string `plist:"description,omitempty" json:"description,omitempty"`
// A description of the error to display to the user.
Message *string `plist:"message,omitempty" json:"message,omitempty"`
}
WellKnownFailed: An error response that indicates a well-known service discovery request failed.
WellKnownFailed corresponds to mdm/errors/well-known.failed.yaml (Error Well-known Failed).
func (*WellKnownFailed) ErrorCodeName ¶
func (*WellKnownFailed) ErrorCodeName() string
ErrorCodeName returns "com.apple.well-known.failed".
func (*WellKnownFailed) SchemaPath ¶
func (*WellKnownFailed) SchemaPath() string
SchemaPath returns the Apple schema file this type was generated from.