GACAppCheckAPIService.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 "AppCheckCore/Sources/Public/AppCheckCore/GACAppAttestProvider.h"
  18. @class FBLPromise<Result>;
  19. @class GULURLSessionDataResponse;
  20. @class GACAppCheckToken;
  21. NS_ASSUME_NONNULL_BEGIN
  22. @protocol GACAppCheckAPIServiceProtocol <NSObject>
  23. @property(nonatomic, readonly) NSString *baseURL;
  24. - (FBLPromise<GULURLSessionDataResponse *> *)
  25. sendRequestWithURL:(NSURL *)requestURL
  26. HTTPMethod:(NSString *)HTTPMethod
  27. body:(nullable NSData *)body
  28. additionalHeaders:(nullable NSDictionary<NSString *, NSString *> *)additionalHeaders;
  29. - (FBLPromise<GACAppCheckToken *> *)appCheckTokenWithAPIResponse:
  30. (GULURLSessionDataResponse *)response;
  31. @end
  32. @interface GACAppCheckAPIService : NSObject <GACAppCheckAPIServiceProtocol>
  33. /**
  34. * The default initializer.
  35. * @param session The URL session used to make network requests.
  36. * @param baseURL The base URL for the App Check service, e.g.,
  37. * `https://firebaseappcheck.googleapis.com/v1`.
  38. * @param APIKey The Google Cloud Platform API key, if needed, or nil.
  39. * @param requestHooks Hooks that will be invoked on requests through this service.
  40. */
  41. - (instancetype)initWithURLSession:(NSURLSession *)session
  42. baseURL:(nullable NSString *)baseURL
  43. APIKey:(nullable NSString *)APIKey
  44. requestHooks:(nullable NSArray<GACAppCheckAPIRequestHook> *)requestHooks
  45. NS_DESIGNATED_INITIALIZER;
  46. - (instancetype)init NS_UNAVAILABLE;
  47. @end
  48. NS_ASSUME_NONNULL_END