Push-Definitions/Sources/PushMessageDefinitions/DeviceDecision.swift

27 lines
976 B
Swift
Raw Normal View History

2022-06-05 11:47:58 +02:00
import Foundation
/**
A statement from the administrator to approve or reject a device for an application.
- Note: There is a potential security risk here: Capturing this message and retransmitting it to the `confirm` route can approve previously rejected devices if they register again with the same push token. A timestamp, counter, or nonce can prevent this.
*/
2022-06-05 12:10:38 +02:00
public struct DeviceDecision: Codable {
2022-06-05 11:47:58 +02:00
/// The push token of the approved or rejected device.
2022-06-05 12:13:47 +02:00
public let pushToken: PushToken
2022-06-05 11:47:58 +02:00
/// The hash of the master key to authenticate the request.
2022-06-05 12:13:47 +02:00
public let masterKeyHash: Data
2022-06-05 18:25:39 +02:00
/**
Create a decision object to approve or reject a device registration.
- Parameter pushToken: The APNs device token
- Parameter masterKeyHash: The SHA256 hash of the administrator master key.
*/
public init(pushToken: PushToken, masterKeyHash: Data) {
self.pushToken = pushToken
self.masterKeyHash = masterKeyHash
}
2022-06-05 11:47:58 +02:00
}