Appendix A - React Native Wrapper for Harmony App Protect

Important Update - Harmony App Protect End of Support

 

Check Point’s Harmony App Protect will be end of support soon.

For more information on key actions and timelines, see Harmony App Protect End-of-Life - Check Point CheckMates.

Introduction

The Harmony Mobile React Native Wrapper for Harmony App Protect provides an interface to integrate Check Point Harmony App Protect into React Native (RN) apps.

NPM

NPM is a package manager for the JavaScript programming language maintained by NPM, Inc. It is used by a variety of projects and frameworks, such as ReactJS, React-Native, nodeJS, etc.

In React-Native, we use NPM to manage our dependencies, which is then monitored using a file called package.json.

Basic Usage

At its core, NPM is configured to use the public NPM registry which is a hub for open-source NPM project. It is the de facto standard for distributing React-Native package, although other public/private registries exist.

NPM Basic Usage

Copy
npm install [PACKAGE_NAME] # Installs a package called [PACKAGE_NAME] 
#from the configured NPM registry (defaults to the NPM public registry)
 
OR
 
npm install [URL] # Installs a package from a given URL which points to either a git repository or a tarball file

When a project installs some dependencies, they are stored in the package.json in the following format.

Example of package.json file

Copy
"dependencies": {
  "vue": "^2.5.2" // key  is the package's name, value is the version number 
   (the caret means it will use all compatible package versions - all the following minor/patch versions)
  }

Installation

To use the Harmony App Protect in an React Native project, install the dependency with this command:

Copy
npm install https://[USERNAME]:[PASSWORD]@cp-artifactory.locsec.net/artifactory/sbm-rn-sdk/[VERSION].tgz

(replace [USERNAME] and [PASSWORD] with credentials, and [VERSION] with the version number e,g, 1.0.0)

This command installs the Harmony App Protect from the cp-artifactory.

Android Specific Configuration

For Android, additional configuration is required:

  1. In your apps' Android folder, create a file called sbm.properties with this content:

    Copy
    sbm.sdk.repo.name=XXXXX
    sbm.sdk.url=XXXXX
    sbm.sdk.user=XXXXX
    sbm.sdk.password=XXXXX
  2. Replace each XXXXX with the information you received when you purchased the Harmony App Protect.

iOS Specific Configuration

iOS uses Cocoapods to install the Harmony App Protect. Make sure it is installed, or use the sudo gem install cocoapods command or brew install cocoapods on M1 masOS to install it.

The Harmony App Protect requires you to use frameworks. Make sure the iOS pod file has use_frameworks! and run pod install.
You may need to disable use_flipper()because it does not support frameworks.

iOS requires additional configuration just like when you use the basic Harmony App Protect. For more information, see Enabling HTTP Requests.

You must also configure the App Transport Security Settings in the Xcode project info section of the target project:

sbm.properties file:

Copy
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>bosko.locsec.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <false/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSRequiresCertificateTransparency</key>
            <false/>
        </dict>
    </dict>
</dict>

Usage Example

Initializing Example

Copy
import SandblastAppProtect from "react-native-sandblast-app-protect";
    import * as SBM from "react-native-sandblast-app-protect";
 
    // ...
 
    const registrationResult = await SandblastAppProtect.initializeWithAPIKey('regkey');
    if (registrationResult === SBM.SBMClientRegistrationResultType.Success) 
       {
          const scanResults = await 
          SandblastAppProtect.scanFeatures([SBM.SBMClientDetectionType.Jailbreak, SBM.SBMClientDetectionType.Network]);
          const riskResponse = await SandblastAppProtect.getRisks();
          const hasJailbreakRisk = await SandblastAppProtect.isRisks(riskResponse.risks,
          SBM.SBMClientDetectionType.Jailbreak);
        }