You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.0 KiB

  1. /*
  2. * Copyright 2019 Google
  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. /* The Keychain error domain */
  18. extern NSString *const kFIRInstanceIDKeychainErrorDomain;
  19. /*
  20. * Wrapping the keychain operations in a serialize queue. This is to avoid keychain operation
  21. * blocking main queue.
  22. */
  23. @interface FIRInstanceIDKeychain : NSObject
  24. /**
  25. * FIRInstanceIDKeychain.
  26. *
  27. * @return A shared instance of FIRInstanceIDKeychain.
  28. */
  29. + (instancetype)sharedInstance;
  30. /**
  31. * Get keychain items matching the given a query.
  32. *
  33. * @param keychainQuery The keychain query.
  34. *
  35. * @return An CFTypeRef result matching the provided inputs.
  36. */
  37. - (CFTypeRef)itemWithQuery:(NSDictionary *)keychainQuery;
  38. /**
  39. * Remove the cached items from the keychain matching the query.
  40. *
  41. * @param keychainQuery The keychain query.
  42. * @param handler The callback handler which is invoked when the remove operation is
  43. * complete, with an error if there is any.
  44. */
  45. - (void)removeItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *error))handler;
  46. /**
  47. * Add the item with a given query.
  48. *
  49. * @param keychainQuery The keychain query.
  50. * @param handler The callback handler which is invoked when the add operation is
  51. * complete, with an error if there is any.
  52. */
  53. - (void)addItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *))handler;
  54. @end