From 5231ea1c1ef20626c38352f358661db021e99817 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 4 Oct 2021 15:45:16 -0700 Subject: [PATCH] [AltServer] Prefers revoking existing AltStore certificate (if it exists) --- AltServer/Devices/ALTDeviceManager+Installation.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AltServer/Devices/ALTDeviceManager+Installation.swift b/AltServer/Devices/ALTDeviceManager+Installation.swift index 140293a1..4ec2b176 100644 --- a/AltServer/Devices/ALTDeviceManager+Installation.swift +++ b/AltServer/Devices/ALTDeviceManager+Installation.swift @@ -346,7 +346,8 @@ private extension ALTDeviceManager var isCancelled = false // Check if there is another AltStore certificate, which means AltStore has been installed with this Apple ID before. - if let previousCertificate = certificates.first(where: { $0.machineName?.starts(with: "AltStore") == true }) + let altstoreCertificate = certificates.first { $0.machineName?.starts(with: "AltStore") == true } + if let previousCertificate = altstoreCertificate { if FileManager.default.fileExists(atPath: certificateFileURL.path), let data = try? Data(contentsOf: certificateFileURL), @@ -419,7 +420,7 @@ private extension ALTDeviceManager } } - if let certificate = certificates.first + if let certificate = altstoreCertificate ?? certificates.first { if team.type != .free {