Skip to content

Vestiacom/react-native-trustkit

 
 

Repository files navigation

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

  1. Install from npm npm install --save react-native-trustkit-wrapper@git+https://github.com/fauzzi/react-native-trustkit.git
  2. Run react-native link react-native-trustkit-wrapper to link ios and android project

iOS

  1. Add TrustKit to your cocoapods configuration (PodFile) pod 'TrustKit', '~> 1.4.2'
  2. Run pod install to install cocoapods dependencies

Android

  1. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 65.6%
  • JavaScript 27.3%
  • Ruby 7.1%