summaryrefslogtreecommitdiff
path: root/DomainDig/Models.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-03 16:59:04 -0500
committerChristian Cleberg <[email protected]>2026-04-03 16:59:04 -0500
commit1e13dac952d8f6cce7964aef27e98fa2e9da1eb7 (patch)
treea43a164db605c15aecdd9e649d546b21a7ce1dc8 /DomainDig/Models.swift
parent9c691f6c6c579a3fbb3bd5bbd74eb0e92ca0bd41 (diff)
downloaddomain-dig-1e13dac952d8f6cce7964aef27e98fa2e9da1eb7.tar.gz
domain-dig-1e13dac952d8f6cce7964aef27e98fa2e9da1eb7.tar.bz2
domain-dig-1e13dac952d8f6cce7964aef27e98fa2e9da1eb7.zip
Release 1.4.0v1.4.0
Add richer SSL/TLS inspection details including negotiated TLS version, cipher suite, full certificate chain display, crt.sh lookup, and HSTS preload status. Persist HSTS preload in history/export and run the preload check in parallel with the SSL lookup.
Diffstat (limited to 'DomainDig/Models.swift')
-rw-r--r--DomainDig/Models.swift52
1 files changed, 51 insertions, 1 deletions
diff --git a/DomainDig/Models.swift b/DomainDig/Models.swift
index cfc60c4..5fcc653 100644
--- a/DomainDig/Models.swift
+++ b/DomainDig/Models.swift
@@ -57,6 +57,11 @@ struct DNSSection: Identifiable, Codable {
// MARK: - SSL Models
struct SSLCertificateInfo: Codable {
+ struct CertChainEntry: Codable {
+ let subject: String
+ let issuer: String
+ }
+
let commonName: String
let subjectAltNames: [String]
let issuer: String
@@ -64,6 +69,47 @@ struct SSLCertificateInfo: Codable {
let validUntil: Date
let daysUntilExpiry: Int
let chainDepth: Int
+ let tlsVersion: String?
+ let cipherSuite: String?
+ let chain: [CertChainEntry]
+
+ init(
+ commonName: String,
+ subjectAltNames: [String],
+ issuer: String,
+ validFrom: Date,
+ validUntil: Date,
+ daysUntilExpiry: Int,
+ chainDepth: Int,
+ tlsVersion: String? = nil,
+ cipherSuite: String? = nil,
+ chain: [CertChainEntry] = []
+ ) {
+ self.commonName = commonName
+ self.subjectAltNames = subjectAltNames
+ self.issuer = issuer
+ self.validFrom = validFrom
+ self.validUntil = validUntil
+ self.daysUntilExpiry = daysUntilExpiry
+ self.chainDepth = chainDepth
+ self.tlsVersion = tlsVersion
+ self.cipherSuite = cipherSuite
+ self.chain = chain
+ }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ commonName = try container.decode(String.self, forKey: .commonName)
+ subjectAltNames = try container.decode([String].self, forKey: .subjectAltNames)
+ issuer = try container.decode(String.self, forKey: .issuer)
+ validFrom = try container.decode(Date.self, forKey: .validFrom)
+ validUntil = try container.decode(Date.self, forKey: .validUntil)
+ daysUntilExpiry = try container.decode(Int.self, forKey: .daysUntilExpiry)
+ chainDepth = try container.decode(Int.self, forKey: .chainDepth)
+ tlsVersion = try container.decodeIfPresent(String.self, forKey: .tlsVersion)
+ cipherSuite = try container.decodeIfPresent(String.self, forKey: .cipherSuite)
+ chain = try container.decodeIfPresent([CertChainEntry].self, forKey: .chain) ?? []
+ }
}
// MARK: - HTTP Headers Models
@@ -154,12 +200,14 @@ struct HistoryEntry: Identifiable, Codable {
var ptrRecord: String?
var redirectChain: [RedirectHop]
var portScanResults: [PortScanResult]
+ var hstsPreloaded: Bool?
init(domain: String, timestamp: Date, dnsSections: [DNSSection],
sslInfo: SSLCertificateInfo?, httpHeaders: [HTTPHeader],
reachabilityResults: [PortReachability], ipGeolocation: IPGeolocation?,
emailSecurity: EmailSecurityResult? = nil, ptrRecord: String? = nil,
- redirectChain: [RedirectHop] = [], portScanResults: [PortScanResult] = []) {
+ redirectChain: [RedirectHop] = [], portScanResults: [PortScanResult] = [],
+ hstsPreloaded: Bool? = nil) {
self.domain = domain
self.timestamp = timestamp
self.dnsSections = dnsSections
@@ -171,6 +219,7 @@ struct HistoryEntry: Identifiable, Codable {
self.ptrRecord = ptrRecord
self.redirectChain = redirectChain
self.portScanResults = portScanResults
+ self.hstsPreloaded = hstsPreloaded
}
init(from decoder: Decoder) throws {
@@ -187,6 +236,7 @@ struct HistoryEntry: Identifiable, Codable {
ptrRecord = try container.decodeIfPresent(String.self, forKey: .ptrRecord)
redirectChain = try container.decodeIfPresent([RedirectHop].self, forKey: .redirectChain) ?? []
portScanResults = try container.decodeIfPresent([PortScanResult].self, forKey: .portScanResults) ?? []
+ hstsPreloaded = try container.decodeIfPresent(Bool.self, forKey: .hstsPreloaded)
}
}