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