FIRAppCheckInterop.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2020 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. @protocol FIRAppCheckTokenResultInterop;
  18. NS_ASSUME_NONNULL_BEGIN
  19. NS_SWIFT_NAME(AppCheckTokenHandlerInterop)
  20. typedef void (^FIRAppCheckTokenHandlerInterop)(id<FIRAppCheckTokenResultInterop> tokenResult);
  21. NS_SWIFT_NAME(AppCheckInterop) @protocol FIRAppCheckInterop
  22. /// Retrieve a cached or generate a new FAA Token. If forcingRefresh == YES always generates a new
  23. /// token and updates the cache.
  24. - (void)getTokenForcingRefresh:(BOOL)forcingRefresh
  25. completion:(FIRAppCheckTokenHandlerInterop)handler
  26. NS_SWIFT_NAME(getToken(forcingRefresh:completion:));
  27. /// A notification with the specified name is sent to the default notification center
  28. /// (`NotificationCenter.default`) each time a Firebase app check token is refreshed.
  29. /// The user info dictionary contains `-[self notificationTokenKey]` and
  30. /// `-[self notificationAppNameKey]` keys.
  31. - (NSString *)tokenDidChangeNotificationName;
  32. /// `userInfo` key for the FAC token in a notification for `tokenDidChangeNotificationName`.
  33. - (NSString *)notificationTokenKey;
  34. /// `userInfo` key for the `FirebaseApp.name` in a notification for
  35. /// `tokenDidChangeNotificationName`.
  36. - (NSString *)notificationAppNameKey;
  37. // MARK: - Optional API
  38. @optional
  39. /// Retrieve a new limited-use Firebase App Check token
  40. - (void)getLimitedUseTokenWithCompletion:(FIRAppCheckTokenHandlerInterop)handler
  41. NS_SWIFT_NAME(getLimitedUseToken(completion:));
  42. @end
  43. NS_ASSUME_NONNULL_END