Skip to content

Commit

Permalink
v7.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
RN SDK Release User committed Dec 7, 2022
1 parent 9903e93 commit a5199d9
Show file tree
Hide file tree
Showing 12 changed files with 12,194 additions and 53 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## next-version

### Added:

- Public: Added NFC support
- Public: Added support for new OnfidoCaptureType - MOTION

## [7.0.1] - 2022-11-28

### Changed:
Expand Down Expand Up @@ -35,7 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [5.4.0] - 2022-06-22

### Changed:
- Public:
- Public:
- Public: Update underlying Onfido native SDK versions:
- Android 12.2.0 (up from 11.5.0)
- iOS 25.1.0 (up from 24.6.0)
Expand Down
112 changes: 112 additions & 0 deletions ONFIDO_STUDIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## Overview
[Onfido Studio](https://developers.onfido.com/guide/onfido-studio-product) is a drag and drop interface enabling you to build an optimised route to verify each end user, by defining and configuring different paths, as well as incorporating a combination of signals, in a single identity verification flow.

## Integrating with React Native SDK
The Onfido React Native SDK provides a drop-in set of screens and tools for React Native applications to capture identity documents and selfie photos and videos for the purpose of identity verification.

The SDK communicates directly and dynamically with active workflows to show the relevant screens to ensure the correct capture and upload of user information. As a result, the SDK flow will vary depending on the workflow configuration. You won't need to specify any steps directly in the SDK integration as these will be overridden when the workflow run ID is passed into the SDK initialisation.


> ℹ️
>
> The following guide will help you to integrate with Onfido Studio.
> If you are looking for the standard integration using Onfido checks, please head to our [README](https://github.com/onfido/react-native-sdk).
## Getting started

The SDK supports:

* React Native 0.68+
* iOS 11+
* Supports Xcode 13+
* Supports Android API level 21+


### 1. Add the SDK dependency

#### Using npm
The SDK is available on npm and you can include it in your project by running the following script from your project folder:

```shell
npm install @onfido/react-native-sdk --save​
```

### 2. Update your `Android build.gradle` files
Update your `build.gradle` files to reference the Android SDK, and enable multi-dex. If you build your project using the react-native init, with a `build.gradle` in the `android/` and `android/app/` directories, you can run this script to do it:

```shell
npm --prefix node_modules/@onfido/react-native-sdk/ run updateBuildGradle
```

### 3. Update your iOS configuration files
Change ios/Podfile to use version 11:

```ruby
platform :ios, '11.0'
```

Add descriptions for camera and microphone permissions to `ios/YourProjectName/Info.plist`:

```xml
<plist version="1.0">
<dict>
<!-- Add these four elements: -->
<key>NSCameraUsageDescription</key>
<string>Required for document and facial capture</string>
<key>NSMicrophoneUsageDescription</key>
<string>Required for video capture</string>
<!-- ... -->
</dict>
</plist>
```

Open Xcode and create an empty Swift file in your project root. For example, if your project is called YourProjectName, you can open it from the command line:

```shell
open ios/YourProjectName.xcodeproj
```

Once Xcode is open, add an empty Swift file:

`File > New File > Swift > Next > "SwiftVersion" > Create > Don't create Header`

This will update your iOS configuration with a Swift version. All changes are automatically saved, so you can close Xcode.


### 4. Build a configuration object

To initiaise the SDK, you must provide a `workflowRunId`, obtained by [creating a workflow run](https://documentation.onfido.com/#create-workflow-run), and an `sdkToken`, obtained by [generating an SDK token](https://documentation.onfido.com/#generate-sdk-token).

```javascript
const config = {
sdkToken: '<YOUR_SDK_TOKEN>',
workflowRunId: '<YOUR_WORKFLOW_RUN_ID>'
};
```

### 5. Start the flow
```javascript
Onfido.start(config);
// listen for the result
```

## Handling callbacks

To receive the result from a completed workflow, you should use promises. For example:


```javascript
Onfido.start(config)
.then(res => console.warn('OnfidoSDK: Success:', JSON.stringify(res)))
.catch(err => console.warn('OnfidoSDK: Error:', err.code, err.message));
```


| ATTRIBUTE | NOTES |
| ------------- |-------------|
| .then | The end user completed all interactive tasks in the workflow. If you have configured [webhooks](https://documentation.onfido.com/#webhooks), a notification will be sent to your backend confirming the workflow run has finished. You do not need to create a check using your backend as this is handled directly by the Workflow. |
| .error(Error) | An unexpected error occurred. |

### Customizing the SDK

Onfido Studio uses the same appearance and localization objects as a standard integration. You can see how to create them here: [Appearance](https://github.com/onfido/react-native-sdk#theme-customization) and [Localization](https://github.com/onfido/react-native-sdk#5-localization).
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ This SDK provides a drop-in set of screens and tools for react native applicatio
* Advanced image quality detection technology to ensure the quality of the captured images meets the requirement of the Onfido identity verification process, guaranteeing the best success rate
* Direct image upload to the Onfido service, to simplify integration\*

> ℹ️
>
> If you are integrating using Onfido Studio please see our [Studio integration guide](ONFIDO_STUDIO.md)
\* **Note**: the SDK is only responsible for capturing and uploading photos/videos. You still need to access the [Onfido API](https://documentation.onfido.com/) to create and manage checks.

* Supports iOS 11+
Expand Down Expand Up @@ -247,6 +251,7 @@ config = {
type: OnfidoCaptureType.VIDEO
},
},
enableNFC: true
}
```

Expand All @@ -262,9 +267,11 @@ config = {
**Note**: `GENERIC` document type doesn't offer an optimised capture experience for a desired document type.
* **`countryCode`**: Required if docType is specified.
* Valid values in `OnfidoCountryCode`: Any ISO 3166-1 alpha-3 code. For example: `OnfidoCountryCode.USA`.
* **`enableNFC`**: Optional. This toggles the ePassport NFC extraction feature. If omitted, this feature is not enabled in the flow. There is also application configuration changes needed to use this feature. To do that please follow [Onfido Developer Hub](#https://developers.onfido.com/guide/document-report-nfc#enable-nfc-in-the-onfido-sdks)
* Valid values: `true`, `false`.
* **`captureFace`**: Optional. This object object containing options for capture face screen. If omitted, this screen does not appear in the flow.
* **`type`**: Required if captureFace is specified.
* Valid values in `OnfidoCaptureType`: `PHOTO`, `VIDEO`.
* Valid values in `OnfidoCaptureType`: `PHOTO`, `VIDEO`, `MOTION`.
* **`localisation`**: Optional. This object contains localisation configuration. See section [Localization](#localization) for the details.
* Example usage:

Expand Down
3 changes: 3 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:3.8.0"
// Fix for crash due to 'java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;''
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// The following 2 dependencies are needed for NFC
implementation "net.sf.scuba:scuba-sc-android:0.0.23"
implementation "org.jmrtd:jmrtd:0.7.32"

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
Expand Down
16 changes: 15 additions & 1 deletion android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
-keep class com.onfido.reactnative.sdk.** { *; }
-keep class com.onfido.reactnative.sdk.** { *; }

# Needed for NFC
-keep class org.jmrtd.** { *; }
-keep class net.sf.scuba.** {*;}
-keep class org.bouncycastle.** {*;}
-keep class org.ejbca.** {*;}

# Needed for NFC
-dontwarn kotlin.time.jdk8.DurationConversionsJDK8Kt
-dontwarn org.ejbca.**
-dontwarn org.bouncycastle.**
-dontwarn module-info
-dontwarn org.jmrtd.**
-dontwarn net.sf.scuba.**
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.onfido.android.sdk.capture.ui.camera.face.FaceCaptureVariant;
import com.onfido.android.sdk.capture.ui.camera.face.FaceCaptureVariantPhoto;
import com.onfido.android.sdk.capture.ui.camera.face.FaceCaptureVariantVideo;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.FaceCaptureStepBuilder;
import com.onfido.android.sdk.capture.ui.options.CaptureScreenStep;
import com.onfido.android.sdk.capture.ui.options.FlowStep;
import com.onfido.android.sdk.capture.utils.CountryCode;
Expand Down Expand Up @@ -61,9 +62,7 @@ public String getName() {
}

/**
*
* NOTE: This indirection is used to allow unit tests to mock this method
*/
protected Activity getCurrentActivityInParentClass() {
return super.getCurrentActivity();
Expand Down Expand Up @@ -165,6 +164,10 @@ private void defaultSDKConfiguration(final ReadableMap config, Activity currentA
onfidoConfigBuilder.withEnterpriseFeatures(enterpriseFeaturesBuilder.build());
}

if(getBooleanFromConfig(config, "enableNFC")) {
onfidoConfigBuilder.withNFCReadFeature();
}

client.startActivityForResult(currentActivity,
OnfidoSdkActivityEventListener.checksActivityCode,
onfidoConfigBuilder.build());
Expand Down Expand Up @@ -254,6 +257,8 @@ public static FlowStep[] getFlowStepsFromConfig(final ReadableMap config) throws
flowStepList.add(new FaceCaptureStep(new FaceCaptureVariantPhoto()));
} else if (captureFaceType.equals("VIDEO")) {
flowStepList.add(new FaceCaptureStep(new FaceCaptureVariantVideo()));
} else if (captureFaceType.equals("MOTION")) {
flowStepList.add(FaceCaptureStepBuilder.forMotion().build());
} else {
throw new Exception("Invalid face capture type. \"type\" must be VIDEO or PHOTO.");
}
Expand Down
Loading

0 comments on commit a5199d9

Please sign in to comment.