FIRFakeAppCheck.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2023 Google LLC
  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. #import <FirebaseAppCheckInterop/FirebaseAppCheckInterop.h>
  18. NS_ASSUME_NONNULL_BEGIN
  19. /** @var kFakeAppCheckToken
  20. @brief A fake App Check token.
  21. */
  22. static NSString *const kFakeAppCheckToken = @"appCheckToken";
  23. @interface FIRFakeAppCheck : NSObject <FIRAppCheckInterop>
  24. /** @property tokenDidChangeNotificationName
  25. @brief A notification with the specified name is sent to the default notification center
  26. (`NotificationCenter.default`) each time a Firebase app check token is refreshed.
  27. */
  28. @property(nonatomic, nonnull, readwrite, copy) NSString *tokenDidChangeNotificationName;
  29. /** @property notificationAppNameKey
  30. @brief `userInfo` key for the FAC token in a notification for `tokenDidChangeNotificationName`.
  31. */
  32. @property(nonatomic, nonnull, readwrite, copy) NSString *notificationAppNameKey;
  33. /** @property notificationAppNameKey
  34. @brief `userInfo` key for the `FirebaseApp.name` in a notification for
  35. `tokenDidChangeNotificationName`.
  36. */
  37. @property(nonatomic, nonnull, readwrite, copy) NSString *notificationTokenKey;
  38. /** @fn getTokenForcingRefresh:completion:
  39. @brief A fake appCheck used for dependency injection during testing.
  40. @param forcingRefresh dtermines if a new token is generated.
  41. @param handler to update the cache.
  42. */
  43. - (void)getTokenForcingRefresh:(BOOL)forcingRefresh
  44. completion:(nonnull FIRAppCheckTokenHandlerInterop)handler;
  45. @end
  46. NS_ASSUME_NONNULL_END