Add camera QR pairing, Bonjour discovery and pinned address recovery
This commit is contained in:
@@ -66,7 +66,9 @@ struct Invitation: Decodable {
|
||||
var base64 = encoded.replacingOccurrences(of: "-", with: "+").replacingOccurrences(of: "_", with: "/")
|
||||
base64 += String(repeating: "=", count: (4 - base64.count % 4) % 4)
|
||||
guard let data = Data(base64Encoded: base64) else { throw BridgeError.message("Повреждённые данные QR.") }
|
||||
let invitation = try JSONDecoder().decode(Invitation.self, from: data)
|
||||
let invitation: Invitation
|
||||
do { invitation = try JSONDecoder().decode(Invitation.self, from: data) }
|
||||
catch { throw BridgeError.message("QR не содержит корректного приглашения MusicBridge. Откройте новый QR в агенте на ПК.") }
|
||||
let formatter = ISO8601DateFormatter()
|
||||
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
||||
var expiry = formatter.date(from: invitation.expiresAt)
|
||||
|
||||
Reference in New Issue
Block a user