]> git.saurik.com Git - apple/security.git/blob - keychain/ckks/CloudKitDependencies.h
Security-58286.251.4.tar.gz
[apple/security.git] / keychain / ckks / CloudKitDependencies.h
1 /*
2 * Copyright (c) 2016 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef CloudKitDependencies_h
25 #define CloudKitDependencies_h
26
27 #import <ApplePushService/ApplePushService.h>
28 #import <CloudKit/CloudKit.h>
29 #import <Foundation/Foundation.h>
30
31 NS_ASSUME_NONNULL_BEGIN
32
33 /* CKModifyRecordZonesOperation */
34 @protocol CKKSModifyRecordZonesOperation <NSObject>
35 + (instancetype)alloc;
36 - (instancetype)initWithRecordZonesToSave:(nullable NSArray<CKRecordZone*>*)recordZonesToSave
37 recordZoneIDsToDelete:(nullable NSArray<CKRecordZoneID*>*)recordZoneIDsToDelete;
38
39 @property (nonatomic, strong, nullable) CKDatabase* database;
40 @property (nonatomic, copy, nullable) NSArray<CKRecordZone*>* recordZonesToSave;
41 @property (nonatomic, copy, nullable) NSArray<CKRecordZoneID*>* recordZoneIDsToDelete;
42 @property NSOperationQueuePriority queuePriority;
43 @property NSQualityOfService qualityOfService;
44 @property (nonatomic, strong, nullable) CKOperationGroup* group;
45 @property (nonatomic, copy, null_resettable) CKOperationConfiguration *configuration;
46
47 @property (nonatomic, copy, nullable) void (^modifyRecordZonesCompletionBlock)
48 (NSArray<CKRecordZone*>* _Nullable savedRecordZones, NSArray<CKRecordZoneID*>* _Nullable deletedRecordZoneIDs, NSError* _Nullable operationError);
49
50 @end
51
52 @interface CKModifyRecordZonesOperation (SecCKKSModifyRecordZonesOperation) <CKKSModifyRecordZonesOperation>
53 ;
54 @end
55
56 /* CKModifySubscriptionsOperation */
57 @protocol CKKSModifySubscriptionsOperation <NSObject>
58 + (instancetype)alloc;
59 - (instancetype)initWithSubscriptionsToSave:(nullable NSArray<CKSubscription*>*)subscriptionsToSave
60 subscriptionIDsToDelete:(nullable NSArray<NSString*>*)subscriptionIDsToDelete;
61
62 @property (nonatomic, strong, nullable) CKDatabase* database;
63 @property (nonatomic, copy, nullable) NSArray<CKSubscription*>* subscriptionsToSave;
64 @property (nonatomic, copy, nullable) NSArray<NSString*>* subscriptionIDsToDelete;
65 @property NSOperationQueuePriority queuePriority;
66 @property NSQualityOfService qualityOfService;
67 @property (nonatomic, strong, nullable) CKOperationGroup* group;
68 @property (nonatomic, copy, null_resettable) CKOperationConfiguration *configuration;
69
70 @property (nonatomic, copy, nullable) void (^modifySubscriptionsCompletionBlock)
71 (NSArray<CKSubscription*>* _Nullable savedSubscriptions, NSArray<NSString*>* _Nullable deletedSubscriptionIDs, NSError* _Nullable operationError);
72 @end
73
74 @interface CKModifySubscriptionsOperation (SecCKKSModifySubscriptionsOperation) <CKKSModifySubscriptionsOperation>
75 ;
76 @end
77
78 /* CKFetchRecordZoneChangesOperation */
79 @protocol CKKSFetchRecordZoneChangesOperation <NSObject>
80 + (instancetype)alloc;
81 - (instancetype)initWithRecordZoneIDs:(NSArray<CKRecordZoneID*>*)recordZoneIDs
82 configurationsByRecordZoneID:(nullable NSDictionary<CKRecordZoneID*, CKFetchRecordZoneChangesConfiguration*>*)configurationsByRecordZoneID;
83
84 @property (nonatomic, strong, nullable) CKDatabase *database;
85 @property (nonatomic, copy, nullable) NSArray<CKRecordZoneID*>* recordZoneIDs;
86 @property (nonatomic, copy, nullable) NSDictionary<CKRecordZoneID*, CKFetchRecordZoneChangesConfiguration*>* configurationsByRecordZoneID;
87
88 @property (nonatomic, assign) BOOL fetchAllChanges;
89 @property (nonatomic, copy, nullable) void (^recordChangedBlock)(CKRecord* record);
90 @property (nonatomic, copy, nullable) void (^recordWithIDWasDeletedBlock)(CKRecordID* recordID, NSString* recordType);
91 @property (nonatomic, copy, nullable) void (^recordZoneChangeTokensUpdatedBlock)
92 (CKRecordZoneID* recordZoneID, CKServerChangeToken* _Nullable serverChangeToken, NSData* _Nullable clientChangeTokenData);
93 @property (nonatomic, copy, nullable) void (^recordZoneFetchCompletionBlock)(CKRecordZoneID* recordZoneID,
94 CKServerChangeToken* _Nullable serverChangeToken,
95 NSData* _Nullable clientChangeTokenData,
96 BOOL moreComing,
97 NSError* _Nullable recordZoneError);
98 @property (nonatomic, copy, nullable) void (^fetchRecordZoneChangesCompletionBlock)(NSError* _Nullable operationError);
99
100 @property (nonatomic, strong, nullable) CKOperationGroup* group;
101 @property (nonatomic, copy, null_resettable) CKOperationConfiguration *configuration;
102
103 @property (nonatomic, copy) NSString *operationID;
104 @property (nonatomic, readonly, strong, nullable) CKOperationConfiguration *resolvedConfiguration;
105 @end
106
107 @interface CKFetchRecordZoneChangesOperation () <CKKSFetchRecordZoneChangesOperation>
108 @end
109
110 /* CKFetchRecordsOperation */
111 @protocol CKKSFetchRecordsOperation <NSObject>
112 + (instancetype)alloc;
113 - (instancetype)init;
114 - (instancetype)initWithRecordIDs:(NSArray<CKRecordID*>*)recordIDs;
115
116 @property (nonatomic, strong, nullable) CKDatabase *database;
117 @property (nonatomic, copy, nullable) NSArray<CKRecordID*>* recordIDs;
118 @property (nonatomic, copy, nullable) NSArray<NSString*>* desiredKeys;
119 @property (nonatomic, copy, nullable) CKOperationConfiguration* configuration;
120 @property (nonatomic, copy, nullable) void (^perRecordProgressBlock)(CKRecordID* recordID, double progress);
121 @property (nonatomic, copy, nullable) void (^perRecordCompletionBlock)
122 (CKRecord* _Nullable record, CKRecordID* _Nullable recordID, NSError* _Nullable error);
123 @property (nonatomic, copy, nullable) void (^fetchRecordsCompletionBlock)
124 (NSDictionary<CKRecordID*, CKRecord*>* _Nullable recordsByRecordID, NSError* _Nullable operationError);
125 @end
126
127 @interface CKFetchRecordsOperation () <CKKSFetchRecordsOperation>
128 @end
129
130 /* CKQueryOperation */
131
132 @protocol CKKSQueryOperation <NSObject>
133 + (instancetype)alloc;
134 - (instancetype)initWithQuery:(CKQuery*)query;
135 //Not implemented: - (instancetype)initWithCursor:(CKQueryCursor *)cursor;
136
137 @property (nonatomic, copy, nullable) CKQuery* query;
138 @property (nonatomic, copy, nullable) CKQueryCursor* cursor;
139
140 @property (nonatomic, copy, nullable) CKRecordZoneID* zoneID;
141 @property (nonatomic, assign) NSUInteger resultsLimit;
142 @property (nonatomic, copy, nullable) NSArray<NSString*>* desiredKeys;
143
144 @property (nonatomic, copy, nullable) void (^recordFetchedBlock)(CKRecord* record);
145 @property (nonatomic, copy, nullable) void (^queryCompletionBlock)(CKQueryCursor* _Nullable cursor, NSError* _Nullable operationError);
146 @end
147
148 @interface CKQueryOperation () <CKKSQueryOperation>
149 @end
150
151 /* APSConnection */
152 @protocol CKKSAPSConnection <NSObject>
153 + (instancetype)alloc;
154 - (id)initWithEnvironmentName:(NSString*)environmentName
155 namedDelegatePort:(NSString*)namedDelegatePort
156 queue:(dispatch_queue_t)queue;
157
158 - (void)setEnabledTopics:(NSArray*)enabledTopics;
159
160 @property (nonatomic, readwrite, assign) id<APSConnectionDelegate> delegate;
161 @end
162
163 @interface APSConnection (SecCKKSAPSConnection) <CKKSAPSConnection>
164 @end
165
166 /* NSNotificationCenter */
167 @protocol CKKSNSNotificationCenter <NSObject>
168 + (instancetype)defaultCenter;
169 - (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject;
170 - (void)removeObserver:(id)observer;
171 @end
172 @interface NSNotificationCenter () <CKKSNSNotificationCenter>
173 @end
174
175 /* Since CKDatabase doesn't share any types with NSOperationQueue, tell the type system about addOperation */
176 @protocol CKKSOperationQueue <NSObject>
177 - (void)addOperation:(NSOperation*)operation;
178 @end
179
180 @interface CKDatabase () <CKKSOperationQueue>
181 @end
182
183 @interface NSOperationQueue () <CKKSOperationQueue>
184 @end
185
186 NS_ASSUME_NONNULL_END
187
188 #endif /* CloudKitDependencies_h */