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