No Description

FIRInstanceIDKeychain.h 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. @class FIRInstanceIDKeyPair;
  20. /*
  21. * Wrapping the keychain operations in a serialize queue. This is to avoid keychain operation
  22. * blocking main queue.
  23. */
  24. @interface FIRInstanceIDKeychain : NSObject
  25. /**
  26. * FIRInstanceIDKeychain.
  27. *
  28. * @return A shared instance of FIRInstanceIDKeychain.
  29. */
  30. + (instancetype)sharedInstance;
  31. /**
  32. * Get keychain items matching the given a query.
  33. *
  34. * @param keychainQuery The keychain query.
  35. *
  36. * @return An CFTypeRef result matching the provided inputs.
  37. */
  38. - (CFTypeRef)itemWithQuery:(NSDictionary *)keychainQuery;
  39. /**
  40. * Remove the cached items from the keychain matching the query.
  41. *
  42. * @param keychainQuery The keychain query.
  43. * @param handler The callback handler which is invoked when the remove operation is
  44. * complete, with an error if there is any.
  45. */
  46. - (void)removeItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *error))handler;
  47. /**
  48. * Add the item with a given query.
  49. *
  50. * @param keychainQuery The keychain query.
  51. * @param handler The callback handler which is invoked when the add operation is
  52. * complete, with an error if there is any.
  53. */
  54. - (void)addItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *))handler;
  55. #pragma mark - Keypair
  56. /**
  57. * Generate a public/private key pair given their tags.
  58. *
  59. * @param privateTag The private tag associated with the private key.
  60. * @param publicTag The public tag associated with the public key.
  61. *
  62. * @return A new FIRInstanceIDKeyPair object.
  63. */
  64. - (FIRInstanceIDKeyPair *)generateKeyPairWithPrivateTag:(NSString *)privateTag
  65. publicTag:(NSString *)publicTag;
  66. @end