diff --git a/Client/BraveSkus/BraveSkusManager.swift b/Client/BraveSkus/BraveSkusManager.swift index f8493ea83a3..bc4647be3ae 100644 --- a/Client/BraveSkus/BraveSkusManager.swift +++ b/Client/BraveSkus/BraveSkusManager.swift @@ -42,9 +42,7 @@ public class BraveSkusManager { Logger.module.debug("Refreshing sku credential. Clearing old credential from persistence.") - Preferences.VPN.skusCredential.reset() - Preferences.VPN.skusCredentialDomain.reset() - Preferences.VPN.skusCredentialExpirationDate.reset() + BraveVPN.clearSkusCredentials() manager.credentialSummary(for: domain) { completion in Logger.module.debug("credentialSummary response") diff --git a/Sources/BraveVPN/BraveVPN.swift b/Sources/BraveVPN/BraveVPN.swift index 47cd1786dba..bea14502c03 100644 --- a/Sources/BraveVPN/BraveVPN.swift +++ b/Sources/BraveVPN/BraveVPN.swift @@ -307,6 +307,10 @@ public class BraveVPN { GRDKeychain.removeGuardianKeychainItems() GRDKeychain.removeSubscriberCredential(withRetries: 3) + clearSkusCredentials() + } + + public static func clearSkusCredentials() { Preferences.VPN.skusCredential.reset() Preferences.VPN.skusCredentialDomain.reset() Preferences.VPN.skusCredentialExpirationDate.reset() diff --git a/Sources/BraveVPN/IAPObserver.swift b/Sources/BraveVPN/IAPObserver.swift index db2c8695042..70f11c98bb1 100644 --- a/Sources/BraveVPN/IAPObserver.swift +++ b/Sources/BraveVPN/IAPObserver.swift @@ -60,9 +60,7 @@ public class IAPObserver: NSObject, SKPaymentTransactionObserver { // // The user will be able to retrieve the shared credential // after log in to account.brave website. - Preferences.VPN.skusCredential.reset() - Preferences.VPN.skusCredentialDomain.reset() - Preferences.VPN.skusCredentialExpirationDate.reset() + BraveVPN.clearSkusCredentials() } else { // Receipt either expired or receipt validation returned some error. self.delegate?.purchaseFailed(error: .receiptError)