import Foundation /// A fully revealed, mutually-consented connection between two present users. /// /// Connections can **only** be created from a mutual `Encounter`. There is no /// path to create one online — you must have been physically near each other. struct Connection: Identifiable, Codable, Hashable { let id: UUID let encounterID: UUID let remoteUserID: String let displayName: String let createdAt: Date let lastMessageAt: Date? /// The E2E session key used for this conversation. let sessionKeyID: String init( id: UUID = UUID(), encounterID: UUID, remoteUserID: String, displayName: String, createdAt: Date = Date(), lastMessageAt: Date? = nil, sessionKeyID: String ) { self.id = id self.encounterID = encounterID self.remoteUserID = remoteUserID self.displayName = displayName self.createdAt = createdAt self.lastMessageAt = lastMessageAt self.sessionKeyID = sessionKeyID } }