Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
appstore-distribution ▾

xtool.git / Sources / XKit / GrandSlam / Requests / GrandSlamTwoFactorRequest.swift

GrandSlamTwoFactorRequest.swift35 lines · 1.2 KiBRaw
1//
2// GrandSlamTwoFactorRequest.swift
3// XKit
4//
5// Created by Kabir Oberai on 20/11/19.
6// Copyright © 2019 Kabir Oberai. All rights reserved.
7//
8
9import Foundation
10
11protocol GrandSlamTwoFactorRequest: GrandSlamRequest {
12 var loginData: GrandSlamLoginData { get }
13 var extraHeaders: [String: String] { get }
14}
15
16extension GrandSlamTwoFactorRequest {
17
18 var extraHeaders: [String: String] { [:] }
19
20 func configure(request: inout HTTPRequest, anisetteData: AnisetteData) {
21 request.headerFields[.accept] = "application/x-buddyml"
22 request.headerFields[.contentType] = "application/x-plist"
23 request.headerFields[.userAgent] = anisetteData.deviceInfo.akdUserAgent
24 request.headerFields[.init("X-Apple-App-Info")!] = "com.apple.gs.xcode.auth"
25 request.headerFields[.init(DeviceInfo.xcodeVersionKey)!] = DeviceInfo.xcodeVersion
26 request.headerFields[.init("X-Apple-Identity-Token")!] = loginData.identityToken
27 anisetteData.dictionary.forEach { request.headerFields[.init($0)!] = $1 }
28 extraHeaders.forEach { request.headerFields[.init($0)!] = $1 }
29 }
30
31 func method(anisetteData: AnisetteData) -> GrandSlamMethod {
32 .get
33 }
34
35}