3 #import <Foundation/Foundation.h>
4 #import <CloudKit/CloudKit.h>
6 #import "keychain/ckks/CKKSCurrentKeyPointer.h"
7 #import "keychain/ckks/CKKSLockStateTracker.h"
8 #import "keychain/ckks/CKKSPeerProvider.h"
9 #import "keychain/ckks/CKKSProvideKeySetOperation.h"
10 #import "keychain/ckks/CKKSReachabilityTracker.h"
11 #import "keychain/ckks/CKKSNearFutureScheduler.h"
12 #import "keychain/ckks/CKKSSQLDatabaseObject.h"
13 #import "keychain/ckks/CKKSZoneModifier.h"
14 #import "keychain/analytics/CKKSLaunchSequence.h"
15 #import "keychain/ot/OctagonStateMachineHelpers.h"
16 #import "keychain/trust/TrustedPeers/TPSyncingPolicy.h"
18 NS_ASSUME_NONNULL_BEGIN
20 @interface CKKSOperationDependencies
: NSObject
22 @
property (readonly
) CKRecordZoneID
* zoneID
;
23 @
property (nullable
) CKOperationGroup
* ckoperationGroup
;
25 @
property (readonly
) CKKSLaunchSequence
* launch
;
26 @
property (readonly
) id
<OctagonStateFlagHandler
> flagHandler
;
28 @
property (readonly
) CKKSLockStateTracker
* lockStateTracker
;
29 @
property (readonly
) CKKSReachabilityTracker
* reachabilityTracker
;
31 // Due to CKKS's current operation scheduling model, these might be updated after object creation
32 // For example, if an operation is created and waiting to run, and trust arrives, CKKS will reach in
33 // and inject the new providers, possibly before the operation runs.
34 @
property (atomic
) NSArray
<id
<CKKSPeerProvider
>>* peerProviders
;
36 // Filled in after creation item creation
37 @
property (nullable
) TPSyncingPolicy
* syncingPolicy
;
39 // This is weak as, currently, the databaseProvider owns the CKKSOperationDependencies.
40 @
property (readonly
,weak
) id
<CKKSDatabaseProviderProtocol
> databaseProvider
;
42 @property CKKSZoneModifier
* zoneModifier
;
44 @
property (readonly
) CKKSNearFutureScheduler
* notifyViewChangedScheduler
;
45 @
property (readonly
) CKKSNearFutureScheduler
* savedTLKNotifier
;
47 // This might contain some key set provider operations. if you're an operation that knows about keysets, feel free to provide them.
48 @property NSHashTable
<CKKSResultOperation
<CKKSKeySetProviderOperationProtocol
>*>* keysetProviderOperations
;
50 - (instancetype
)initWithZoneID
:(CKRecordZoneID
*)zoneID
51 zoneModifier
:(CKKSZoneModifier
*)zoneModifier
52 ckoperationGroup
:(CKOperationGroup
* _Nullable
)operationGroup
53 flagHandler
:(id
<OctagonStateFlagHandler
>)flagHandler
54 launchSequence
:(CKKSLaunchSequence
*)launchSequence
55 lockStateTracker
:(CKKSLockStateTracker
*)lockStateTracker
56 reachabilityTracker
:(CKKSReachabilityTracker
*)reachabilityTracker
57 peerProviders
:(NSArray
<id
<CKKSPeerProvider
>>*)peerProviders
58 databaseProvider
:(id
<CKKSDatabaseProviderProtocol
>)databaseProvider
59 notifyViewChangedScheduler
:(CKKSNearFutureScheduler
*)notifyViewChangedScheduler
60 savedTLKNotifier
:(CKKSNearFutureScheduler
*)savedTLKNotifier
;
62 // Convenience method to fetch the trust states from all peer providers
63 // Do not call this while on the SQL transaction queue!
64 - (NSArray
<CKKSPeerProviderState
*>*)currentTrustStates
;
66 - (void)provideKeySet
:(CKKSCurrentKeySet
*)keyset
;