Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
main ▾

xtool.git / Sources / XKit / GrandSlam / Requests / Concrete / GrandSlamTrustedDeviceRequest.swift

GrandSlamTrustedDeviceRequest.swift56 lines · 1.5 KiBRaw
1//
2// GrandSlamTrustedDeviceRequest.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
11struct GrandSlamTrustedDeviceRequest: GrandSlamTwoFactorRequest {
12 struct Decoder: GrandSlamDataDecoder {
13 static func decode(data: Data) throws {}
14 }
15
16 static let endpoint: GrandSlamEndpoint = .lookup(\.trustedDeviceSecondaryAuth)
17
18 let loginData: GrandSlamLoginData
19}
20
21struct GrandSlamSecondaryAuthRequest: GrandSlamTwoFactorRequest {
22 struct Decoder: GrandSlamDataDecoder {
23 static func decode(data: Data) throws {
24// print(String(data: data, encoding: .utf8) ?? "NO DATA")
25 }
26 }
27
28 static let endpoint: GrandSlamEndpoint = .lookup(\.secondaryAuth)
29
30 let loginData: GrandSlamLoginData
31}
32
33struct GrandSlamSMSAuthRequest: GrandSlamTwoFactorRequest {
34 struct Decoder: GrandSlamDataDecoder {
35 static func decode(data: Data) throws {}
36 }
37
38 static let endpoint: GrandSlamEndpoint = .url(URL(string: "https://gsa.apple.com/auth/verify/phone")!)
39
40 let loginData: GrandSlamLoginData
41 let phoneNumberID: Int
42
43 var extraHeaders: [String: String] {
44 [
45 "Content-Type": "application/json",
46 "Accept": "application/json",
47 ]
48 }
49
50 func content(anisetteData: AnisetteData) -> GrandSlamRequestContent {
51 .put([
52 "phoneNumber": ["id": phoneNumberID],
53 "mode": "sms",
54 ], type: .json)
55 }
56}