#import <Foundation/Foundation.h>
#import <dispatch/queue.h>
#import <xpc/xpc.h>
#import <IDS/IDS.h>
#import "SOSCloudKeychainClient.h"
#import <utilities/debugging.h>
typedef enum {
kIDSStartPingTestMessage = 1,
kIDSEndPingTestMessage= 2,
kIDSSendOneMessage = 3,
kIDSPeerReceivedACK = 4,
kIDSPeerAvailability = 6,
kIDSPeerAvailabilityDone = 7,
kIDSKeychainSyncIDSFragmentation = 8,
} idsOperation;
typedef enum {
kSecIDSErrorNoDeviceID = -1, kSecIDSErrorNotRegistered = -2,
kSecIDSErrorFailedToSend=-3,
kSecIDSErrorCouldNotFindMatchingAuthToken = -4,
kSecIDSErrorDeviceIsLocked = -5,
kSecIDSErrorNoPeersAvailable = -6
} idsError;
@interface KeychainSyncingOverIDSProxy : NSObject <IDSServiceDelegate>
{
IDSService *_service;
NSString *deviceID;
NSMutableDictionary *deviceIDFromAuthToken;
}
@property (retain, nonatomic) NSMutableDictionary *deviceIDFromAuthToken;
@property (retain, nonatomic) NSString *deviceID;
@property (retain, nonatomic) NSMutableDictionary *unhandledMessageBuffer;
@property (retain, nonatomic) NSMutableDictionary *shadowPendingMessages;
@property (retain, nonatomic) NSMutableDictionary *allFragmentedMessages;
@property (retain, nonatomic) NSMutableDictionary *pingTimers;
@property (retain, nonatomic) NSMutableDictionary *messagesInFlight;
@property (retain, nonatomic) NSMutableDictionary *peerNextSendCache;
@property (retain, nonatomic) NSArray* listOfDevices;
@property (atomic) dispatch_source_t penaltyTimer;
@property (atomic) bool penaltyTimerScheduled;
@property (retain, atomic) NSMutableDictionary *monitor;
@property (retain, atomic) NSDictionary *queuedMessages;
@property (atomic) bool isIDSInitDone;
@property (atomic) bool shadowDoInitializeIDSService;
@property (atomic) bool isSecDRunningAsRoot;
@property (atomic) bool doesSecDHavePeer;
@property (atomic) dispatch_queue_t calloutQueue;
@property (atomic) bool isLocked;
@property (atomic) bool unlockedSinceBoot;
@property (atomic) dispatch_source_t retryTimer;
@property (atomic) bool retryTimerScheduled;
@property (atomic) bool inCallout;
@property (atomic) bool setIDSDeviceID;
@property (atomic) bool shadowDoSetIDSDeviceID;
@property (atomic) bool handleAllPendingMessages;
@property (atomic) bool shadowHandleAllPendingMessages;
@property (atomic) bool sendRestoredMessages;
+ (KeychainSyncingOverIDSProxy *) idsProxy;
- (id)init;
- (void) importIDSState: (NSMutableDictionary*) state;
- (void) doSetIDSDeviceID;
- (void) doIDSInitialization;
- (void) calloutWith: (void(^)(NSMutableDictionary *pending, bool handlePendingMesssages, bool doSetDeviceID, dispatch_queue_t queue, void(^done)(NSMutableDictionary *handledMessages, bool handledPendingMessage, bool handledSettingDeviceID))) callout;
- (void) sendKeysCallout: (NSMutableDictionary *(^)(NSMutableDictionary* pending, NSError** error)) handleMessages;
- (void)persistState;
- (void) sendPersistedMessagesAgain;
- (NSDictionary*) retrievePendingMessages;
- (void)scheduleRetryRequestTimer;
@end
NSString* createErrorString(NSString* format, ...);