Skip to content

Commit 233b3c7

Browse files
committed
[Auth] Update StartMFAEnrollmentRequest to have only immutable properties
1 parent 8ceae78 commit 233b3c7

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

FirebaseAuth/Sources/Swift/Backend/RPC/MultiFactor/Enroll/StartMFAEnrollmentRequest.swift

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,43 @@ class StartMFAEnrollmentRequest: IdentityToolkitRequest, AuthRPCRequest {
2424
typealias Response = StartMFAEnrollmentResponse
2525

2626
let idToken: String?
27-
private(set) var phoneEnrollmentInfo: AuthProtoStartMFAPhoneRequestInfo?
28-
private(set) var totpEnrollmentInfo: AuthProtoStartMFATOTPEnrollmentRequestInfo?
27+
let phoneEnrollmentInfo: AuthProtoStartMFAPhoneRequestInfo?
28+
let totpEnrollmentInfo: AuthProtoStartMFATOTPEnrollmentRequestInfo?
2929

30-
init(idToken: String?,
31-
enrollmentInfo: AuthProtoStartMFAPhoneRequestInfo?,
32-
requestConfiguration: AuthRequestConfiguration) {
33-
self.idToken = idToken
34-
phoneEnrollmentInfo = enrollmentInfo
35-
super.init(
36-
endpoint: kStartMFAEnrollmentEndPoint,
37-
requestConfiguration: requestConfiguration,
38-
useIdentityPlatform: true
30+
convenience init(idToken: String?,
31+
enrollmentInfo: AuthProtoStartMFAPhoneRequestInfo?,
32+
requestConfiguration: AuthRequestConfiguration) {
33+
self.init(
34+
idToken: idToken,
35+
enrollmentInfo: enrollmentInfo,
36+
totpEnrollmentInfo: nil,
37+
requestConfiguration: requestConfiguration
3938
)
4039
}
4140

42-
init(idToken: String?,
43-
totpEnrollmentInfo: AuthProtoStartMFATOTPEnrollmentRequestInfo?,
44-
requestConfiguration: AuthRequestConfiguration) {
41+
convenience init(idToken: String?,
42+
totpEnrollmentInfo: AuthProtoStartMFATOTPEnrollmentRequestInfo?,
43+
requestConfiguration: AuthRequestConfiguration) {
44+
self.init(
45+
idToken: idToken,
46+
enrollmentInfo: nil,
47+
totpEnrollmentInfo: totpEnrollmentInfo,
48+
requestConfiguration: requestConfiguration
49+
)
50+
}
51+
52+
private init(idToken: String?,
53+
enrollmentInfo: AuthProtoStartMFAPhoneRequestInfo?,
54+
totpEnrollmentInfo: AuthProtoStartMFATOTPEnrollmentRequestInfo?,
55+
requestConfiguration: AuthRequestConfiguration) {
4556
self.idToken = idToken
57+
phoneEnrollmentInfo = enrollmentInfo
4658
self.totpEnrollmentInfo = totpEnrollmentInfo
4759
super.init(
4860
endpoint: kStartMFAEnrollmentEndPoint,
4961
requestConfiguration: requestConfiguration,
50-
useIdentityPlatform: true
62+
useIdentityPlatform: true,
63+
useStaging: false
5164
)
5265
}
5366

0 commit comments

Comments
 (0)