FIRAppAttestKeyIDStorage.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2021 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. @class FBLPromise<ValueType>;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /// The protocol defines methods to store App Attest key IDs per Firebase app.
  20. @protocol FIRAppAttestKeyIDStorageProtocol <NSObject>
  21. /** Manages storage of an app attest key ID.
  22. * @param keyID The app attest key ID to store or `nil` to remove the existing app attest key ID.
  23. * @return A promise that is resolved with a stored app attest key ID or `nil` if the existing app
  24. * attest key ID has been removed.
  25. */
  26. - (FBLPromise<NSString *> *)setAppAttestKeyID:(nullable NSString *)keyID;
  27. /** Reads a stored app attest key ID.
  28. * @return A promise that is resolved with a stored app attest key ID or `nil` if there is not a
  29. * stored app attest key ID. The promise is rejected with an error in the case of a missing app
  30. * attest key ID .
  31. */
  32. - (FBLPromise<NSString *> *)getAppAttestKeyID;
  33. @end
  34. /// The App Attest key ID storage implementation.
  35. /// This class is designed for use by `FIRAppAttestProvider`. It's operations are managed by
  36. /// `FIRAppAttestProvider`'s internal serial queue. It is not considered thread safe and should not
  37. /// be used by other classes at this time.
  38. @interface FIRAppAttestKeyIDStorage : NSObject <FIRAppAttestKeyIDStorageProtocol>
  39. - (instancetype)init NS_UNAVAILABLE;
  40. /** Default convenience initializer.
  41. * @param appName A Firebase App name (`FirebaseApp.name`). The app name will be used as a part of
  42. * the key to store the token for the storage instance.
  43. * @param appID A Firebase App identifier (`FirebaseOptions.googleAppID`). The app ID will be used
  44. * as a part of the key to store the token for the storage instance.
  45. */
  46. - (instancetype)initWithAppName:(NSString *)appName appID:(NSString *)appID;
  47. @end
  48. NS_ASSUME_NONNULL_END