From eb135b1cf55d052137052c5817146144235db963 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Wed, 16 Aug 2023 10:20:30 -0400 Subject: [PATCH 1/6] add trackVerifiedEncrypted() --- Example/Example.xcodeproj/project.pbxproj | 4 +- Example/Example/AppDelegate.swift | 8 +++- RadarSDK/Include/Radar.h | 22 ++++++++- RadarSDK/Radar.m | 55 +++++++++++++++++++++-- RadarSDK/RadarAPIClient.h | 4 +- RadarSDK/RadarAPIClient.m | 23 ++++++++-- RadarSDK/RadarLocationManager.m | 2 +- RadarSDK/RadarUtils.h | 1 + RadarSDK/RadarUtils.m | 55 ++++++++++++++++++++++- 9 files changed, 159 insertions(+), 15 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 343ba9d80..1a3239cc0 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -340,7 +340,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 9PGY6B643R; + DEVELOPMENT_TEAM = 96GHH65B9D; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", @@ -368,7 +368,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 9PGY6B643R; + DEVELOPMENT_TEAM = 96GHH65B9D; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)", diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index 173c17f02..88c8da34a 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -22,9 +22,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.requestLocationPermissions() // Replace with a valid test publishable key - Radar.initialize(publishableKey: "prj_test_pk_0000000000000000000000000000000000000000") + Radar.initialize(publishableKey: "org_test_pk_5857c63d9c1565175db8b00750808a66a002acb8") Radar.setDelegate(self) + + Radar.trackVerified { status, location, events, user in + + } + /* if UIApplication.shared.applicationState != .background { Radar.getLocation { (status, location, stopped) in print("Location: status = \(Radar.stringForStatus(status)); location = \(String(describing: location))") @@ -159,6 +164,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD print("Log Conversion: status = \(Radar.stringForStatus(status)); event = \(String(describing: event))") } + */ return true } diff --git a/RadarSDK/Include/Radar.h b/RadarSDK/Include/Radar.h index c10f7036d..c56a4548a 100644 --- a/RadarSDK/Include/Radar.h +++ b/RadarSDK/Include/Radar.h @@ -156,7 +156,7 @@ typedef NS_ENUM(NSInteger, RadarAddressVerificationStatus) { }; -#pragma mark - Callback typedefs +#pragma mark - Callbacks /** Called when a location request succeeds, fails, or times out. @@ -185,6 +185,15 @@ typedef void (^_Nullable RadarBeaconCompletionHandler)(RadarStatus status, NSArr */ typedef void (^_Nullable RadarTrackCompletionHandler)(RadarStatus status, CLLocation *_Nullable location, NSArray *_Nullable events, RadarUser *_Nullable user); +/** + Called when an encrypted track request succeeds, fails, or times out. + + Receives the request status and, if successful, a JSON Web Token (JWT) containing an array of the events generated and the user. Decrypt the JWT server-side using your private key. + + @see https://radar.com/documentation/sdk/ios + */ +typedef void (^_Nullable RadarTrackEncryptedCompletionHandler)(RadarStatus status, NSString *_Nullable token); + /** Called when a trip update succeeds, fails, or times out. @@ -441,6 +450,17 @@ typedef void (^_Nonnull RadarLogConversionCompletionHandler)(RadarStatus status, */ + (void)trackVerifiedWithCompletionHandler:(RadarTrackCompletionHandler _Nullable)completionHandler NS_SWIFT_NAME(trackVerified(completionHandler:)); +/** + Tracks the user's location with device integrity information for location verification use cases. Returns a JSON Web Token (JWT). Decrypt the JWT server-side using your private key. + + @warning Note that you must configure SSL pinning before calling this method. + + @param completionHandler An optional completion handler. + + @see https://radar.com/documentation/fraud + */ ++ (void)trackVerifiedEncryptedWithCompletionHandler:(RadarTrackEncryptedCompletionHandler _Nullable)completionHandler NS_SWIFT_NAME(trackVerifiedEncrypted(completionHandler:)); + /** Starts tracking the user's location in the background with configurable tracking options. diff --git a/RadarSDK/Radar.m b/RadarSDK/Radar.m index bea6ffc85..769a53452 100644 --- a/RadarSDK/Radar.m +++ b/RadarSDK/Radar.m @@ -150,7 +150,7 @@ + (void)trackOnceWithDesiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desire replayed:NO beacons:beacons completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, RadarUser *_Nullable user, - NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config) { + NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config, NSString *_Nullable token) { if (status == RadarStatusSuccess) { [[RadarLocationManager sharedInstance] replaceSyncedGeofences:nearbyGeofences]; } @@ -219,7 +219,7 @@ + (void)trackOnceWithLocation:(CLLocation *)location completionHandler:(RadarTra replayed:NO beacons:nil completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, RadarUser *_Nullable user, - NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config) { + NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config, NSString *_Nullable token) { if (completionHandler) { [RadarUtils runOnMainThread:^{ @@ -260,9 +260,10 @@ + (void)trackVerifiedWithCompletionHandler:(RadarTrackCompletionHandler)completi attestationString:attestationString keyId:keyId attestationError:attestationError + encrypted:YES completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, RadarUser *_Nullable user, NSArray *_Nullable nearbyGeofences, - RadarConfig *_Nullable config) { + RadarConfig *_Nullable config, NSString *_Nullable token) { if (completionHandler) { [RadarUtils runOnMainThread:^{ completionHandler(status, location, events, user); @@ -274,6 +275,52 @@ + (void)trackVerifiedWithCompletionHandler:(RadarTrackCompletionHandler)completi }]; } ++ (void)trackVerifiedEncryptedWithCompletionHandler:(RadarTrackEncryptedCompletionHandler)completionHandler { + [[RadarAPIClient sharedInstance] + getConfigForUsage:@"verify" verified:YES + completionHandler:^(RadarStatus status, RadarConfig *_Nullable config) { + [[RadarLocationManager sharedInstance] + getLocationWithDesiredAccuracy:RadarTrackingOptionsDesiredAccuracyHigh + completionHandler:^(RadarStatus status, CLLocation *_Nullable location, BOOL stopped) { + if (status != RadarStatusSuccess) { + if (completionHandler) { + [RadarUtils runOnMainThread:^{ + completionHandler(status, nil); + }]; + } + + return; + } + + [[RadarVerificationManager sharedInstance] + getAttestationWithNonce:config.nonce + completionHandler:^(NSString *_Nullable attestationString, NSString *_Nullable keyId, NSString *_Nullable attestationError) { + [[RadarAPIClient sharedInstance] + trackWithLocation:location + stopped:RadarState.stopped + foreground:[RadarUtils foreground] + source:RadarLocationSourceForegroundLocation + replayed:NO + beacons:nil + verified:YES + attestationString:attestationString + keyId:keyId + attestationError:attestationError + encrypted:YES + completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, + RadarUser *_Nullable user, NSArray *_Nullable nearbyGeofences, + RadarConfig *_Nullable config, NSString *_Nullable token) { + if (completionHandler) { + [RadarUtils runOnMainThread:^{ + completionHandler(status, token); + }]; + } + }]; + }]; + }]; + }]; +} + + (void)startTrackingWithOptions:(RadarTrackingOptions *)options { [[RadarLogger sharedInstance] logWithLevel:RadarLogLevelInfo type:RadarLogTypeSDKCall message:@"startTracking()"]; [[RadarLocationManager sharedInstance] startTrackingWithOptions:options]; @@ -345,7 +392,7 @@ + (void)mockTrackingWithOrigin:(CLLocation *)origin replayed:NO beacons:nil completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, RadarUser *_Nullable user, - NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config) { + NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config, NSString *_Nullable token) { if (completionHandler) { [RadarUtils runOnMainThread:^{ completionHandler(status, location, events, user); diff --git a/RadarSDK/RadarAPIClient.h b/RadarSDK/RadarAPIClient.h index a5ea19c72..e55681c99 100644 --- a/RadarSDK/RadarAPIClient.h +++ b/RadarSDK/RadarAPIClient.h @@ -27,7 +27,8 @@ typedef void (^_Nonnull RadarTrackAPICompletionHandler)(RadarStatus status, NSArray *_Nullable events, RadarUser *_Nullable user, NSArray *_Nullable nearbyGeofences, - RadarConfig *_Nullable config); + RadarConfig *_Nullable config, + NSString *_Nullable token); typedef void (^_Nonnull RadarTripAPICompletionHandler)(RadarStatus status, RadarTrip *_Nullable trip, NSArray *_Nullable events); @@ -86,6 +87,7 @@ typedef void (^_Nonnull RadarSyncLogsAPICompletionHandler)(RadarStatus status); attestationString:(NSString *_Nullable)attestationString keyId:(NSString *_Nullable)keyId attestationError:(NSString *_Nullable)attestationError + encrypted:(BOOL)encrypted completionHandler:(RadarTrackAPICompletionHandler _Nonnull)completionHandler; - (void)verifyEventId:(NSString *_Nonnull)eventId verification:(RadarEventVerification)verification verifiedPlaceId:(NSString *_Nullable)verifiedPlaceId; diff --git a/RadarSDK/RadarAPIClient.m b/RadarSDK/RadarAPIClient.m index e55c6b593..31b7f3d8e 100644 --- a/RadarSDK/RadarAPIClient.m +++ b/RadarSDK/RadarAPIClient.m @@ -130,6 +130,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location attestationString:nil keyId:nil attestationError:nil + encrypted:NO completionHandler:completionHandler]; } @@ -143,10 +144,11 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location attestationString:(NSString *_Nullable)attestationString keyId:(NSString *_Nullable)keyId attestationError:(NSString *_Nullable)attestationError + encrypted:(BOOL)encrypted completionHandler:(RadarTrackAPICompletionHandler _Nonnull)completionHandler { NSString *publishableKey = [RadarSettings publishableKey]; if (!publishableKey) { - return completionHandler(RadarStatusErrorPublishableKey, nil, nil, nil, nil, nil); + return completionHandler(RadarStatusErrorPublishableKey, nil, nil, nil, nil, nil, nil); } NSMutableDictionary *params = [NSMutableDictionary new]; BOOL anonymous = [RadarSettings anonymousTrackingEnabled]; @@ -257,6 +259,8 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location params[@"attestationString"] = attestationString; params[@"keyId"] = keyId; params[@"attestationError"] = attestationError; + params[@"jailbroken"] = @([RadarUtils isJailbroken]); + params[@"encrypted"] = @(encrypted); } params[@"appId"] = [[NSBundle mainBundle] bundleIdentifier]; @@ -314,7 +318,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location [[RadarDelegateHolder sharedInstance] didFailWithStatus:status]; - return completionHandler(status, nil, nil, nil, nil, nil); + return completionHandler(status, nil, nil, nil, nil, nil, nil); } [[RadarReplayBuffer sharedInstance] clearBuffer]; @@ -327,10 +331,21 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location id eventsObj = res[@"events"]; id userObj = res[@"user"]; id nearbyGeofencesObj = res[@"nearbyGeofences"]; + id tokenObj = res[@"token"]; NSArray *events = [RadarEvent eventsFromObject:eventsObj]; RadarUser *user = [[RadarUser alloc] initWithObject:userObj]; NSArray *nearbyGeofences = [RadarGeofence geofencesFromObject:nearbyGeofencesObj]; + if (encrypted) { + if (!tokenObj) { + return completionHandler(status, nil, nil, nil, nil, nil, nil); + } + + NSString *token = (NSString *)tokenObj; + + return completionHandler(status, nil, nil, nil, nil, nil, token); + } + if (user) { BOOL inGeofences = user.geofences && user.geofences.count; BOOL atPlace = user.place != nil; @@ -394,12 +409,12 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location [[RadarDelegateHolder sharedInstance] didReceiveEvents:events user:user]; } - return completionHandler(RadarStatusSuccess, res, events, user, nearbyGeofences, config); + return completionHandler(RadarStatusSuccess, res, events, user, nearbyGeofences, config, nil); } [[RadarDelegateHolder sharedInstance] didFailWithStatus:status]; - completionHandler(RadarStatusErrorServer, nil, nil, nil, nil, nil); + completionHandler(RadarStatusErrorServer, nil, nil, nil, nil, nil, nil); }]; } diff --git a/RadarSDK/RadarLocationManager.m b/RadarSDK/RadarLocationManager.m index e60c25219..c58fefa4a 100644 --- a/RadarSDK/RadarLocationManager.m +++ b/RadarSDK/RadarLocationManager.m @@ -845,7 +845,7 @@ - (void)sendLocation:(CLLocation *)location stopped:(BOOL)stopped source:(RadarL replayed:replayed beacons:beacons completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray *_Nullable events, RadarUser *_Nullable user, - NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config) { + NSArray *_Nullable nearbyGeofences, RadarConfig *_Nullable config, NSString *_Nullable token) { self.sending = NO; [self updateTrackingFromMeta:config.meta]; diff --git a/RadarSDK/RadarUtils.h b/RadarSDK/RadarUtils.h index 3404bb48a..6472aa872 100644 --- a/RadarSDK/RadarUtils.h +++ b/RadarSDK/RadarUtils.h @@ -29,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN + (CLLocation *)locationForDictionary:(NSDictionary *_Nonnull)dict; + (NSDictionary *)dictionaryForLocation:(CLLocation *)location; + (NSString *)dictionaryToJson:(NSDictionary *)dict; ++ (BOOL)isJailbroken; + (void)runOnMainThread:(dispatch_block_t)block; @end diff --git a/RadarSDK/RadarUtils.m b/RadarSDK/RadarUtils.m index 18e41cd37..e2e60af34 100644 --- a/RadarSDK/RadarUtils.m +++ b/RadarSDK/RadarUtils.m @@ -8,6 +8,8 @@ #import #import #import +#include +#include #import "RadarUtils.h" @@ -45,7 +47,7 @@ + (NSNumber *)timeZoneOffset { } + (NSString *)sdkVersion { - return @"3.8.4"; + return @"3.8.5"; } + (NSString *)deviceId { @@ -156,6 +158,57 @@ + (NSString *)dictionaryToJson:(NSDictionary *)dict { } } ++ (BOOL)isJailbroken { + NSArray *jailbreakFilePaths = @[ + @"/Applications/Cydia.app", + @"/Library/MobileSubstrate/MobileSubstrate.dylib", + @"/bin/bash", + @"/usr/sbin/sshd", + @"/etc/apt", + @"/private/var/lib/apt/" + ]; + + for (NSString *path in jailbreakFilePaths) { + if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { + NSLog(@"failed check 1"); + return YES; + } + } + + NSString *testPath = @"/private/JailbreakTest.txt"; + NSData *data = [@"This is a test." dataUsingEncoding:NSUTF8StringEncoding]; + + NSError *error; + [data writeToFile:testPath options:NSDataWritingAtomic error:&error]; + + // If no error occurred, the device is likely jailbroken + if (!error) { + NSLog(@"failed check 2"); + [[NSFileManager defaultManager] removeItemAtPath:testPath error:nil]; + return YES; + } + + void *dyld = dlopen(NULL, RTLD_NOW); + if (dyld != NULL) { + int imageCount = _dyld_image_count(); + for (int i = 0; i< imageCount; i++) { + const char *dylibNameC = _dyld_get_image_name(i); + NSString *dylibName = [NSString stringWithUTF8String:dylibNameC]; + if ([dylibName containsString:@"MobileSubstrate"]) { + NSLog(@"failed check 3"); + return YES; + } + } + } + + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://package/com.example.package"]]) { + NSLog(@"failed check 4"); + return YES; + } + + return NO; +} + #pragma mark - threading + (void)runOnMainThread:(dispatch_block_t)block { From be700de1496068e7d78122d7da65a1f4a409e745 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Mon, 21 Aug 2023 18:05:58 -0400 Subject: [PATCH 2/6] rename to trackVerifiedToken(), revert sample app code --- Example/Example/AppDelegate.swift | 8 +------- RadarSDK/Include/Radar.h | 10 +++++----- RadarSDK/Radar.m | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Example/Example/AppDelegate.swift b/Example/Example/AppDelegate.swift index 88c8da34a..173c17f02 100644 --- a/Example/Example/AppDelegate.swift +++ b/Example/Example/AppDelegate.swift @@ -22,14 +22,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.requestLocationPermissions() // Replace with a valid test publishable key - Radar.initialize(publishableKey: "org_test_pk_5857c63d9c1565175db8b00750808a66a002acb8") + Radar.initialize(publishableKey: "prj_test_pk_0000000000000000000000000000000000000000") Radar.setDelegate(self) - - Radar.trackVerified { status, location, events, user in - - } - /* if UIApplication.shared.applicationState != .background { Radar.getLocation { (status, location, stopped) in print("Location: status = \(Radar.stringForStatus(status)); location = \(String(describing: location))") @@ -164,7 +159,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD print("Log Conversion: status = \(Radar.stringForStatus(status)); event = \(String(describing: event))") } - */ return true } diff --git a/RadarSDK/Include/Radar.h b/RadarSDK/Include/Radar.h index c56a4548a..a3066e5cf 100644 --- a/RadarSDK/Include/Radar.h +++ b/RadarSDK/Include/Radar.h @@ -186,13 +186,13 @@ typedef void (^_Nullable RadarBeaconCompletionHandler)(RadarStatus status, NSArr typedef void (^_Nullable RadarTrackCompletionHandler)(RadarStatus status, CLLocation *_Nullable location, NSArray *_Nullable events, RadarUser *_Nullable user); /** - Called when an encrypted track request succeeds, fails, or times out. + Called when an track request with token callback succeeds, fails, or times out. - Receives the request status and, if successful, a JSON Web Token (JWT) containing an array of the events generated and the user. Decrypt the JWT server-side using your private key. + Receives the request status and, if successful, a JSON Web Token (JWT) containing an array of the events generated and the user. Verify the JWT server-side using your secret key. @see https://radar.com/documentation/sdk/ios */ -typedef void (^_Nullable RadarTrackEncryptedCompletionHandler)(RadarStatus status, NSString *_Nullable token); +typedef void (^_Nullable RadarTrackTokenCompletionHandler)(RadarStatus status, NSString *_Nullable token); /** Called when a trip update succeeds, fails, or times out. @@ -451,7 +451,7 @@ typedef void (^_Nonnull RadarLogConversionCompletionHandler)(RadarStatus status, + (void)trackVerifiedWithCompletionHandler:(RadarTrackCompletionHandler _Nullable)completionHandler NS_SWIFT_NAME(trackVerified(completionHandler:)); /** - Tracks the user's location with device integrity information for location verification use cases. Returns a JSON Web Token (JWT). Decrypt the JWT server-side using your private key. + Tracks the user's location with device integrity information for location verification use cases. Returns a JSON Web Token (JWT). Verify the JWT server-side using your secret key. @warning Note that you must configure SSL pinning before calling this method. @@ -459,7 +459,7 @@ typedef void (^_Nonnull RadarLogConversionCompletionHandler)(RadarStatus status, @see https://radar.com/documentation/fraud */ -+ (void)trackVerifiedEncryptedWithCompletionHandler:(RadarTrackEncryptedCompletionHandler _Nullable)completionHandler NS_SWIFT_NAME(trackVerifiedEncrypted(completionHandler:)); ++ (void)trackVerifiedTokenWithCompletionHandler:(RadarTrackTokenCompletionHandler _Nullable)completionHandler NS_SWIFT_NAME(trackVerifiedToken(completionHandler:)); /** Starts tracking the user's location in the background with configurable tracking options. diff --git a/RadarSDK/Radar.m b/RadarSDK/Radar.m index 769a53452..12dc2174f 100644 --- a/RadarSDK/Radar.m +++ b/RadarSDK/Radar.m @@ -275,7 +275,7 @@ + (void)trackVerifiedWithCompletionHandler:(RadarTrackCompletionHandler)completi }]; } -+ (void)trackVerifiedEncryptedWithCompletionHandler:(RadarTrackEncryptedCompletionHandler)completionHandler { ++ (void)trackVerifiedTokenWithCompletionHandler:(RadarTrackTokenCompletionHandler)completionHandler { [[RadarAPIClient sharedInstance] getConfigForUsage:@"verify" verified:YES completionHandler:^(RadarStatus status, RadarConfig *_Nullable config) { From 15258c63b84c66e3c83b091fe9541ed7b2b6b2bb Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Mon, 21 Aug 2023 18:13:14 -0400 Subject: [PATCH 3/6] remove checks --- RadarSDK/RadarAPIClient.m | 1 - RadarSDK/RadarUtils.h | 1 - RadarSDK/RadarUtils.m | 51 --------------------------------------- 3 files changed, 53 deletions(-) diff --git a/RadarSDK/RadarAPIClient.m b/RadarSDK/RadarAPIClient.m index 31b7f3d8e..986f2f536 100644 --- a/RadarSDK/RadarAPIClient.m +++ b/RadarSDK/RadarAPIClient.m @@ -259,7 +259,6 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location params[@"attestationString"] = attestationString; params[@"keyId"] = keyId; params[@"attestationError"] = attestationError; - params[@"jailbroken"] = @([RadarUtils isJailbroken]); params[@"encrypted"] = @(encrypted); } params[@"appId"] = [[NSBundle mainBundle] bundleIdentifier]; diff --git a/RadarSDK/RadarUtils.h b/RadarSDK/RadarUtils.h index 6472aa872..3404bb48a 100644 --- a/RadarSDK/RadarUtils.h +++ b/RadarSDK/RadarUtils.h @@ -29,7 +29,6 @@ NS_ASSUME_NONNULL_BEGIN + (CLLocation *)locationForDictionary:(NSDictionary *_Nonnull)dict; + (NSDictionary *)dictionaryForLocation:(CLLocation *)location; + (NSString *)dictionaryToJson:(NSDictionary *)dict; -+ (BOOL)isJailbroken; + (void)runOnMainThread:(dispatch_block_t)block; @end diff --git a/RadarSDK/RadarUtils.m b/RadarSDK/RadarUtils.m index e2e60af34..cf1e39da6 100644 --- a/RadarSDK/RadarUtils.m +++ b/RadarSDK/RadarUtils.m @@ -158,57 +158,6 @@ + (NSString *)dictionaryToJson:(NSDictionary *)dict { } } -+ (BOOL)isJailbroken { - NSArray *jailbreakFilePaths = @[ - @"/Applications/Cydia.app", - @"/Library/MobileSubstrate/MobileSubstrate.dylib", - @"/bin/bash", - @"/usr/sbin/sshd", - @"/etc/apt", - @"/private/var/lib/apt/" - ]; - - for (NSString *path in jailbreakFilePaths) { - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - NSLog(@"failed check 1"); - return YES; - } - } - - NSString *testPath = @"/private/JailbreakTest.txt"; - NSData *data = [@"This is a test." dataUsingEncoding:NSUTF8StringEncoding]; - - NSError *error; - [data writeToFile:testPath options:NSDataWritingAtomic error:&error]; - - // If no error occurred, the device is likely jailbroken - if (!error) { - NSLog(@"failed check 2"); - [[NSFileManager defaultManager] removeItemAtPath:testPath error:nil]; - return YES; - } - - void *dyld = dlopen(NULL, RTLD_NOW); - if (dyld != NULL) { - int imageCount = _dyld_image_count(); - for (int i = 0; i< imageCount; i++) { - const char *dylibNameC = _dyld_get_image_name(i); - NSString *dylibName = [NSString stringWithUTF8String:dylibNameC]; - if ([dylibName containsString:@"MobileSubstrate"]) { - NSLog(@"failed check 3"); - return YES; - } - } - } - - if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"cydia://package/com.example.package"]]) { - NSLog(@"failed check 4"); - return YES; - } - - return NO; -} - #pragma mark - threading + (void)runOnMainThread:(dispatch_block_t)block { From 4753a699af5124a565eaffb65fb7b687e673672f Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Mon, 21 Aug 2023 18:14:51 -0400 Subject: [PATCH 4/6] fix docs --- RadarSDK/Include/Radar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RadarSDK/Include/Radar.h b/RadarSDK/Include/Radar.h index a3066e5cf..17d96ba1d 100644 --- a/RadarSDK/Include/Radar.h +++ b/RadarSDK/Include/Radar.h @@ -190,7 +190,7 @@ typedef void (^_Nullable RadarTrackCompletionHandler)(RadarStatus status, CLLoca Receives the request status and, if successful, a JSON Web Token (JWT) containing an array of the events generated and the user. Verify the JWT server-side using your secret key. - @see https://radar.com/documentation/sdk/ios + @see https://radar.com/documentation/sdk/fraud */ typedef void (^_Nullable RadarTrackTokenCompletionHandler)(RadarStatus status, NSString *_Nullable token); From 085453f8eee7dede0beb54762ebae49456df1052 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Mon, 21 Aug 2023 18:15:54 -0400 Subject: [PATCH 5/6] revert includes --- RadarSDK/RadarUtils.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/RadarSDK/RadarUtils.m b/RadarSDK/RadarUtils.m index cf1e39da6..e14138b7b 100644 --- a/RadarSDK/RadarUtils.m +++ b/RadarSDK/RadarUtils.m @@ -8,8 +8,6 @@ #import #import #import -#include -#include #import "RadarUtils.h" From 6ce4f43983d0550a6838217a7d4d747c2fb864f6 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Tue, 22 Aug 2023 06:00:54 -0400 Subject: [PATCH 6/6] bump version --- RadarSDK.podspec | 2 +- RadarSDK.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RadarSDK.podspec b/RadarSDK.podspec index 78ec84e69..a55a0604f 100644 --- a/RadarSDK.podspec +++ b/RadarSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RadarSDK' - s.version = '3.8.4' + s.version = '3.8.5' s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform' s.homepage = 'https://radar.com' s.author = { 'Radar Labs, Inc.' => 'support@radar.com' } diff --git a/RadarSDK.xcodeproj/project.pbxproj b/RadarSDK.xcodeproj/project.pbxproj index 3a2d4e2c1..38a8255f4 100644 --- a/RadarSDK.xcodeproj/project.pbxproj +++ b/RadarSDK.xcodeproj/project.pbxproj @@ -965,7 +965,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MARKETING_VERSION = 3.8.4; + MARKETING_VERSION = 3.8.5; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -1024,7 +1024,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MARKETING_VERSION = 3.8.4; + MARKETING_VERSION = 3.8.5; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; OTHER_CFLAGS = "-fembed-bitcode";