FIRAuthBackend+MultiFactor.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <TargetConditionals.h>
  17. #if TARGET_OS_IOS
  18. #import "FirebaseAuth/Sources/Backend/FIRAuthBackend+MultiFactor.h"
  19. @implementation FIRAuthBackend (MultiFactor)
  20. + (void)startMultiFactorEnrollment:(FIRStartMFAEnrollmentRequest *)request
  21. callback:(FIRStartMFAEnrollmentResponseCallback)callback {
  22. FIRStartMFAEnrollmentResponse *response = [[FIRStartMFAEnrollmentResponse alloc] init];
  23. [[self implementation] callWithRequest:request
  24. response:response
  25. callback:^(NSError *error) {
  26. if (error) {
  27. callback(nil, error);
  28. } else {
  29. callback(response, nil);
  30. }
  31. }];
  32. }
  33. + (void)finalizeMultiFactorEnrollment:(FIRFinalizeMFAEnrollmentRequest *)request
  34. callback:(FIRFinalizeMFAEnrollmentResponseCallback)callback {
  35. FIRFinalizeMFAEnrollmentResponse *response = [[FIRFinalizeMFAEnrollmentResponse alloc] init];
  36. [[self implementation] callWithRequest:request
  37. response:response
  38. callback:^(NSError *error) {
  39. if (error) {
  40. callback(nil, error);
  41. } else {
  42. callback(response, nil);
  43. }
  44. }];
  45. }
  46. + (void)startMultiFactorSignIn:(FIRStartMFASignInRequest *)request
  47. callback:(FIRStartMFASignInResponseCallback)callback {
  48. FIRStartMFASignInResponse *response = [[FIRStartMFASignInResponse alloc] init];
  49. [[self implementation] callWithRequest:request
  50. response:response
  51. callback:^(NSError *error) {
  52. if (error) {
  53. callback(nil, error);
  54. } else {
  55. callback(response, nil);
  56. }
  57. }];
  58. }
  59. + (void)finalizeMultiFactorSignIn:(FIRFinalizeMFASignInRequest *)request
  60. callback:(FIRFinalizeMFASignInResponseCallback)callback {
  61. FIRFinalizeMFASignInResponse *response = [[FIRFinalizeMFASignInResponse alloc] init];
  62. [[self implementation] callWithRequest:request
  63. response:response
  64. callback:^(NSError *error) {
  65. if (error) {
  66. callback(nil, error);
  67. } else {
  68. callback(response, nil);
  69. }
  70. }];
  71. }
  72. + (void)withdrawMultiFactor:(FIRWithdrawMFARequest *)request
  73. callback:(FIRWithdrawMFAResponseCallback)callback {
  74. FIRWithdrawMFAResponse *response = [[FIRWithdrawMFAResponse alloc] init];
  75. [[self implementation] callWithRequest:request
  76. response:response
  77. callback:^(NSError *error) {
  78. if (error) {
  79. callback(nil, error);
  80. } else {
  81. callback(response, nil);
  82. }
  83. }];
  84. }
  85. @end
  86. #endif