react-native-trustkit-wrapper-fork
v0.0.2
Published
React native integration for TrustKit
Downloads
9
Maintainers
Readme
react-native-trustkit-wrapper
A simple wrapper around Trustkit for react-native.
Prerequisites
A working react native project. Tested on react-native 0.44 and above A working CocoaPods installation CocoaPods - Getting Started
Installation
- Install from npm
npm install --save react-native-trustkit-wrapper
oryarn add react-native-trustkit-wrapper
- Run
react-native link react-native-trustkit-wrapper
to link ios and android project
iOS
- Add TrustKit to your cocoapods configuration (PodFile)
pod 'TrustKit', '~> 1.4.2'
- Run
pod install
to install cocoapods dependencies
Android
- Not yet supported
Usage
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