FIRDeviceCheckProvider.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #import "FIRAppCheckAvailability.h"
  18. #import "FIRAppCheckProvider.h"
  19. @class FIRApp;
  20. @protocol FIRDeviceCheckAPIServiceProtocol;
  21. @protocol FIRDeviceCheckTokenGenerator;
  22. NS_ASSUME_NONNULL_BEGIN
  23. /// Firebase App Check provider that verifies app integrity using the
  24. /// [DeviceCheck](https://developer.apple.com/documentation/devicecheck) API.
  25. /// This class is available on all platforms for select OS versions. See
  26. /// https://firebase.google.com/docs/ios/learn-more for more details.
  27. FIR_DEVICE_CHECK_PROVIDER_AVAILABILITY
  28. NS_SWIFT_NAME(DeviceCheckProvider)
  29. @interface FIRDeviceCheckProvider : NSObject <FIRAppCheckProvider>
  30. - (instancetype)init NS_UNAVAILABLE;
  31. /// The default initializer.
  32. /// @param app A `FirebaseApp` instance.
  33. /// @return An instance of `DeviceCheckProvider` if the provided `FirebaseApp` instance contains all
  34. /// required parameters.
  35. - (nullable instancetype)initWithApp:(FIRApp *)app;
  36. /* Jazzy doesn't generate documentation for protocol-inherited
  37. * methods, so this is copied over from the protocol declaration.
  38. */
  39. /// Returns a new Firebase App Check token.
  40. /// @param handler The completion handler. Make sure to call the handler with either a token
  41. /// or an error.
  42. - (void)getTokenWithCompletion:
  43. (void (^)(FIRAppCheckToken *_Nullable token, NSError *_Nullable error))handler
  44. NS_SWIFT_NAME(getToken(completion:));
  45. /// Returns a new Firebase App Check token.
  46. /// When implementing this method for your custom provider, the token returned should be suitable
  47. /// for consumption in a limited-use scenario. If you do not implement this method, the
  48. /// getTokenWithCompletion will be invoked instead whenever a limited-use token is requested.
  49. /// @param handler The completion handler. Make sure to call the handler with either a token
  50. /// or an error.
  51. - (void)getLimitedUseTokenWithCompletion:
  52. (void (^)(FIRAppCheckToken *_Nullable token, NSError *_Nullable error))handler
  53. NS_SWIFT_NAME(getLimitedUseToken(completion:));
  54. @end
  55. NS_ASSUME_NONNULL_END