You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. [Server] Generate challenge and return to Client(iOS)
import Foundation
import Crypt
@mainstructApp{
// DB or Server session data
varchallenges:[Challenge]=[]mutatingfunc generateChallenge(userId:UUID, sessionId:UUID)->Data{letchallenge=Challenge(
userId: userId,
sessionId: sessionId,
expiredAt:Date.now.addingTimeInterval(5*60), // expired after 5 minutes.
value:Data(AES.GCM.Nonce()))
challenges.append(challenge)return challenge.value
}}structChallenge{varuserId:UUIDvarsessionId:UUIDvarexpiredAt:Datevarvalue:Data}