Push-Definitions/Sources/PushAPI/DeviceDecision.swift
2022-06-05 18:25:39 +02:00

27 lines
976 B
Swift

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.
*/
public struct DeviceDecision: Codable {
/// The push token of the approved or rejected device.
public let pushToken: PushToken
/// The hash of the master key to authenticate the request.
public let masterKeyHash: Data
/**
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
}
}