4 #import "utilities/debugging.h"
6 #import "keychain/ot/OTLocalCKKSResetOperation.h"
7 #import "keychain/ckks/CloudKitCategories.h"
8 #import "keychain/ckks/CKKSKeychainView.h"
9 #import "keychain/ckks/CKKSViewManager.h"
11 #import "keychain/TrustedPeersHelper/TrustedPeersHelperProtocol.h"
12 #import "keychain/ot/ObjCImprovements.h"
14 @interface OTLocalCKKSResetOperation ()
15 @property OTOperationDependencies* operationDependencies;
17 @property NSOperation* finishedOp;
20 @implementation OTLocalCKKSResetOperation
21 @synthesize nextState = _nextState;
22 @synthesize intendedState = _intendedState;
24 - (instancetype)initWithDependencies:(OTOperationDependencies*)dependencies
25 intendedState:(OctagonState*)intendedState
26 errorState:(OctagonState*)errorState
28 if((self = [super init])) {
29 _operationDependencies = dependencies;
31 _intendedState = intendedState;
32 _nextState = errorState;
39 secnotice("octagon-ckks", "Beginning an 'reset CKKS' operation");
43 self.finishedOp = [NSBlockOperation blockOperationWithBlock:^{
45 secnotice("octagon-ckks", "Finishing a ckks-local-reset operation with %@", self.error ?: @"no error");
47 [self dependOnBeforeGroupFinished:self.finishedOp];
49 [self.operationDependencies.viewManager rpcResetLocal:nil reply: ^(NSError* _Nullable resultError) {
52 secnotice("octagon-ckks", "Finished ckks-local-reset with %@", self.error ?: @"no error");
54 if(resultError == nil) {
55 self.nextState = self.intendedState;
57 self.error = resultError;
59 [self runBeforeGroupFinished:self.finishedOp];