Skip to main content

Expo Integration Guide

DyScan is compatible with Expo either by manually linking the native code as described in Linking for Android and Linking for iOS or by using our Expo plugin.

Expo Plugin

To use Dyneti's Expo plugin, first follow the steps in Importing DyScan to install DyScan from NPM, then install the plugin with

npm install @dyneti/dyscan-expo-plugin

In your app.json file, declare the plugin

{
"expo": {
...
"plugins": [
[
"@dyneti/dyscan-expo-plugin",
{
"dynetiMavenUsername": "nexusUsername",
"dynetiMavenPassword": "nexusPassword"
}
]
],
...
}
}
info

If your app.json doesn't have a root level "expo" key, you can use "plugins" as a root level key. See https://docs.expo.dev/workflow/configuration/

Replace nexusUsername and nexusPassword with the credentials provided during integration. The full set of options supported by the plugin is

ParameterDescriptionType
dynetiMavenUsernameRequired. The username for Nexus provided by Dyneti.string
dynetiMavenPasswordRequired. The password for Nexus provided by Dyneti.string
verboseOptional. Defaults to false. If set to true provides additional logging while the plugin is running.boolean
euVersionOptional. Defaults to false. Set to true if using the EU version of DyScan.boolean
fraudVersionOptional. Defaults to false. Set to true to if using the fraud version of DyScan.boolean
warning

The euVersion and fraudVersion parameters must mach the version of DyScan installed. For example, if you installed DyScan with

npm install @dyneti/react-native-dyscan-fraud-eu

Then you must set both euVersion and fraudVersion to true. The plugin will not alter the installed version of DyScan.

Invoke the plugin with

npx expo prebuild

The plugin will not run on subsequent builds of npx expo prebuild. To regenerate the files and force the plugin to run again use

npx expo prebuild --clean

To build and run the app use

npx expo run:ios # or npx expo run:android

You may be prompted for a GitHub token during the iOS build process. Dyneti provides this during integration. DyScan will now be available and can be integrated as in a bare React Native app. See our React Native docs for more

Expo Application Services

To build your apps using Expo Application Services (EAS), you will need to use a pre-install hook to authenticate the remote machine with Dyneti's GitHub repositories. First create a script called setup-dyscan-credentials.sh

#!/usr/bin/env bash
# setup-dyscan-credentials.sh

echo "https://dyscan:${DYSCAN_GITHUB_TOKEN}@github.com" > ~/dyscan-github-token.txt
git config --global credential.helper "store --file ~/dyscan-github-token.txt"

The ${DYSCAN_GITHUB_TOKEN} can be replaced with its actual value or set as an environment variable in EAS. See Expo's documentation on creating environment variables for details.

warning

You may also need to set an environment variable for DYSCAN_NPM_TOKEN if you did not hard code the token's value in your .npmrc file.

Next, declare the script in the scripts object under eas-build-pre-install in package.json. For example

{
"name": "my-expo-app",
...
"scripts": {
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eas-build-pre-install": "./setup-dyscan-credentials.sh"
},
...
}

Now you can begin an EAS build with

eas build