UNPKG

react-native-malwarelytics

Version:

Malwarelytics for React Native protects your banking or fintech app from a broad range of mobile security threats with an industry-leading mobile threat intelligence solution.

113 lines (87 loc) 3.51 kB
# Installation ## Distribution Malwarelytics for React Native is distributed as a NPM package. The private Maven repository for the Android native library and the private CocoaPods repository for the iOS native library is used under the hood. ## Platform Support <!-- begin box info --> Malwarelytics for React Native __supports iOS 13.4 and Android 6.0__ (SDK version 23) and above. The React Native 0.74 and above is recommended for your application. <!-- end --> ## Configure Wultra's Artifactory <!-- begin box warning --> **Personalized Configuration Required.**<br/> In order to use Malwarelytics for React Native, you need a custom configuration and access credentials for both the service and the artifact repository. Contact your sales representative or technical consultant to obtain the necessary prerequisites. <!-- end --> ### Adding Maven Repository Add a new Maven repository pointing to Wultra Artifactory to your main application's gradle file located at `android/build.gradle`: ```gradle allProjects { repositories { maven { url 'https://wultra.jfrog.io/artifactory/malwarelytics-android/' credentials { username 'name@yourcompany.com' password 'some-password' } } } } ``` In the same file, look for `minSdkVersion` and make sure that it's higher or equal to `23`. If you don't want to expose your credentials in the gradle file, then use the script to load the credentials from `local.properties`. For example: ```gradle // Load Artifactory credentials from 'local.properties' file. It's expected that credentials // are set in 'wultraArtifactory_username' or 'wultraArtifactory_password' properties. def loadArtifactoryCredentials(name) { def propName = 'wultraArtifactory_' + name // Try to iterate over all possible local.properties files def propFiles = [ project.rootProject.file('local.properties'), project.file('local.properties') ] for (file in propFiles) { if (file.canRead()) { def props = new Properties() props.load(file.newDataInputStream()) def value = props[propName] if (value != null) { return value } } } logger.error('Failed to resolve required property: ' + propName) return null } allProjects { repositories { maven { url 'https://wultra.jfrog.io/artifactory/malwarelytics-android/' credentials { username loadArtifactoryCredentials('username') // wultraArtifactory_username password loadArtifactoryCredentials('password') // wultraArtifactory_password } } } } ``` ### Configure CocoaPods Create (or append to if already exists) a `~/.netrc` file in your home directory (`~`) with your credentials to Wultra Artifactory. ``` machine wultra.jfrog.io login name@yourcompany.com password some-password ``` ## Adding Module Dependency Use your favorite dependency manager to add the dependency: ```bash # npm npm i react-native-malwarelytics --save # yarn yarn add react-native-malwarelytics ``` ## Use Malwarelytics in your js/ts files The `Malwarelytics` class provides a static property that contains singleton instance of the class: ```typescript import { Malwarelytics } from 'react-native-malwarelytics'; const service = Malwarelytics.sharedInstance; ``` ## Read Next - [Configuration](Configuration.md)