From 46a7073a04b6eb5b7718a41db31f9efa328e8cd6 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Tue, 7 Jun 2022 17:14:20 +0200 Subject: [PATCH] Public init and proper doc --- Sources/PushAPI/AdminRequest.swift | 10 ++++++++++ Sources/PushAPI/Push.swift | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Sources/PushAPI/AdminRequest.swift b/Sources/PushAPI/AdminRequest.swift index fa6b1c8..db79124 100644 --- a/Sources/PushAPI/AdminRequest.swift +++ b/Sources/PushAPI/AdminRequest.swift @@ -10,4 +10,14 @@ public struct AdminRequest: Codable { /// The application id with which the request is associated public let application: ApplicationId + + /** + Create a new admin request. + - Parameter keyHash: The SHA256 hash of the admin key + - Parameter application: The application id for the request. + */ + public init(keyHash: Data, application: ApplicationId) { + self.keyHash = keyHash + self.application = application + } } diff --git a/Sources/PushAPI/Push.swift b/Sources/PushAPI/Push.swift index 2c86645..85c0fb5 100644 --- a/Sources/PushAPI/Push.swift +++ b/Sources/PushAPI/Push.swift @@ -30,7 +30,7 @@ public enum Route: String { Get a list of unapproved devices for review. * HTTP Method: `POST` - * HTTP Body: The binary SHA256 hash of the master key using the custom salt + * HTTP Body: An `AdminRequest` JSON object with the SHA256 hash of the admin key and the application id * Response: An array of `DeviceRegistration` elements encoded in JSON. `401` if the master key is incorrect. */ case listUnapprovedDevices = "check"