From ee2520f2c0c2d806fd284c3d6b8a81a3822f5270 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 20 Apr 2026 15:28:12 -0500 Subject: feat(v1.8): improve result structure, history, and consistency - normalize sections and add summary card - fix resolver usage in reverse DNS - include custom port scans in history/export - standardize error handling - decompose ContentView into smaller views --- DomainDig/SSLCheckService.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'DomainDig/SSLCheckService.swift') diff --git a/DomainDig/SSLCheckService.swift b/DomainDig/SSLCheckService.swift index 6cf8ec3..e180d4e 100644 --- a/DomainDig/SSLCheckService.swift +++ b/DomainDig/SSLCheckService.swift @@ -3,7 +3,7 @@ import Security struct SSLCheckService { - static func check(domain: String) async throws -> SSLCertificateInfo { + static func check(domain: String) async -> ServiceResult { let delegate = SSLSessionDelegate() let session = URLSession( configuration: .ephemeral, @@ -15,14 +15,17 @@ struct SSLCheckService { let url = URL(string: "https://\(domain)")! let request = URLRequest(url: url, timeoutInterval: 10) - // We only need to establish the connection to grab the cert - _ = try await session.data(for: request) + do { + _ = try await session.data(for: request) - guard let trust = delegate.serverTrust else { - throw SSLError.noCertificate - } + guard let trust = delegate.serverTrust else { + return .empty(SSLError.noCertificate.localizedDescription) + } - return try extractCertificateInfo(from: trust, metadata: delegate.tlsMetadata) + return .success(try extractCertificateInfo(from: trust, metadata: delegate.tlsMetadata)) + } catch { + return .error(error.localizedDescription) + } } static func checkHSTSPreload(domain: String) async -> Bool? { -- cgit v1.2.3