You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.5 KiB

6 years ago
  1. /*
  2. * Copyright 2018 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/LICENSE-2.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 <Foundation/Foundation.h>
  17. @class FIRAuthRequestConfiguration;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /** @typedef FIRFetchAuthDomainCallback
  20. @brief The callback invoked at the end of the flow to fetch the Auth domain.
  21. @param authDomain The Auth domain.
  22. @param error The error that occured while fetching the auth domain, if any.
  23. */
  24. typedef void (^FIRFetchAuthDomainCallback)(NSString *_Nullable authDomain,
  25. NSError *_Nullable error);
  26. /** @class FIRAuthURLUtils
  27. @brief A utility class used to facilitate the creation of auth related URLs.
  28. */
  29. @interface FIRAuthWebUtils : NSObject
  30. /** @fn randomStringWithLength:
  31. @brief Generates a random string of a specified length.
  32. */
  33. + (NSString *)randomStringWithLength:(NSUInteger)length;
  34. /** @fn isCallbackSchemeRegisteredForCustomURLScheme:
  35. @brief Checks whether or not the provided custom URL scheme has been registered by the app.
  36. @param URLScheme The custom URL scheme to be checked against all custom URL schemes registered by the app.
  37. @return whether or not the provided custom URL scheme has been registered by the app.
  38. */
  39. + (BOOL)isCallbackSchemeRegisteredForCustomURLScheme:(NSString *)URLScheme;
  40. /** @fn fetchAuthDomainWithCompletion:completion:
  41. @brief Fetches the auth domain associated with the Firebase Project.
  42. @param completion The callback invoked after the auth domain has been constructed or an error
  43. has been encountered.
  44. */
  45. + (void)fetchAuthDomainWithRequestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
  46. completion:(FIRFetchAuthDomainCallback)completion;
  47. /** @fn queryItemValue:from:
  48. @brief Utility function to get a value from a NSURLQueryItem array.
  49. @param name The key.
  50. @param queryList The NSURLQueryItem array.
  51. @return The value for the key.
  52. */
  53. + (NSString *)queryItemValue:(NSString *)name from:(NSArray<NSURLQueryItem *> *)queryList;
  54. @end
  55. NS_ASSUME_NONNULL_END