protocol

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package protocol implements primitives and interfaces of the base Apple MDM protocol.

Index

Constants

View Source
const (
	// CheckInMIMEType is the HTTP MIME type of Apple MDM check-in messages.
	CheckInMIMEType = "application/x-apple-aspen-mdm-checkin"

	// MDMSignatureHeader is the HTTP header name for the in-message
	// signature checking.
	MDMSignatureHeader = "Mdm-Signature"
)

Variables

View Source
var (
	ErrMissingDeviceIdentity = errors.New("missing device identity")
	ErrNilTransport          = errors.New("nil transport")
)

Functions

This section is empty.

Types

type Doer

type Doer interface {
	Do(*http.Request) (*http.Response, error)
}

Doer executes an HTTP request.

type IdentityProvider

type IdentityProvider func(context.Context) (*x509.Certificate, crypto.PrivateKey, error)

type Transport

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

Transport encapsulates the MDM enrollment underlying MDM transport. The MDM channels utilize this transport to communicate with the host.

func NewTransport

func NewTransport(opts ...TransportOption) *Transport

func (*Transport) DoCheckIn

func (t *Transport) DoCheckIn(ctx context.Context, body io.Reader) (*http.Response, error)

DoCheckIn executes a check-in request with body. The caller is responsible for closing the response body.

func (*Transport) DoReportResultsAndFetchNext

func (t *Transport) DoReportResultsAndFetchNext(ctx context.Context, body io.Reader) (*http.Response, error)

DoReportResultsAndFetchNext executes a report and fetch request with body. The caller is responsible for closing the response body.

func (*Transport) SignMessage

func (t *Transport) SignMessage(ctx context.Context, body []byte) (string, error)

SignMessage generates the CMS detached signature encoded as Base64.

type TransportOption

type TransportOption func(*Transport)

func WithClient

func WithClient(doer Doer) TransportOption

WithClient configures the HTTP client for this transport.

func WithIdentityProvider

func WithIdentityProvider(f IdentityProvider) TransportOption

WithIdentityProvider configures the certificate and private key provider for this transport.

func WithMDMURLs

func WithMDMURLs(serverURL, checkInURL string) TransportOption

WithMDMURLs supplies the ServerURL and CheckInURLs to the transport. Per MDM spec checkInURL is optional.

func WithSignMessage

func WithSignMessage() TransportOption

WithSignMessage include the signed message header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳