xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XKit / GrandSlam / Requests / Concrete / GrandSlamValidateRequest.swift
GrandSlamValidateRequest.swift48 lines · 1.2 KiBRaw
| 1 | // |
| 2 | // GrandSlamValidateRequest.swift |
| 3 | // XKit |
| 4 | // |
| 5 | // Created by Kabir Oberai on 20/11/19. |
| 6 | // Copyright © 2019 Kabir Oberai. All rights reserved. |
| 7 | // |
| 8 | |
| 9 | import Foundation |
| 10 | |
| 11 | struct GrandSlamValidateRequest: GrandSlamTwoFactorRequest { |
| 12 | struct Decoder: GrandSlamDataDecoder { |
| 13 | static func decode(data: Data) throws {} |
| 14 | } |
| 15 | |
| 16 | static let endpoint: GrandSlamEndpoint = .lookup(\.validateCode) |
| 17 | |
| 18 | let loginData: GrandSlamLoginData |
| 19 | let verificationCode: String |
| 20 | |
| 21 | var extraHeaders: [String: String] { |
| 22 | ["security-code": verificationCode] |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | struct GrandSlamValidateSMSRequest: GrandSlamTwoFactorRequest { |
| 27 | struct Decoder: GrandSlamDataDecoder { |
| 28 | static func decode(data: Data) throws {} |
| 29 | } |
| 30 | |
| 31 | static let endpoint: GrandSlamEndpoint = .url(URL( |
| 32 | string: "https://gsa.apple.com/auth/verify/phone/securitycode?referrer=/auth/verify/phone/put" |
| 33 | )!) |
| 34 | |
| 35 | let loginData: GrandSlamLoginData |
| 36 | let phoneNumberID: String |
| 37 | let verificationCode: String |
| 38 | |
| 39 | func method(anisetteData: AnisetteData) -> GrandSlamMethod { |
| 40 | .post([ |
| 41 | "securityCode.code": verificationCode, |
| 42 | "serverInfo": [ |
| 43 | "mode": "sms", |
| 44 | "phoneNumber.id": phoneNumberID |
| 45 | ] |
| 46 | ]) |
| 47 | } |
| 48 | } |