This repository has been archived by the owner on Jun 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcheckin.go
67 lines (59 loc) · 1.63 KB
/
checkin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package mdm
import "encoding/hex"
// CheckinCommand represents an MDM checkin command struct
type CheckinCommand struct {
// MessageType can be either Authenticate,
// TokenUpdate or CheckOut
MessageType string
Topic string
UDID string
auth
update
}
// Authenticate Message Type
type auth struct {
OSVersion string
BuildVersion string
ProductName string
SerialNumber string
IMEI string
MEID string
DeviceName string `plist:"DeviceName,omitempty"`
Challenge []byte `plist:"Challenge,omitempty"`
Model string `plist:"Model,omitpempty"`
ModelName string `plist:"ModelName,omitempty"`
}
// TokenUpdate Mesage Type
type update struct {
Token hexData
PushMagic string
UnlockToken hexData
AwaitingConfiguration bool
userTokenUpdate
}
// TokenUpdate with user keys
type userTokenUpdate struct {
UserID string `plist:",omitempty"`
UserLongName string `plist:",omitempty"`
UserShortName string `plist:",omitempty"`
NotOnConsole bool `plist:",omitempty"`
}
// DEPEnrollmentRequest is a request sent
// by the device to an MDM server during
// DEP Enrollment
type DEPEnrollmentRequest struct {
Language string `plist:"LANGUAGE"`
Product string `plist:"PRODUCT"`
Serial string `plist:"SERIAL"`
UDID string `plist:"UDID"`
Version string `plist:"VERSION"`
IMEI string `plist:"IMEI,omitempty"`
MEID string `plist:"MEID,omitempty"`
}
// data decodes to []byte,
// we can then attach a string method to the type
// Tokens are encoded as Hex Strings
type hexData []byte
func (d hexData) String() string {
return hex.EncodeToString(d)
}