]> git.saurik.com Git - apple/security.git/blob - keychain/ot/OTCloudStore.h
Security-58286.70.7.tar.gz
[apple/security.git] / keychain / ot / OTCloudStore.h
1 /*
2 * Copyright (c) 2017 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 #ifndef OTCloudStore_h
24 #define OTCloudStore_h
25
26 #if OCTAGON
27 #import "keychain/ot/OTLocalStore.h"
28
29 #import <CloudKit/CloudKit.h>
30 #import <CloudKit/CKContainer_Private.h>
31
32 #import "keychain/ckks/CKKSZone.h"
33 #import "keychain/ckks/CloudKitDependencies.h"
34 #import "keychain/ckks/CKKSCondition.h"
35 #import "keychain/ckks/CKKSZoneChangeFetcher.h"
36 #import "keychain/ckks/CKKSNotifier.h"
37 #import "keychain/ckks/CKKSSQLDatabaseObject.h"
38 #import "keychain/ckks/CKKSRecordHolder.h"
39 #import "OTBottledPeerRecord.h"
40
41 NS_ASSUME_NONNULL_BEGIN
42
43 @interface OTCloudStore : CKKSZone <CKKSZoneUpdateReceiver, CKKSAccountStateListener>
44
45 @property (nonatomic, readonly) NSString* contextID;
46 @property (nonatomic, readonly) NSString* dsid;
47 @property (nonatomic, readonly) NSString* containerName;
48 @property (nonatomic, readonly) CKRecordID* recordID;
49 @property (nonatomic, readonly) CKKSResultOperation* viewSetupOperation;
50 @property CKKSCondition* loggedIn;
51 @property CKKSCondition* loggedOut;
52
53
54 - (instancetype) initWithContainer:(CKContainer*) container
55 zoneName:(NSString*)zoneName
56 accountTracker:(nullable CKKSCKAccountStateTracker*)tracker
57 reachabilityTracker:(nullable CKKSReachabilityTracker*)reachabilityTracker
58 localStore:(OTLocalStore*)localStore
59 contextID:(NSString*)contextID
60 dsid:(NSString*)dsid
61 fetchRecordZoneChangesOperationClass:(Class<CKKSFetchRecordZoneChangesOperation>) fetchRecordZoneChangesOperationClass
62 fetchRecordsOperationClass:(Class<CKKSFetchRecordsOperation>)fetchRecordsOperationClass
63 queryOperationClass:(Class<CKKSQueryOperation>)queryOperationClass
64 modifySubscriptionsOperationClass:(Class<CKKSModifySubscriptionsOperation>) modifySubscriptionsOperationClass
65 modifyRecordZonesOperationClass:(Class<CKKSModifyRecordZonesOperation>) modifyRecordZonesOperationClass
66 apsConnectionClass:(Class<CKKSAPSConnection>) apsConnectionClass
67 operationQueue:(nullable NSOperationQueue *)operationQueue;
68
69
70 - (BOOL) uploadBottledPeerRecord:(OTBottledPeerRecord *)bprecord
71 escrowRecordID:(NSString *)escrowRecordID
72 error:(NSError**)error;
73 - (BOOL) downloadBottledPeerRecord:(NSError**)error;
74 - (BOOL) removeBottledPeerRecordID:(CKRecordID*)recordID error:(NSError**)error;
75 - (nullable NSArray*) retrieveListOfEligibleEscrowRecordIDs:(NSError**)error;
76
77 - (void)notifyZoneChange:(CKRecordZoneNotification* _Nullable)notification;
78 - (void)handleCKLogin;
79 - (BOOL) performReset:(NSError**)error;
80
81 @end
82
83 NS_ASSUME_NONNULL_END
84 #endif
85 #endif /* OTCloudStore_h */