]> git.saurik.com Git - apple/security.git/blob - keychain/ot/OTManager.h
Security-59306.41.2.tar.gz
[apple/security.git] / keychain / ot / OTManager.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
25 #import <Foundation/Foundation.h>
26
27 #if OCTAGON
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
42
43 @class OTContext;
44 @class OTCuttlefishContext;
45 @class OTClientStateMachine;
46 @class CKKSLockStateTracker;
47 @class CKKSAccountStateTracker;
48
49 @interface OTManager : NSObject <OTControlProtocol>
50
51 @property (nonatomic, readonly) CKKSLockStateTracker* lockStateTracker;
52 @property id<CKKSCloudKitAccountStateTrackingProvider> accountStateTracker;
53
54 - (instancetype)init NS_UNAVAILABLE;
55
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;
66
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;
71
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;
75
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;
83
84 - (OTCuttlefishContext*)contextForContainerName:(NSString* _Nullable)containerName
85 contextID:(NSString*)contextID;
86
87 - (void)removeContextForContainerName:(NSString*)containerName
88 contextID:(NSString*)contextID;
89
90 - (OTClientStateMachine*)clientStateMachineForContainerName:(NSString* _Nullable)containerName
91 contextID:(NSString*)contextID
92 clientName:(NSString*)clientName;
93
94 -(BOOL)ghostbustByMidEnabled;
95 -(BOOL)ghostbustBySerialEnabled;
96 -(BOOL)ghostbustByAgeEnabled;
97
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;
104
105 - (void)createRecoveryKey:(NSString* _Nullable)containerName
106 contextID:(NSString *)contextID
107 recoveryKey:(NSString *)recoveryKey
108 reply:(void (^)( NSError * _Nullable))reply;
109
110 - (void)joinWithRecoveryKey:(NSString* _Nullable)containerName
111 contextID:(NSString *)contextID
112 recoveryKey:(NSString*)recoveryKey
113 reply:(void (^)(NSError * _Nullable))reply;
114
115 - (void)allContextsHalt;
116 - (void)allContextsDisablePendingFlags;
117 - (bool)allContextsPause:(uint64_t)within;
118
119 - (void)waitForOctagonUpgrade:(NSString* _Nullable)container
120 context:(NSString*)context
121 reply:(void (^)(NSError* _Nullable error))reply;
122
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;
130
131 //test only
132 - (void)setSOSEnabledForPlatformFlag:(bool) value;
133 @end
134 NS_ASSUME_NONNULL_END
135
136 #endif // OCTAGON
137