Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 1196f97

Browse files
authored
Remove revoke check as it is not working
1 parent 9381b81 commit 1196f97

File tree

1 file changed

+1
-103
lines changed

1 file changed

+1
-103
lines changed

Sources/prosign/views/CertificateView.swift

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SwiftUI
22
import UniformTypeIdentifiers
33
import ProStoreTools
4-
54
// Centralized types to avoid conflicts
65
struct CertificateFileItem {
76
var name: String = ""
@@ -12,59 +11,9 @@ struct CustomCertificate: Identifiable {
1211
let displayName: String
1312
let folderName: String
1413
}
15-
16-
// CertStatus stores the optional expiration Date and the raw numeric status returned from checkRevokage
17-
enum CertStatus {
18-
case loading
19-
case signed(Date?, Int) // e.g. (expirationDate, rawStatusNumber)
20-
case revoked(Date?, Int) // e.g. (expirationDate, rawStatusNumber)
21-
case unknown(Int) // rawStatusNumber for unknown (-1, etc.)
22-
}
23-
24-
extension CertStatus {
25-
var description: String {
26-
switch self {
27-
case .loading:
28-
return "Status: Loading"
29-
case .signed(_, let raw):
30-
return "Status: Signed (\(raw))"
31-
case .revoked(_, let raw):
32-
return "Status: Revoked (\(raw))"
33-
case .unknown(let raw):
34-
return "Status: Unknown (\(raw))"
35-
}
36-
}
37-
38-
var color: Color {
39-
switch self {
40-
case .loading:
41-
return .black
42-
case .signed:
43-
return .green
44-
case .revoked:
45-
return .red
46-
case .unknown:
47-
return .yellow
48-
}
49-
}
50-
51-
// Optional: expose expiration date if needed elsewhere
52-
var expirationDate: Date? {
53-
switch self {
54-
case .signed(let date, _):
55-
return date
56-
case .revoked(let date, _):
57-
return date
58-
default:
59-
return nil
60-
}
61-
}
62-
}
63-
6414
// MARK: - CertificateView (List + Add/Edit launchers)
6515
struct CertificateView: View {
6616
@State private var customCertificates: [CustomCertificate] = []
67-
@State private var certStatuses: [String: CertStatus] = [:]
6817
@State private var showAddCertificateSheet = false
6918
@State private var editingCertificate: CustomCertificate? = nil // Used only for edit sheet (.sheet(item:))
7019
@State private var selectedCert: String? = nil
@@ -83,12 +32,6 @@ struct CertificateView: View {
8332
.font(.title2)
8433
.fontWeight(.semibold)
8534
.foregroundColor(.primary)
86-
if let status = certStatuses[cert.folderName] {
87-
Text(status.description)
88-
.font(.caption)
89-
.fontWeight(.medium)
90-
.foregroundColor(status.color)
91-
}
9235
}
9336
.padding(20)
9437
.frame(maxWidth: .infinity)
@@ -196,49 +139,6 @@ struct CertificateView: View {
196139
customCertificates = CertificateFileManager.shared.loadCertificates()
197140
selectedCert = UserDefaults.standard.string(forKey: "selectedCertificateFolder")
198141
ensureSelection()
199-
checkStatuses()
200-
}
201-
202-
private func checkStatuses() {
203-
for cert in customCertificates {
204-
let folderName = cert.folderName
205-
certStatuses[folderName] = .loading
206-
207-
let certDir = CertificateFileManager.shared.certificatesDirectory.appendingPathComponent(folderName)
208-
let p12URL = certDir.appendingPathComponent("certificate.p12")
209-
let provURL = certDir.appendingPathComponent("profile.mobileprovision")
210-
let passwordURL = certDir.appendingPathComponent("password.txt")
211-
212-
let p12Password: String
213-
if let passwordData = try? Data(contentsOf: passwordURL),
214-
let passwordStr = String(data: passwordData, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) {
215-
p12Password = passwordStr
216-
} else {
217-
p12Password = ""
218-
}
219-
220-
ProStoreTools.checkRevokage(
221-
p12URL: p12URL,
222-
provURL: provURL,
223-
p12Password: p12Password
224-
) { status, expirationDate, error in
225-
DispatchQueue.main.async {
226-
// Convert Int32 -> Int ONCE and use rawStatus everywhere
227-
let rawStatus = Int(status)
228-
229-
let newStatus: CertStatus
230-
switch rawStatus {
231-
case 0:
232-
newStatus = .signed(expirationDate, rawStatus)
233-
case 1, 2:
234-
newStatus = .revoked(expirationDate, rawStatus)
235-
default:
236-
newStatus = .unknown(rawStatus)
237-
}
238-
self.certStatuses[folderName] = newStatus
239-
}
240-
}
241-
}
242142
}
243143

244144
private func ensureSelection() {
@@ -264,7 +164,6 @@ struct CertificateView: View {
264164
}
265165
}
266166
ensureSelection()
267-
checkStatuses()
268167
}
269168
}
270169
// MARK: - Add / Edit View
@@ -469,5 +368,4 @@ struct AddCertificateView: View {
469368
}
470369
DispatchQueue.global(qos: .userInitiated).async(execute: workItem)
471370
}
472-
}
473-
371+
}

0 commit comments

Comments
 (0)