Sesame-iOS/Sesame/Common/ServerChallenge.swift

18 lines
475 B
Swift
Raw Normal View History

2023-12-12 17:33:42 +01:00
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?)