From cf5ae49ebc6958756462b6d81e2bab83f178d374 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sat, 6 Sep 2025 12:53:10 -0700 Subject: [PATCH] Remove unneeded protocosl (#674) --- .../SecretAgentKit/FileHandleProtocols.swift | 22 +------------------ .../SecretAgentKit/SigningRequestTracer.swift | 6 ++--- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Sources/Packages/Sources/SecretAgentKit/FileHandleProtocols.swift b/Sources/Packages/Sources/SecretAgentKit/FileHandleProtocols.swift index 40a2840..83ade57 100644 --- a/Sources/Packages/Sources/SecretAgentKit/FileHandleProtocols.swift +++ b/Sources/Packages/Sources/SecretAgentKit/FileHandleProtocols.swift @@ -1,26 +1,6 @@ import Foundation -/// Protocol abstraction of the reading aspects of FileHandle. -public protocol FileHandleReader: Sendable { - - /// Gets data that is available for reading. - var availableData: Data { get } - /// A file descriptor of the handle. - var fileDescriptor: Int32 { get } - /// The process ID of the process coonnected to the other end of the FileHandle. - var pidOfConnectedProcess: Int32 { get } - -} - -/// Protocol abstraction of the writing aspects of FileHandle. -public protocol FileHandleWriter: Sendable { - - /// Writes data to the handle. - func write(_ data: Data) - -} - -extension FileHandle: FileHandleReader, FileHandleWriter { +extension FileHandle { public var pidOfConnectedProcess: Int32 { let pidPointer = UnsafeMutableRawPointer.allocate(byteCount: 4, alignment: 1) diff --git a/Sources/Packages/Sources/SecretAgentKit/SigningRequestTracer.swift b/Sources/Packages/Sources/SecretAgentKit/SigningRequestTracer.swift index aa8e295..a4f683a 100644 --- a/Sources/Packages/Sources/SecretAgentKit/SigningRequestTracer.swift +++ b/Sources/Packages/Sources/SecretAgentKit/SigningRequestTracer.swift @@ -10,10 +10,10 @@ struct SigningRequestTracer { extension SigningRequestTracer { - /// Generates a ``SecretKit.SigningRequestProvenance`` from a ``FileHandleReader``. - /// - Parameter fileHandleReader: The reader involved in processing the request. + /// Generates a ``SecretKit.SigningRequestProvenance`` from a ``FileHandle``. + /// - Parameter fileHandle: The reader involved in processing the request. /// - Returns: A ``SecretKit.SigningRequestProvenance`` describing the origin of the request. - func provenance(from fileHandleReader: FileHandleReader) -> SigningRequestProvenance { + func provenance(from fileHandleReader: FileHandle) -> SigningRequestProvenance { let firstInfo = process(from: fileHandleReader.pidOfConnectedProcess) var provenance = SigningRequestProvenance(root: firstInfo)