2 * Copyright (c) 2016 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
25 #import <Foundation/Foundation.h>
28 #import "Analytics/SFAnalytics.h"
29 #import "keychain/ot/OTManager.h"
30 #import "keychain/ot/OTRamping.h"
31 #import "keychain/ot/OTFollowup.h"
32 #import "keychain/ot/OTControlProtocol.h"
33 #import "keychain/ot/OTSOSAdapter.h"
34 #import "keychain/ot/OTAuthKitAdapter.h"
35 #import "keychain/ot/OTDeviceInformationAdapter.h"
36 #import "keychain/ot/OTCuttlefishAccountStateHolder.h"
37 #import "keychain/escrowrequest/Framework/SecEscrowRequest.h"
38 #import "keychain/ckks/CKKSAccountStateTracker.h"
39 #include "keychain/securityd/SecDbItem.h"
40 #import <CoreCDP/CDPAccount.h>
41 NS_ASSUME_NONNULL_BEGIN
44 @
class OTCuttlefishContext
;
45 @
class OTClientStateMachine
;
46 @
class CKKSLockStateTracker
;
47 @
class CKKSAccountStateTracker
;
49 @interface OTManager
: NSObject
<OTControlProtocol
>
51 @
property (nonatomic
, readonly
) CKKSLockStateTracker
* lockStateTracker
;
52 @property id
<CKKSCloudKitAccountStateTrackingProvider
> accountStateTracker
;
54 - (instancetype
)init NS_UNAVAILABLE
;
56 - (instancetype
)initWithSOSAdapter
:(id
<OTSOSAdapter
>)sosAdapter
57 authKitAdapter
:(id
<OTAuthKitAdapter
>)authKitAdapter
58 deviceInformationAdapter
:(id
<OTDeviceInformationAdapter
>)deviceInformationAdapter
59 apsConnectionClass
:(Class
<OctagonAPSConnection
>)apsConnectionClass
60 escrowRequestClass
:(Class
<SecEscrowRequestable
>)escrowRequestClass
61 loggerClass
:(Class
<SFAnalyticsProtocol
> _Nullable
)loggerClass
62 lockStateTracker
:(CKKSLockStateTracker
* _Nullable
)lockStateTracker
63 accountStateTracker
:(id
<CKKSCloudKitAccountStateTrackingProvider
>)accountStateTracker
64 cuttlefishXPCConnection
:(id
<NSXPCProxyCreating
> _Nullable
)cuttlefishXPCConnection
65 cdpd
:(id
<OctagonFollowUpControllerProtocol
>)cdpd
;
67 // Call this to start up the state machinery
68 - (void)initializeOctagon
;
69 - (BOOL
)waitForReady
:(NSString
* _Nullable
)containerName context
:(NSString
*)context wait
:(int64_t)wait
;
70 - (void)moveToCheckTrustedStateForContainer
:(NSString
* _Nullable
)containerName context
:(NSString
*)context
;
72 + (instancetype _Nullable
)manager
;
73 + (instancetype _Nullable
)resetManager
:(bool)reset to
:(OTManager
* _Nullable
)obj
;
74 - (void)xpc24HrNotification
:(NSString
* _Nullable
)containerName context
:(NSString
*)context skipRateLimitingCheck
:(BOOL
)skipRateLimitingCheck reply
:(void (^)(NSError
*error
))reply
;
76 - (OTCuttlefishContext
*)contextForContainerName
:(NSString
* _Nullable
)containerName
77 contextID
:(NSString
*)contextID
78 sosAdapter
:(id
<OTSOSAdapter
>)sosAdapter
79 authKitAdapter
:(id
<OTAuthKitAdapter
>)authKitAdapter
80 lockStateTracker
:(CKKSLockStateTracker
*)lockStateTracker
81 accountStateTracker
:(id
<CKKSCloudKitAccountStateTrackingProvider
>)accountStateTracker
82 deviceInformationAdapter
:(id
<OTDeviceInformationAdapter
>)deviceInformationAdapter
;
84 - (OTCuttlefishContext
*)contextForContainerName
:(NSString
* _Nullable
)containerName
85 contextID
:(NSString
*)contextID
;
87 - (void)removeContextForContainerName
:(NSString
*)containerName
88 contextID
:(NSString
*)contextID
;
90 - (OTClientStateMachine
*)clientStateMachineForContainerName
:(NSString
* _Nullable
)containerName
91 contextID
:(NSString
*)contextID
92 clientName
:(NSString
*)clientName
;
94 -(BOOL
)ghostbustByMidEnabled
;
95 -(BOOL
)ghostbustBySerialEnabled
;
96 -(BOOL
)ghostbustByAgeEnabled
;
98 -(void)restore
:(NSString
* _Nullable
)containerName
99 contextID
:(NSString
*)contextID
100 bottleSalt
:(NSString
*)bottleSalt
101 entropy
:(NSData
*)entropy
102 bottleID
:(NSString
*)bottleID
103 reply
:(void (^)(NSError
* _Nullable
))reply
;
105 - (void)createRecoveryKey
:(NSString
* _Nullable
)containerName
106 contextID
:(NSString
*)contextID
107 recoveryKey
:(NSString
*)recoveryKey
108 reply
:(void (^)( NSError
* _Nullable
))reply
;
110 - (void)joinWithRecoveryKey
:(NSString
* _Nullable
)containerName
111 contextID
:(NSString
*)contextID
112 recoveryKey
:(NSString
*)recoveryKey
113 reply
:(void (^)(NSError
* _Nullable
))reply
;
115 - (void)allContextsHalt
;
116 - (void)allContextsDisablePendingFlags
;
117 - (bool)allContextsPause
:(uint64_t)within
;
119 - (void)waitForOctagonUpgrade
:(NSString
* _Nullable
)container
120 context
:(NSString
*)context
121 reply
:(void (^)(NSError
* _Nullable error
))reply
;
123 // Metrics and analytics
124 - (void)postCDPFollowupResult
:(BOOL
)success
125 type
:(OTCliqueCDPContextType
)type
126 error
:(NSError
* _Nullable
)error
127 containerName
:(NSString
* _Nullable
)containerName
128 contextName
:(NSString
*)contextName
129 reply
:(void (^)(NSError
*error
))reply
;
132 - (void)setSOSEnabledForPlatformFlag
:(bool) value
;
134 NS_ASSUME_NONNULL_END