import Foundation struct ServerChallenge { private static let challengeExpiryTime: TimeInterval = 25.0 let creationDate: Date let message: Message var isExpired: Bool { creationDate.addingTimeInterval(ServerChallenge.challengeExpiryTime) < Date.now } } typealias ServerResponse = (result: Message, challenge: ServerChallenge?) typealias OptionalServerResponse = (success: Bool, result: Message?, challenge: ServerChallenge?)