From 04e4fc4e99ce03e70fd1d9a696ae21b5c38fe1ca Mon Sep 17 00:00:00 2001 From: Paul Flynn Date: Tue, 8 Oct 2024 19:57:11 -0400 Subject: [PATCH] Sendable --- OpenTDFKit/BinaryParser.swift | 2 +- OpenTDFKit/KASRest.swift | 2 +- OpenTDFKit/KASWebSocket.swift | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenTDFKit/BinaryParser.swift b/OpenTDFKit/BinaryParser.swift index 464a909..d5b00b7 100644 --- a/OpenTDFKit/BinaryParser.swift +++ b/OpenTDFKit/BinaryParser.swift @@ -138,7 +138,7 @@ public class BinaryParser { } func readPolicyBinding(bindingMode: PolicyBindingConfig) -> Data? { - var bindingSize + let bindingSize // print("bindingMode", bindingMode) = if bindingMode.ecdsaBinding { diff --git a/OpenTDFKit/KASRest.swift b/OpenTDFKit/KASRest.swift index 2e6404b..dc0c360 100644 --- a/OpenTDFKit/KASRest.swift +++ b/OpenTDFKit/KASRest.swift @@ -9,7 +9,7 @@ class KASRest { self.apiKey = apiKey } - public func rewrap(key: String, completion: @escaping (Result) -> Void) { + public func rewrap(key: String, completion: @escaping @Sendable (Result) -> Void) { guard let url = URL(string: "\(baseURL)/rewrap") else { completion(.failure(NSError(domain: "KASClient", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"]))) return diff --git a/OpenTDFKit/KASWebSocket.swift b/OpenTDFKit/KASWebSocket.swift index e50df67..6e62ae4 100644 --- a/OpenTDFKit/KASWebSocket.swift +++ b/OpenTDFKit/KASWebSocket.swift @@ -18,7 +18,7 @@ extension WebSocketConnectionState: CustomStringConvertible { } } -public class KASWebSocket { +public class KASWebSocket: @unchecked Sendable { private var webSocketTask: URLSessionWebSocketTask? private var urlSession: URLSession? private let myPrivateKey: P256.KeyAgreement.PrivateKey! @@ -54,7 +54,7 @@ public class KASWebSocket { customMessageCallback = callback } - public func sendCustomMessage(_ message: Data, completion: @escaping (Error?) -> Void) { + public func sendCustomMessage(_ message: Data, completion: @Sendable @escaping (Error?) -> Void) { let task = URLSessionWebSocketTask.Message.data(message) webSocketTask?.send(task) { error in if let error { @@ -276,7 +276,7 @@ public class KASWebSocket { } } - public func sendPing(completionHandler: @escaping (Error?) -> Void) { + public func sendPing(completionHandler: @escaping @Sendable (Error?) -> Void) { webSocketTask?.sendPing { error in if let error { print("Error sending ping: \(error)")