#import <Foundation/Foundation.h>
#if OCTAGON
#import "Analytics/SFAnalytics.h"
extern NSString* const CKKSAnalyticsInCircle;
extern NSString* const CKKSAnalyticsHasTLKs;
extern NSString* const CKKSAnalyticsSyncedClassARecently;
extern NSString* const CKKSAnalyticsSyncedClassCRecently;
extern NSString* const CKKSAnalyticsIncomingQueueIsErrorFree;
extern NSString* const CKKSAnalyticsOutgoingQueueIsErrorFree;
extern NSString* const CKKSAnalyticsInSync;
extern NSString* const CKKSAnalyticsValidCredentials;
extern NSString* const CKKSAnalyticsLastUnlock;
extern NSString* const CKKSAnalyticsLastKeystateReady;
extern NSString* const CKKSAnalyticsLastInCircle;
extern NSString* const OctagonAnalyticsStateMachineState;
extern NSString* const OctagonAnalyticIcloudAccountState;
extern NSString* const OctagonAnalyticCDPBitStatus;
extern NSString* const OctagonAnalyticsTrustState;
extern NSString* const OctagonAnalyticsAttemptedJoin;
extern NSString* const OctagonAnalyticsLastHealthCheck;
extern NSString* const OctagonAnalyticsSOSStatus;
extern NSString* const OctagonAnalyticsDateOfLastPreflightPreapprovedJoin;
extern NSString* const OctagonAnalyticsLastKeystateReady;
extern NSString* const OctagonAnalyticsLastCoreFollowup;
extern NSString* const OctagonAnalyticsCoreFollowupFailureCount;
extern NSString* const OctagonAnalyticsCoreFollowupLastFailureTime;
extern NSString* const OctagonAnalyticsPrerecordPending;
extern NSString* const OctagonAnalyticsCDPStateRun;
extern NSString* const OctagonAnalyticsHaveMachineID;
extern NSString* const OctagonAnalyticsMIDOnMemoizedList;
extern NSString* const OctagonAnalyticsPeersWithMID;
extern NSString* const CKKSAnalyticsLastCKKSPush;
extern NSString* const CKKSAnalyticsLastOctagonPush;
extern NSString* const OctagonAnalyticsKVSProvisioned;
extern NSString* const OctagonAnalyticsKVSEnabled;
extern NSString* const OctagonAnalyticsKeychainSyncProvisioned;
extern NSString* const OctagonAnalyticsKeychainSyncEnabled;
extern NSString* const OctagonAnalyticsCloudKitProvisioned;
extern NSString* const OctagonAnalyticsCloudKitEnabled;
extern NSString* const OctagonAnalyticsBottledUniqueTLKsRecovered;
extern NSString* const OctagonAnalyticsBottledTotalTLKShares;
extern NSString* const OctagonAnalyticsBottledTotalTLKSharesRecovered;
extern NSString* const OctagonAnalyticsBottledUniqueTLKsWithSharesCount;
extern NSString* const OctagonAnalyticsBottledTLKUniqueViewCount;
@class CKKSKeychainView;
@protocol CKKSAnalyticsFailableEvent <NSObject>
@end
typedef NSString<CKKSAnalyticsFailableEvent> CKKSAnalyticsFailableEvent;
extern CKKSAnalyticsFailableEvent* const CKKSEventProcessIncomingQueueClassA;
extern CKKSAnalyticsFailableEvent* const CKKSEventProcessIncomingQueueClassC;
extern CKKSAnalyticsFailableEvent* const CKKSEventProcessOutgoingQueue;
extern CKKSAnalyticsFailableEvent* const CKKSEventUploadChanges;
extern CKKSAnalyticsFailableEvent* const CKKSEventStateError;
extern CKKSAnalyticsFailableEvent* const CKKSEventProcessHealKeyHierarchy;
extern CKKSAnalyticsFailableEvent* const CKKSEventProcessReencryption;
extern CKKSAnalyticsFailableEvent* const OctagonEventPreflightBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventLaunchBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventScrubBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventSignIn;
extern CKKSAnalyticsFailableEvent* const OctagonEventSignOut;
extern CKKSAnalyticsFailableEvent* const OctagonEventRestoreBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventRamp;
extern CKKSAnalyticsFailableEvent* const OctagonEventBottleCheck;
extern CKKSAnalyticsFailableEvent* const OctagonEventCoreFollowUp;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpdateBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventRecoverBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventFetchAllBottles;
extern CKKSAnalyticsFailableEvent* const OctagonEventFetchEscrowContents;
extern CKKSAnalyticsFailableEvent* const OctagonEventRestoredSignedBottlePeer;
extern CKKSAnalyticsFailableEvent* const OctagonEventRestoredOctagonPeerEncryptionKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventRestoredOctagonPeerSigningKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventRestoreComplete;
extern CKKSAnalyticsFailableEvent* const OctagonEventCheckTrustState;
extern CKKSAnalyticsFailableEvent* const OctagonEventBottledPeerRestore;
extern CKKSAnalyticsFailableEvent* const OctagonEventFetchEscrowContents;
extern CKKSAnalyticsFailableEvent* const OctagonEventResetAndEstablish;
extern CKKSAnalyticsFailableEvent* const OctagonEventEstablish;
extern CKKSAnalyticsFailableEvent* const OctagonEventLeaveClique;
extern CKKSAnalyticsFailableEvent* const OctagonEventRemoveFriendsInClique;
extern CKKSAnalyticsFailableEvent* const OctagonEventRecoveryKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradeFetchDeviceIDs;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradeSetAllowList;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradeSilentEscrow;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradePreapprovedJoin;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradePreflightPreapprovedJoin;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradePrepare;
extern CKKSAnalyticsFailableEvent* const OctagonEventUpgradePreapprovedJoinAfterPairing;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinWithVoucher;
extern CKKSAnalyticsFailableEvent* const OctagonEventPreflightVouchWithBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventVoucherWithBottle;
extern CKKSAnalyticsFailableEvent* const OctagonEventPreflightVouchWithRecoveryKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventVoucherWithRecoveryKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinRecoveryKeyValidationFailed;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinRecoveryKeyFailed;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinRecoveryKeyCircleReset;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinRecoveryKeyCircleResetFailed;
extern CKKSAnalyticsFailableEvent* const OctagonEventJoinRecoveryKeyEnrollFailed;
extern CKKSAnalyticsFailableEvent* const OctagonEventSetRecoveryKey;
extern CKKSAnalyticsFailableEvent* const OctagonEventSetRecoveryKeyValidationFailed;
extern CKKSAnalyticsFailableEvent* const OctagonEventReset;
extern CKKSAnalyticsFailableEvent* const OctagonEventPrepareIdentity;
extern CKKSAnalyticsFailableEvent* const OctagonEventEstablishIdentity;
extern CKKSAnalyticsFailableEvent* const OctagonEventFetchViews;
extern CKKSAnalyticsFailableEvent* const OctagonEventStateTransition;
extern CKKSAnalyticsFailableEvent* const OctagonEventCheckTrustForCFU;
extern CKKSAnalyticsFailableEvent* const OctagonEventCompanionPairing;
extern CKKSAnalyticsFailableEvent* const OctagonEventTPHHealthCheckStatus;
extern CKKSAnalyticsFailableEvent* const OctagonEventAuthKitDeviceList;
@protocol CKKSAnalyticsSignpostEvent <NSObject>
@end
typedef NSString<CKKSAnalyticsSignpostEvent> CKKSAnalyticsSignpostEvent;
extern CKKSAnalyticsSignpostEvent* const CKKSEventPushNotificationReceived;
extern CKKSAnalyticsSignpostEvent* const CKKSEventItemAddedToOutgoingQueue;
extern CKKSAnalyticsSignpostEvent* const CKKSEventReachabilityTimerExpired;
extern CKKSAnalyticsSignpostEvent* const CKKSEventMissingLocalItemsFound;
@protocol CKKSAnalyticsActivity <NSObject>
@end
typedef NSString<CKKSAnalyticsActivity> CKKSAnalyticsActivity;
extern CKKSAnalyticsActivity* const CKKSActivityOTFetchRampState;
extern CKKSAnalyticsActivity* const CKKSActivityOctagonPreflightBottle;
extern CKKSAnalyticsActivity* const CKKSActivityOctagonLaunchBottle;
extern CKKSAnalyticsActivity* const CKKSActivityOctagonRestore;
extern CKKSAnalyticsActivity* const CKKSActivityScrubBottle;
extern CKKSAnalyticsActivity* const CKKSActivityBottleCheck;
extern CKKSAnalyticsActivity* const CKKSActivityOctagonUpdateBottle;
extern CKKSAnalyticsActivity* const OctagonActivityAccountAvailable;
extern CKKSAnalyticsActivity* const OctagonActivityAccountNotAvailable;
extern CKKSAnalyticsActivity* const OctagonActivityResetAndEstablish;
extern CKKSAnalyticsActivity* const OctagonActivityEstablish;
extern CKKSAnalyticsActivity* const OctagonActivityFetchAllViableBottles;
extern CKKSAnalyticsActivity* const OctagonActivityFetchEscrowContents;
extern CKKSAnalyticsActivity* const OctagonActivityBottledPeerRestore;
extern CKKSAnalyticsActivity* const OctagonActivitySetRecoveryKey;
extern CKKSAnalyticsActivity* const OctagonActivityLeaveClique;
extern CKKSAnalyticsActivity* const OctagonActivityRemoveFriendsInClique;
extern CKKSAnalyticsActivity* const OctagonActivityJoinWithRecoveryKey;
extern CKKSAnalyticsActivity* const OctagonSOSAdapterUpdateKeys;
@interface CKKSAnalytics : SFAnalytics
+ (instancetype)logger;
- (void)logSuccessForEvent:(CKKSAnalyticsFailableEvent*)event inView:(CKKSKeychainView*)view;
- (void)logRecoverableError:(NSError*)error
forEvent:(CKKSAnalyticsFailableEvent*)event
inView:(CKKSKeychainView*)view
withAttributes:(NSDictionary*)attributes;
- (void)logRecoverableError:(NSError*)error
forEvent:(CKKSAnalyticsFailableEvent*)event
zoneName:(NSString*)zoneName
withAttributes:(NSDictionary *)attributes;
- (void)logRecoverableError:(NSError*)error
forEvent:(CKKSAnalyticsFailableEvent*)event
withAttributes:(NSDictionary *)attributes;
- (void)logUnrecoverableError:(NSError*)error
forEvent:(CKKSAnalyticsFailableEvent*)event
withAttributes:(NSDictionary *)attributes;
- (void)logUnrecoverableError:(NSError*)error
forEvent:(CKKSAnalyticsFailableEvent*)event
inView:(CKKSKeychainView*)view
withAttributes:(NSDictionary*)attributes;
- (void)noteEvent:(CKKSAnalyticsSignpostEvent*)event;
- (void)noteEvent:(CKKSAnalyticsSignpostEvent*)event inView:(CKKSKeychainView*)view;
- (void)setDateProperty:(NSDate*)date forKey:(NSString*)key inView:(CKKSKeychainView *)view;
- (NSDate *)datePropertyForKey:(NSString *)key inView:(CKKSKeychainView *)view;
@end
@interface CKKSAnalytics (UnitTesting)
- (NSDate*)dateOfLastSuccessForEvent:(CKKSAnalyticsFailableEvent*)event
inView:(CKKSKeychainView*)view;
- (NSDictionary *)errorChain:(NSError *)error
depth:(NSUInteger)depth;
- (NSDictionary *)createErrorAttributes:(NSError *)error
depth:(NSUInteger)depth
attributes:(NSDictionary *)attributes;
@end
#endif