     }
 }
 
-public struct APIToken
+@objc
+public class APIToken : NSObject
 {
     var refreshToken:String
     var tokenType:String

            self.set(object: accessToken, for: .accessTokenKey)
            self.set(object: expiresIn, for: .expiresKey)
            self.set(object: scope, for: .scopeKey)
            return self.currentToken
        }
        return nil

    
    public static func clearAuthentication()
    {
        if let email = self.object(for: .emailKey) as? String {
            //clear specific tokens for current email
            UserDefaults.standard.set(nil, forKey: APITokenManager.accessTokenKey(for: email))
            UserDefaults.standard.set(nil, forKey: APITokenManager.refreshTokenKey(for: email))
        }
        
        self.set(object: nil, for: .emailKey)
        self.set(object: nil, for: .refreshTokenKey)
        self.set(object: nil, for: .tokenTypeKey)
        self.set(object: nil, for: .accessTokenKey)
        self.set(object: nil, for: .expiresKey)
        self.set(object: nil, for: .scopeKey)
        self.set(object: nil, for: .scopeKey)
    }
    
    public static func setCurrentToken(for email:String) {
        UserDefaults.standard.set(accessToken, forKey: APITokenManager.accessTokenKey(for: email))
    }
    
    public static func accessToken(for email:String) -> String? {
        return UserDefaults.standard.object(forKey: self.accessTokenKey(for: email)) as? String
    }
    
    public static func refreshToken(for email:String) -> String? {
        return UserDefaults.standard.object(forKey: self.refreshTokenKey(for: email)) as? String
    }
    
    private static func accessTokenKey(for email:String) -> String {
        if let bundleExecutable = Bundle.main.infoDictionary?["CFBundleExecutable"] as? NSString {
            return "\(email)@com.makespace.\(bundleExecutable).access"
        }
        return email
    }
    private static func refreshTokenKey(for email:String) -> String {
        if let bundleExecutable = Bundle.main.infoDictionary?["CFBundleExecutable"] as? NSString {
            return "\(email)@com.makespace.\(bundleExecutable).refresh"
        }
        return email
    }
