]> git.saurik.com Git - apple/security.git/blame - keychain/ot/OTControlProtocol.h
Security-59754.80.3.tar.gz
[apple/security.git] / keychain / ot / OTControlProtocol.h
CommitLineData
ecaf5866
A
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
24#import <Foundation/Foundation.h>
79b9da22 25
b54c578e
A
26#ifndef SECURITY_OT_OTCONTROLPROTOCOL_H
27#define SECURITY_OT_OTCONTROLPROTOCOL_H 1
28
29#import <Security/OTClique.h>
7fb2cbd2 30#import <Security/OTConstants.h>
79b9da22
A
31@class SFECKeyPair;
32
b54c578e
A
33NS_ASSUME_NONNULL_BEGIN
34
35@class OTJoiningConfiguration;
36
b54c578e 37@protocol OTControlProtocol
ecaf5866 38- (void)restore:(NSString *)contextID dsid:(NSString *)dsid secret:(NSData*)secret escrowRecordID:(NSString*)escrowRecordID reply:(void (^)(NSData* _Nullable signingKeyData, NSData* _Nullable encryptionKeyData, NSError * _Nullable error))reply;
b54c578e
A
39- (void)octagonEncryptionPublicKey:(void (^)(NSData* _Nullable encryptionKey, NSError * _Nullable))reply;
40- (void)octagonSigningPublicKey:(void (^)(NSData* _Nullable signingKey, NSError * _Nullable))reply;
41- (void)listOfEligibleBottledPeerRecords:(void (^)(NSArray* _Nullable listOfRecords, NSError * _Nullable))reply;
42
43// If you're not sure about container, pass nil. If you're not sure about context, pass OTDefaultContext.
44- (void)signIn:(NSString*)altDSID
45 container:(NSString* _Nullable)container
46 context:(NSString*)contextID
47 reply:(void (^)(NSError * _Nullable error))reply;
48
49- (void)signOut:(NSString* _Nullable)container
50 context:(NSString*)contextID
51 reply:(void (^)(NSError * _Nullable error))reply;
52
53- (void)notifyIDMSTrustLevelChangeForContainer:(NSString* _Nullable)container
54 context:(NSString*)contextID
55 reply:(void (^)(NSError * _Nullable error))reply;
56
ecaf5866 57- (void)reset:(void (^)(BOOL result, NSError * _Nullable error))reply;
b54c578e
A
58
59- (void)handleIdentityChangeForSigningKey:(SFECKeyPair*)peerSigningKey
60 ForEncryptionKey:(SFECKeyPair*)encryptionKey
61 ForPeerID:(NSString*)peerID
62 reply:(void (^)(BOOL result,
63 NSError* _Nullable error))reply;
64
65- (void)rpcEpochWithConfiguration:(OTJoiningConfiguration*)config
66 reply:(void (^)(uint64_t epoch,
67 NSError * _Nullable error))reply;
68
69- (void)rpcPrepareIdentityAsApplicantWithConfiguration:(OTJoiningConfiguration*)config
70 reply:(void (^)(NSString * _Nullable peerID,
71 NSData * _Nullable permanentInfo,
72 NSData * _Nullable permanentInfoSig,
73 NSData * _Nullable stableInfo,
74 NSData * _Nullable stableInfoSig,
75 NSError * _Nullable error))reply;
76- (void)rpcVoucherWithConfiguration:(OTJoiningConfiguration*)config
77 peerID:(NSString*)peerID
78 permanentInfo:(NSData *)permanentInfo
79 permanentInfoSig:(NSData *)permanentInfoSig
80 stableInfo:(NSData *)stableInfo
81 stableInfoSig:(NSData *)stableInfoSig
82 reply:(void (^)(NSData* voucher, NSData* voucherSig, NSError * _Nullable error))reply;
83
84- (void)rpcJoinWithConfiguration:(OTJoiningConfiguration*)config
85 vouchData:(NSData*)vouchData
86 vouchSig:(NSData*)vouchSig
b54c578e 87 reply:(void (^)(NSError * _Nullable error))reply;
ecaf5866
A
88
89- (void)preflightBottledPeer:(NSString*)contextID
90 dsid:(NSString*)dsid
91 reply:(void (^)(NSData* _Nullable entropy,
92 NSString* _Nullable bottleID,
93 NSData* _Nullable signingPublicKey,
94 NSError* _Nullable error))reply;
95- (void)launchBottledPeer:(NSString*)contextID
96 bottleID:(NSString*)bottleID
97 reply:(void (^ _Nullable)(NSError* _Nullable error))reply;
98- (void)scrubBottledPeer:(NSString*)contextID
99 bottleID:(NSString*)bottleID
100 reply:(void (^ _Nullable)(NSError* _Nullable error))reply;
b54c578e
A
101
102- (void)status:(NSString* _Nullable)container
103 context:(NSString*)context
104 reply:(void (^)(NSDictionary* _Nullable result, NSError* _Nullable error))reply;
105
106- (void)fetchEgoPeerID:(NSString* _Nullable)container
107 context:(NSString*)context
108 reply:(void (^)(NSString* _Nullable peerID, NSError* _Nullable error))reply;
109
110- (void)fetchCliqueStatus:(NSString* _Nullable)container
111 context:(NSString*)context
112 configuration:(OTOperationConfiguration*)configuration
113 reply:(void (^)(CliqueStatus cliqueStatus, NSError* _Nullable error))reply;
114
115- (void)fetchTrustStatus:(NSString* _Nullable)container
116 context:(NSString*)context
117 configuration:(OTOperationConfiguration *)configuration
118 reply:(void (^)(CliqueStatus status,
119 NSString* _Nullable peerID,
120 NSNumber* _Nullable numberOfPeersInOctagon,
121 BOOL isExcluded,
122 NSError* _Nullable error))reply;
123
124// Likely won't be used once Octagon is turned on for good
125- (void)startOctagonStateMachine:(NSString* _Nullable)container
126 context:(NSString*)context
127 reply:(void (^)(NSError* _Nullable error))reply;
128
129- (void)resetAndEstablish:(NSString* _Nullable)container
130 context:(NSString*)context
131 altDSID:(NSString*)altDSID
7fb2cbd2 132 resetReason:(CuttlefishResetReason)resetReason
b54c578e
A
133 reply:(void (^)(NSError* _Nullable error))reply;
134
135- (void)establish:(NSString * _Nullable)container
136 context:(NSString *)context
137 altDSID:(NSString*)altDSID
138 reply:(void (^)(NSError * _Nullable))reply;
139
140- (void)leaveClique:(NSString* _Nullable)container
141 context:(NSString*)context
142 reply:(void (^)(NSError* _Nullable error))reply;
143
144- (void)removeFriendsInClique:(NSString* _Nullable)container
145 context:(NSString*)context
146 peerIDs:(NSArray<NSString*>*)peerIDs
147 reply:(void (^)(NSError* _Nullable error))reply;
148
149- (void)peerDeviceNamesByPeerID:(NSString* _Nullable)container
150 context:(NSString*)context
151 reply:(void (^)(NSDictionary<NSString*, NSString*>* _Nullable peers, NSError* _Nullable error))reply;
152
153- (void)fetchAllViableBottles:(NSString* _Nullable)container
154 context:(NSString*)context
155 reply:(void (^)(NSArray<NSString*>* _Nullable sortedBottleIDs, NSArray<NSString*> * _Nullable sortedPartialBottleIDs, NSError* _Nullable error))reply;
156
157-(void)restore:(NSString* _Nullable)containerName
158 contextID:(NSString *)contextID
159 bottleSalt:(NSString *)bottleSalt
160 entropy:(NSData *)entropy
161 bottleID:(NSString *)bottleID
162 reply:(void (^)(NSError * _Nullable))reply;
163
164- (void)fetchEscrowContents:(NSString* _Nullable)containerName
165 contextID:(NSString *)contextID
166 reply:(void (^)(NSData* _Nullable entropy,
167 NSString* _Nullable bottleID,
168 NSData* _Nullable signingPublicKey,
169 NSError* _Nullable error))reply;
170
171- (void) createRecoveryKey:(NSString* _Nullable)containerName
172 contextID:(NSString *)contextID
173 recoveryKey:(NSString *)recoveryKey
174 reply:(void (^)( NSError * _Nullable))reply;
175
176- (void) joinWithRecoveryKey:(NSString* _Nullable)containerName
177 contextID:(NSString *)contextID
178 recoveryKey:(NSString*)recoveryKey
179 reply:(void (^)(NSError * _Nullable))reply;
180
181- (void)healthCheck:(NSString * _Nullable)container
182 context:(NSString *)context
183skipRateLimitingCheck:(BOOL)skipRateLimitingCheck
184 reply:(void (^)(NSError *_Nullable error))reply;
185
b54c578e
A
186- (void)waitForOctagonUpgrade:(NSString* _Nullable)container
187 context:(NSString*)context
188 reply:(void (^)(NSError* _Nullable error))reply;
189
190- (void)postCDPFollowupResult:(BOOL)success
191 type:(OTCliqueCDPContextType)type
192 error:(NSError * _Nullable)error
193 containerName:(NSString* _Nullable)containerName
194 contextName:(NSString *)contextName
195 reply:(void (^)(NSError* _Nullable error))reply;
196
197- (void)tapToRadar:(NSString *)action
198 description:(NSString *)description
199 radar:(NSString *)radar
200 reply:(void (^)(NSError* _Nullable error))reply;
201
b3971512
A
202- (void)refetchCKKSPolicy:(NSString* _Nullable)container
203 contextID:(NSString*)contextID
204 reply:(void (^)(NSError* _Nullable error))reply;
205
206- (void)setCDPEnabled:(NSString* _Nullable)containerName
207 contextID:(NSString*)contextID
208 reply:(void (^)(NSError* _Nullable error))reply;
209
210- (void)getCDPStatus:(NSString* _Nullable)containerName
211 contextID:(NSString*)contextID
212 reply:(void (^)(OTCDPStatus status, NSError* _Nullable error))reply;
213
d64be36e
A
214- (void)fetchEscrowRecords:(NSString * _Nullable)container
215 contextID:(NSString*)contextID
216 forceFetch:(BOOL)forceFetch
217 reply:(void (^)(NSArray<NSData*>* _Nullable records,
218 NSError* _Nullable error))reply;
219
220- (void)invalidateEscrowCache:(NSString * _Nullable)containerName
221 contextID:(NSString*)contextID
222 reply:(nonnull void (^)(NSError * _Nullable error))reply;
223
224/* View Handling */
225- (void)setUserControllableViewsSyncStatus:(NSString* _Nullable)containerName
226 contextID:(NSString*)contextID
227 enabled:(BOOL)enabled
228 reply:(void (^)(BOOL nowSyncing, NSError* _Nullable error))reply;
229
230- (void)fetchUserControllableViewsSyncStatus:(NSString* _Nullable)containerName
231 contextID:(NSString*)contextID
232 reply:(void (^)(BOOL nowSyncing, NSError* _Nullable error))reply;
ecaf5866
A
233@end
234
235NSXPCInterface* OTSetupControlProtocol(NSXPCInterface* interface);
236
237NS_ASSUME_NONNULL_END
b54c578e
A
238
239#endif /* SECURITY_OT_OTCONTROLPROTOCOL_H */