I'm currently implementing TrustKit SSL Pinning on a React Native project.
Due to another library on my XCode project, which does already install TrustKit Cocoapod I am not be able to refer it directly anymore, that's why I'm trying to call it in a "private" manner, just like this example:
// Disable TrustKit if it is present
Class TrustKit = NSClassFromString(@"TrustKit"); //Private calling
if (TrustKit != nil)
{
// Override TrustKit's logger method, useful for local debugging
void (^loggerBlock)(NSString *) = ^void(NSString *message)
{
NSLog(@"TrustKit log: %@", message);
};
SEL setLoggerBlock = sel_registerName("setLoggerBlock:");
[TrustKit performSelector: setLoggerBlock withObject:loggerBlock];
NSDictionary *trustKitConfig =
@{
kTSKSwizzleNetworkDelegates: @YES,// How to private consume this property
kTSKPinnedDomains: @{
@"*.apps.dev.js.com" : @{
kTSKIncludeSubdomains: @YES, // Pin all subdomains
kTSKEnforcePinning: @YES, // Block connections if pinning validation failed
kTSKDisableDefaultReportUri: @YES,
kTSKPublicKeyHashes: @[
@"dz0GbS1i4LnBsJwhRw3iuZmVcgqpn+AlxSBRxUbOz0k=",
@"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=",
],
},
}
};
SEL setInitSharedInstanceWithConfiguration = sel_registerName("initSharedInstanceWithConfiguration:");
[TrustKit performSelector: setInitSharedInstanceWithConfiguration withObject:trustKitConfig];
}
I was able to execute TrustKit methods properly. However, I don't know how to handle trustKitConfig properties from the dictionary by private calling