Skip to content

Commit

Permalink
v13.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
RN SDK Release User committed Aug 1, 2024
1 parent c827121 commit 39b92de
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 44 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [13.0.0] - 2024-07-30

### Added:

- Added `nfcOption` parameter for configuring NFC
- Deprecated `disableNFC` parameter (Use `nfcOption` with `OnfidoNFCOptions.DISABLED` value instead)

### Changed:

- Updated underlying Onfido native SDK version:
- iOS 30.4.x (up from 30.3.x)
- Android 21.0.x (up from 20.5.x)
- Bumped Android target SDK version to 34 (Java version 17 is required to build the project)

## [12.3.0] - 2024-07-04

### Changed:
Expand Down
55 changes: 35 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,19 @@ You have to include the entries below in your app target's `Info.plist` file to
</array>
```

##### Disabling NFC
##### Disabling NFC and excluding dependencies

NFC is enabled by default. To disable NFC, include the `disableNFC` parameter while configuring the `Onfido.start` function:
NFC is enabled by default. To disable NFC, include the `nfcOption` parameter with `OnfidoNFCOptions.DISABLED` while configuring the `Onfido.start` function:

```javascript
config = {
sdkToken: "<YOUR_SDK_TOKEN>",
workflowRunId: "<YOUR_WORKFLOW_RUN_ID>",
disableNFC: "true"
nfcOption: OnfidoNFCOptions.DISABLED
}
```

For Android, a range of NFC library dependencies are included in the build automatically. In addition to configuring the `disableNFC` parameter, you must remove any libraries from the build process.
For Android, a range of NFC library dependencies are included in the build automatically. In addition to configuring the `nfcOption` parameter, you must remove any libraries from the build process.

Exclude dependencies required for NFC from your build:

Expand Down Expand Up @@ -250,6 +250,13 @@ implementation ("com.onfido.sdk:onfido-<variant>:19.1.0"){
implementation "org.bouncycastle:bcutil-jdk15to18:1.69"
```

#### NFC Options

To configure NFC, include the `nfcOption` parameter with the three options below while configuring the `Onfido.start` function:
* DISABLED: NFC reading will not be asked of end-users
* OPTIONAL (Default): NFC reading will be attempted, if possible
* REQUIRED: NFC reading will be enforced, preventing end-users from completing the flow without a successful reading

## Initializing the SDK

The Reach Native SDK has multiple initialization and customization options that provide flexibility to your integration, while remaining easy to integrate.
Expand All @@ -274,23 +281,9 @@ When defining workflows and creating identity verifications, we highly recommend

### SDK authentication

The SDK is authenticated using SDK tokens. As each SDK token must be specific to a given applicant and session, and a new token must be generated each time you initialize the Onfido React Native SDK.
The SDK is authenticated using SDK tokens. Onfido Studio generates and exposes SDK tokens in the workflow run payload returned by the API when a workflow run is [created](https://documentation.onfido.com/#create-workflow-run).

| Parameter | Notes |
|------|------|
| `applicant_id` | **required** <br /> Specifies the applicant for the SDK instance. |
| `application_id` | **required** <br /> The application ID (for iOS "application bundle ID") that was set up during development. |

* For iOS, the `application_id` is usually in the form of `com.your-company.app-name`.
* To get this value manually, open Xcode `ios/YourProjectName`, click on the project root, click the General tab, under Targets click your project name, and check the Bundle Identifier field.
* To get this value programmatically in native iOS code, refer to this [Stack Overflow Page](https://stackoverflow.com/questions/8873203/how-to-get-bundle-id).
* For Android, the `application_id` is usually in the form of `com.example.yourapp`.
* To get this file manually, you can find it in your app's `build.config`. For example, in `android/app/build.gradle`, it is the value of `applicationId`.
* To get this value programmatically in native Java code, refer to this [Stack Overflow Page](https://stackoverflow.com/questions/14705874/bundle-id-in-android).

It's important to note that SDK tokens expire after **90 minutes**.

For details on how to generate SDK tokens, please refer to the `POST /sdk_token/` endpoint definition in the Onfido [API reference](https://documentation.onfido.com/api/latest#generate-sdk-token).
SDK tokens for Studio can only be used together with the specific workflow run they are generated for, and remain valid for a period of five weeks.

**Note**: You must never use API tokens in the frontend of your application as malicious users could discover them in your source code. You should only use them on your server.

Expand Down Expand Up @@ -536,6 +529,28 @@ The flow step parameters described below are mutually exclusive with `workflowRu

**Note** that this initialization process is **not recommended** as the majority of new features are exclusively released for Studio workflows.

### Manual SDK authentication

The SDK is authenticated using SDK tokens. As each SDK token must be specific to a given applicant and session, and a new token must be generated each time you initialize the Onfido React Native SDK.

| Parameter | Notes |
|------|------|
| `applicant_id` | **required** <br /> Specifies the applicant for the SDK instance. |
| `application_id` | **required** <br /> The application ID (for iOS "application bundle ID") that was set up during development. For iOS, this is usually in the form `com.your-company.app-name`, or `com.example.yourapp` for Android. Make sure to use a valid `application_id` or you'll receive a 401 error. |

* For iOS, the `application_id` is usually in the form of `com.your-company.app-name`.
* To get this value manually, open Xcode `ios/YourProjectName`, click on the project root, click the General tab, under Targets click your project name, and check the Bundle Identifier field.
* To get this value programmatically in native iOS code, refer to this [Stack Overflow Page](https://stackoverflow.com/questions/8873203/how-to-get-bundle-id).
* For Android, the `application_id` is usually in the form of `com.example.yourapp`.
* To get this file manually, you can find it in your app's `build.config`. For example, in `android/app/build.gradle`, it is the value of `applicationId`.
* To get this value programmatically in native Java code, refer to this [Stack Overflow Page](https://stackoverflow.com/questions/14705874/bundle-id-in-android).

It's important to note that manually generated SDK tokens in React Native expire after **90 minutes** and cannot be renewed. SDK tokens generated in Onfido Studio when creating workflow runs are **not** affected by this limit.

For details on how to manually generate SDK tokens, please refer to the `POST /sdk_token/` endpoint definition in the Onfido [API reference](https://documentation.onfido.com/#generate-sdk-token).

**Note**: You must never use API tokens in the frontend of your application as malicious users could discover them in your source code. You should only use them on your server.

### Manually building the configuration object

You can launch the app with a call to `Onfido.start`, manually defining the verification steps and configurations required for your flow:
Expand Down
2 changes: 2 additions & 0 deletions SampleApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

packagingOptions.resources.excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF"
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions SampleApp/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 32
compileSdkVersion = 34
targetSdkVersion = 34
supportLibVersion = "27.1.0"
kotlinVersion = "1.7.21"

Expand Down
1 change: 0 additions & 1 deletion SampleApp/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m

android.useAndroidX=true
android.enableJetifier=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
6 changes: 3 additions & 3 deletions SampleApp/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jan 04 19:15:03 CET 2022
#Tue Jul 30 16:08:19 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions SampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ PODS:
- ReactCommon/turbomodule/core (= 0.72.6)
- fmt (6.2.1)
- glog (0.3.5)
- Onfido (30.3.0)
- onfido-react-native-sdk (12.2.0):
- Onfido (~> 30.3.0)
- Onfido (30.4.0)
- onfido-react-native-sdk (12.3.0):
- Onfido (~> 30.4.0)
- React
- RCT-Folly (2021.07.22.00):
- boost
Expand Down Expand Up @@ -529,8 +529,8 @@ SPEC CHECKSUMS:
FBReactNativeSpec: 966f29e4e697de53a3b366355e8f57375c856ad9
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
Onfido: f2827394d4b92821cf13007b4fa99094f06e29ed
onfido-react-native-sdk: 00f8fa7ec87f8ae9997d1faae549707220b26807
Onfido: 5715e65965133acfd12676e8a69b1389fac43ca5
onfido-react-native-sdk: bf0ccd95e0ef2faf032f889869eb235eb4f193e7
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: 28469809442eb4eb5528462705f7d852948c8a74
RCTTypeSafety: e9c6c409fca2cc584e5b086862d562540cb38d29
Expand Down
2 changes: 1 addition & 1 deletion SampleApp/yalc.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "v1",
"packages": {
"@onfido/react-native-sdk": {
"signature": "f527247eb7bc33f0842238370ec0eabb",
"signature": "31603b6db695bea0356ea3de1d7c5922",
"file": true
}
}
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
// original location:
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle

def DEFAULT_COMPILE_SDK_VERSION = 33
def DEFAULT_COMPILE_SDK_VERSION = 34
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 31
def NATIVE_ANDROID_SDK_VERSION = "20.5.+"
def DEFAULT_TARGET_SDK_VERSION = 34
def NATIVE_ANDROID_SDK_VERSION = "21.0.+"

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

<meta-data
android:name="onfido_integration_version"
android:value="12.3.0" />
android:value="13.0.0" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
import com.onfido.android.sdk.capture.Onfido;
import com.onfido.android.sdk.capture.OnfidoConfig;
import com.onfido.android.sdk.capture.OnfidoFactory;
import com.onfido.android.sdk.capture.OnfidoTheme;
import com.onfido.android.sdk.capture.config.MediaCallback;
import com.onfido.android.sdk.capture.errors.EnterpriseFeatureNotEnabledException;
import com.onfido.android.sdk.capture.errors.EnterpriseFeaturesInvalidLogoCobrandingException;
import com.onfido.android.sdk.capture.model.NFCOptions;
import com.onfido.android.sdk.capture.ui.camera.face.FaceCaptureStep;
import com.onfido.android.sdk.capture.ui.camera.face.FaceCaptureVariantPhoto;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.FaceCaptureStepBuilder;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.MotionCaptureStepBuilder;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.PhotoCaptureStepBuilder;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.VideoCaptureStepBuilder;
import com.onfido.android.sdk.capture.ui.camera.face.stepbuilder.MotionCaptureStepBuilder;
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;
import com.onfido.android.sdk.capture.OnfidoTheme;
import com.onfido.workflow.OnfidoWorkflow;
import com.onfido.workflow.WorkflowConfig;
import com.onfido.android.sdk.capture.model.NFCOptions;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -177,9 +179,12 @@ private void defaultSDKConfiguration(final ReadableMap config, Activity currentA
}

if (getBooleanFromConfig(config, "disableNFC")) {
onfidoConfigBuilder.disableNFC();
onfidoConfigBuilder.withNFC(NFCOptions.Disabled.INSTANCE);
}

NFCOptions nfcOption = getNFCOptionFromConfig(config);
onfidoConfigBuilder.withNFC(nfcOption);

OnfidoTheme onfidoTheme = getThemeFromConfig(config);
if (onfidoTheme != null) {
onfidoConfigBuilder.withTheme(onfidoTheme);
Expand Down Expand Up @@ -249,6 +254,21 @@ public static OnfidoTheme getThemeFromConfig(final ReadableMap config) throws Ex
return onfidoTheme;
}

public static NFCOptions getNFCOptionFromConfig(final ReadableMap config) {
String nfcOptionString = config.getString("nfcOption");
if (nfcOptionString == null) {
return NFCOptions.Enabled.Optional.INSTANCE;
}
switch (nfcOptionString) {
case "DISABLED":
return NFCOptions.Disabled.INSTANCE;
case "REQUIRED":
return NFCOptions.Enabled.Required.INSTANCE;
default:
return NFCOptions.Enabled.Optional.INSTANCE;
}
}

/*
(!) Please note that flow steps must be presented in a specific order, one which is also
implemented in the native SDKs, as well as in the iOS RN SDK.
Expand Down
15 changes: 14 additions & 1 deletion ios/OnfidoConfigBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ struct OnfidoConfigBuilder {

// NFC
if let disableNFC = config.disableNFC, disableNFC == true {
builder.disableNFC()
builder.withNFC(.off)
}

// Localization
if let localizationFile = try customLocalization(config: config) {
builder.withCustomLocalization(andTableName: localizationFile)
}

builder.withNFC(nfcConfiguration(config: config))

// Media Callback
if let mediaCallBack {
Expand Down Expand Up @@ -228,6 +230,17 @@ struct OnfidoConfigBuilder {
return config.localisation?.stringsFileName
}

// MARK: - NFC Configurations

private func nfcConfiguration(config: OnfidoPluginConfig) -> NFCConfiguration {
let nfcConfigurationMap: [OnfidoNFCOptions?: NFCConfiguration] = [
OnfidoNFCOptions.disabled: .off,
OnfidoNFCOptions.optional: .optional,
OnfidoNFCOptions.required: .required
]
return nfcConfigurationMap[config.nfcOption, default: .optional]
}

// MARK: - Helpers

private func colorFrom(hex: String?, fallback: UIColor) -> UIColor {
Expand Down
7 changes: 7 additions & 0 deletions ios/OnfidoPluginConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct OnfidoPluginConfig: Codable {
let hideLogo: Bool?
let logoCoBrand: Bool?
let disableNFC: Bool?
let nfcOption: OnfidoNFCOptions?
let disableMobileSdkAnalytics: Bool?
}

Expand Down Expand Up @@ -62,6 +63,12 @@ enum OnfidoCaptureType: String, Codable {
case motion = "MOTION"
}

enum OnfidoNFCOptions: String, Codable {
case disabled = "DISABLED"
case optional = "OPTIONAL"
case required = "REQUIRED"
}

struct OnfidoAppearanceConfig: Codable {
let primaryColorHex: String?
let primaryButtonTextColorHex: String?
Expand Down
6 changes: 6 additions & 0 deletions ios/OnfidoSdkTests/OnfidoSdkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down Expand Up @@ -92,6 +93,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down Expand Up @@ -142,6 +144,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down Expand Up @@ -188,6 +191,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down Expand Up @@ -230,6 +234,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down Expand Up @@ -262,6 +267,7 @@ class OnfidoSdkTests : XCTestCase {
hideLogo: nil,
logoCoBrand: nil,
disableNFC: nil,
nfcOption: nil,
disableMobileSdkAnalytics: nil
),
appearance: appearance,
Expand Down
2 changes: 1 addition & 1 deletion ios/PluginMetadata.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ - (instancetype)init
self = [super init];
if (self) {
_pluginPlatform = @"react-native";
_pluginVersion = @"12.3.0";
_pluginVersion = @"13.0.0";
}
return self;
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : Flip
# end

target 'OnfidoSdk' do
pod 'Onfido', '~> 30.3.0'
pod 'Onfido', '~> 30.4.0'

config = use_native_modules!
use_react_native!(
Expand Down
Loading

0 comments on commit 39b92de

Please sign in to comment.