FIRAuthBackend+MultiFactor.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.h"
  19. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Enroll/FIRFinalizeMFAEnrollmentRequest.h"
  20. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Enroll/FIRFinalizeMFAEnrollmentResponse.h"
  21. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Enroll/FIRStartMFAEnrollmentRequest.h"
  22. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Enroll/FIRStartMFAEnrollmentResponse.h"
  23. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/SignIn/FIRFinalizeMFASignInRequest.h"
  24. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/SignIn/FIRFinalizeMFASignInResponse.h"
  25. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/SignIn/FIRStartMFASignInRequest.h"
  26. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/SignIn/FIRStartMFASignInResponse.h"
  27. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Unenroll/FIRWithdrawMFARequest.h"
  28. #import "FirebaseAuth/Sources/Backend/RPC/MultiFactor/Unenroll/FIRWithdrawMFAResponse.h"
  29. NS_ASSUME_NONNULL_BEGIN
  30. /** @typedef FIRStartMFAEnrollmentResponseCallback
  31. @brief The type of block used to return the result of a call to the startMFAEnroll endpoint.
  32. @param response The received response, if any.
  33. @param error The error which occurred, if any.
  34. @remarks One of response or error will be non-nil.
  35. */
  36. typedef void (^FIRStartMFAEnrollmentResponseCallback)(
  37. FIRStartMFAEnrollmentResponse *_Nullable response, NSError *_Nullable error);
  38. /** @typedef FIRFinalizeMFAEnrollmentResponseCallback
  39. @brief The type of block used to return the result of a call to the finalizeMFAEnroll endpoint.
  40. @param response The received response, if any.
  41. @param error The error which occurred, if any.
  42. @remarks One of response or error will be non-nil.
  43. */
  44. typedef void (^FIRFinalizeMFAEnrollmentResponseCallback)(
  45. FIRFinalizeMFAEnrollmentResponse *_Nullable response, NSError *_Nullable error);
  46. /** @typedef FIRStartMFASignInResponseCallback
  47. @brief The type of block used to return the result of a call to the startMFASignIn endpoint.
  48. @param response The received response, if any.
  49. @param error The error which occurred, if any.
  50. @remarks One of response or error will be non-nil.
  51. */
  52. typedef void (^FIRStartMFASignInResponseCallback)(FIRStartMFASignInResponse *_Nullable response,
  53. NSError *_Nullable error);
  54. /** @typedef FIRFinalizeMFASignInResponseCallback
  55. @brief The type of block used to return the result of a call to the finalizeMFASignIn endpoint.
  56. @param response The received response, if any.
  57. @param error The error which occurred, if any.
  58. @remarks One of response or error will be non-nil.
  59. */
  60. typedef void (^FIRFinalizeMFASignInResponseCallback)(
  61. FIRFinalizeMFASignInResponse *_Nullable response, NSError *_Nullable error);
  62. /** @typedef FIRWithdrawMFAResponseCallback
  63. @brief The type of block used to return the result of a call to the MFAUnenroll endpoint.
  64. @param response The received response, if any.
  65. @param error The error which occurred, if any.
  66. @remarks One of response or error will be non-nil.
  67. */
  68. typedef void (^FIRWithdrawMFAResponseCallback)(FIRWithdrawMFAResponse *_Nullable response,
  69. NSError *_Nullable error);
  70. @interface FIRAuthBackend (MultiFactor)
  71. /** @fn startMultiFactorEnrollment:callback:
  72. @brief Calls the startMFAEnrollment endpoint.
  73. @param request The request parameters.
  74. @param callback The callback.
  75. */
  76. + (void)startMultiFactorEnrollment:(FIRStartMFAEnrollmentRequest *)request
  77. callback:(FIRStartMFAEnrollmentResponseCallback)callback;
  78. /** @fn finalizeMultiFactorEnrollment:callback:
  79. @brief Calls the finalizeMultiFactorEnrollment endpoint.
  80. @param request The request parameters.
  81. @param callback The callback.
  82. */
  83. + (void)finalizeMultiFactorEnrollment:(FIRFinalizeMFAEnrollmentRequest *)request
  84. callback:(FIRFinalizeMFAEnrollmentResponseCallback)callback;
  85. /** @fn startMultiFactorSignIn:callback:
  86. @brief Calls the startMultiFactorSignIn endpoint.
  87. @param request The request parameters.
  88. @param callback The callback.
  89. */
  90. + (void)startMultiFactorSignIn:(FIRStartMFASignInRequest *)request
  91. callback:(FIRStartMFASignInResponseCallback)callback;
  92. /** @fn finalizeMultiFactorSignIn:callback:
  93. @brief Calls the finalizeMultiFactorSignIn endpoint.
  94. @param request The request parameters.
  95. @param callback The callback.
  96. */
  97. + (void)finalizeMultiFactorSignIn:(FIRFinalizeMFASignInRequest *)request
  98. callback:(FIRFinalizeMFASignInResponseCallback)callback;
  99. /** @fn withdrawMultiFactor:callback:
  100. @brief Calls the withdrawMultiFactor endpoint.
  101. @param request The request parameters.
  102. @param callback The callback.
  103. */
  104. + (void)withdrawMultiFactor:(FIRWithdrawMFARequest *)request
  105. callback:(FIRWithdrawMFAResponseCallback)callback;
  106. @end
  107. NS_ASSUME_NONNULL_END
  108. #endif