1 #import <KeychainCircle/KeychainCircle.h>
3 #if !TARGET_OS_SIMULATOR
4 #import <MobileKeyBag/MobileKeyBag.h>
5 #endif /* !TARGET_OS_SIMULATOR */
7 #import "OTPairingSession.h"
9 @interface OTPairingSession ()
10 @property (readwrite) NSString *identifier;
11 @property (readwrite) KCPairingChannel *channel;
14 @implementation OTPairingSession
16 - (instancetype)initWithDeviceInfo:(OTDeviceInformationActualAdapter *)deviceInfo
18 return [self initWithDeviceInfo:deviceInfo identifier:[[NSUUID UUID] UUIDString]];
21 - (instancetype)initWithDeviceInfo:(OTDeviceInformationActualAdapter *)deviceInfo identifier:(NSString *)identifier
23 KCPairingChannelContext *channelContext = nil;
27 self.identifier = identifier;
29 channelContext = [KCPairingChannelContext new];
30 channelContext.uniqueClientID = [NSUUID UUID].UUIDString;
31 channelContext.uniqueDeviceID = [NSUUID UUID].UUIDString;
32 channelContext.intent = KCPairingIntent_Type_SilentRepair;
33 channelContext.model = deviceInfo.modelID;
34 channelContext.osVersion = deviceInfo.osVersion;
37 self.channel = [KCPairingChannel pairingChannelInitiator:channelContext];
39 self.channel = [KCPairingChannel pairingChannelAcceptor:channelContext];
47 #if !TARGET_OS_SIMULATOR
48 if (self.lockAssertion) {
49 CFRelease(self.lockAssertion);
50 self.lockAssertion = NULL;
52 #endif /* !TARGET_OS_SIMULATOR */