summaryrefslogtreecommitdiff
path: root/DomainDig/SSLCheckService.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-20 15:28:12 -0500
committerChristian Cleberg <[email protected]>2026-04-20 15:28:12 -0500
commitee2520f2c0c2d806fd284c3d6b8a81a3822f5270 (patch)
tree0680550a1071e01546ba074c2f20b1bf5a452238 /DomainDig/SSLCheckService.swift
parent4e94ee723cd19c964b1cf37792931e0c7c4614f4 (diff)
downloaddomain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.gz
domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.bz2
domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.zip
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
Diffstat (limited to 'DomainDig/SSLCheckService.swift')
-rw-r--r--DomainDig/SSLCheckService.swift17
1 files changed, 10 insertions, 7 deletions
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<SSLCertificateInfo> {
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? {