From 2f493fe4853dccec4a82104f5d54596ac39b9c7c Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 25 Jun 2024 14:32:49 +0200 Subject: [PATCH] Adds hasToken method --- LeStorage/Services.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LeStorage/Services.swift b/LeStorage/Services.swift index aedb521..a8e5b6c 100644 --- a/LeStorage/Services.swift +++ b/LeStorage/Services.swift @@ -357,6 +357,15 @@ public class Services { try self.keychainStore.deleteToken() } + public func hasToken() -> Bool { + do { + _ = try self.keychainStore.getToken() + return true + } catch { + return false + } + } + /// Parse a json data and tries to extract its error message /// - Parameters: /// - data: some JSON data