React native integration for TrustKit
npm install react-native-trustkit-wrapperA simple wrapper around Trustkit for react-native.
A working react native project. Tested on react-native 0.44 and above
A working CocoaPods installation CocoaPods - Getting Started
npm install --save react-native-trustkit-wrapper or yarn add react-native-trustkit-wrapperreact-native link react-native-trustkit-wrapper to link ios and android projectpod 'TrustKit', '~> 1.4.2'pod install to install cocoapods dependencies``js
import configureTrustKit from 'react-native-trustkit-wrapper';
configureTrustKit({
PinnedDomain: {
'my.api.com': {
IncludeSubdomains: true,
EnforcePinning: true,
PublicKeyAlgorithms: [
'AlgorithmRsa2048',
'AlgorithmRsa4096',
],
PublicKeyHashes: [
'HXXQgxueCIU5TTLHob/bPbwcKOKw6DkfsTWYHbxbqTY=',
'0SDf3cRToyZJaMsoS17oF72VMavLxj/N7WBNasNuiR8=',
],
ReportUris: [
'https://my.api.com/log_report',
],
},
},
SwizzleNetworkDelegates: true,
}).catch((err) => {
if (err.code === 'trustkit_initialized') {
console.warn('Trust kit configuration only changed when app re-launches');
}
});
``
See the TrustKit documentation for more information