Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Flutter SDK Release User committed Feb 1, 2023
1 parent 9e4c21f commit 5204006
Show file tree
Hide file tree
Showing 19 changed files with 346 additions and 154 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ 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).

## next-version
## [2.2.0] - 2023-01-27

- Public: Update underlying Onfido native SDK versions:
- Android 15.4.0 (up from 15.3.0)

## [2.1.0] - 2023-01-13

- Public: Added NFC support

## [2.0.0] - 2022-11-25

Expand Down
97 changes: 97 additions & 0 deletions ONFIDO_STUDIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
## 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 Flutter SDK
The Onfido Flutter SDK provides a drop-in set of screens and tools for Flutter 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/flutter-sdk).
## Getting started

The SDK supports:

* Dart 2.12 or higher
* Flutter 1.20 or higher
* Supports iOS 11+
* Supports Android API level 21+
* Supports iPads and tablets


### 1. Add the SDK dependency

#### Using pub.dev
The SDK is available on [pub.dev](https://pub.dev/packages/onfido_sdk/install) and you can include it in your project by running the following script from your project folder:

```shell
flutter pub add onfido_sdk
```

### 2. Update your iOS configuration files
Change `ios/Podfile` to use version 11:
```
platform :ios, '11.0'
```

The SDK uses the device camera. You're required to have the following keys in your application's `ios/Runner/Info.plist` file:
* `NSCameraUsageDescription`
* `NSMicrophoneUsageDescription`

```xml
<key>NSCameraUsageDescription</key>
<string>Required for document and facial capture</string>
<key>NSMicrophoneUsageDescription</key>
<string>Required for video capture</string>
```
**Note**: All keys will be required for app submission.


### 3. 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).

```dart
final Onfido onfido = Onfido(
sdkToken: '<YOUR_SDK_TOKEN>'
);
```

### 4. Start the flow
```dart
await onfido.startWorkflow('<YOUR_WORKFLOW_RUN_ID>');
// listen for the result
```

## Handling callbacks

To receive the result from a completed workflow, you should use async await with try catch, the following code is provided as an example:


```dart
try {
final Onfido onfido = Onfido(
sdkToken: '<YOUR_SDK_TOKEN>'
);
await onfido.startWorkflow('<YOUR_WORKFLOW_RUN_ID>');
// User completed the flow
} catch(error) {
// Error occurred
}
```


| ATTRIBUTE | NOTES |
| ------------- |-------------|
| .success | 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/flutter-sdk#ui-customisation) and [Localization](https://github.com/onfido/flutter-sdk#5-localization).
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ It offers a number of benefits to help you create the best identity verification
- 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 and videos. You still need to access the [Onfido API](https://documentation.onfido.com/) to manage applicants and perform checks.

## Getting started
Expand Down Expand Up @@ -164,6 +169,7 @@ startOnfido() async {
* **`DocumentCapture.countryCode`**: Required if documentType is specified. Valid values in `country_code.dart`.

* **`FlowSteps.faceCapture`**: Optional. In the Face step, a user can use the front camera to capture either a live photo of their face, or a live video. Valid values in `face_capture_type.dart`.
* **`FlowSteps.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)

### 3. Handling responses

Expand Down Expand Up @@ -262,6 +268,34 @@ final Onfido onfido = Onfido(
);
```

## Error handling

The `Error` object returned as part of `PlatformException` which translate the errors from native side to Dart. You can identify the type of the error from the error message

```dart
// This happens if the user denies permission to the SDK during the flow
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), cameraPermission, null)
// This happens when the SDK tries to save capture to disk, maybe due to a lack of space
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), failedToWriteToDisk, null)
// This happens when the user denies permission for microphone usage by the app during the flow
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), microphonePermission, null)
// This happens when the SDK receives an error from an API call see [https://documentation.onfido.com/#errors](https://documentation.onfido.com/#errors) for more information
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), upload, null)
// This happens when an unexpected error occurs. Please contact [ios-sdk@onfido.com](mailto:ios-sdk@onfido.com?Subject=ISSUE%3A) when this happens
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), exception, null)
// This happens when you are using an older version of the iOS SDK and trying to access a new functionality from workflow. You can fix this by updating the SDK
PlatformException(error, The operation couldn’t be completed. (Onfido.OnfidoFlowError error 2.), versionInsufficient, null)
// The flow was exited prematurely by the user. The reason can be `.userExit` or `.consentDenied`
PlatformException(exit, "User canceled the flow", null, null)
```


## Going live

Once you are happy with your integration and are ready to go live, please contact [client-support@onfido.com](mailto:client-support@onfido.com) to obtain live versions of the API token and the mobile SDK token. You will have to replace the sandbox tokens in your code with the live tokens.
Expand All @@ -287,4 +321,4 @@ Previous version of the SDK will be supported for a month after a new major vers
Copyright 2022 Onfido, Ltd. All rights reserved.

### How is the Onfido Flutter SDK licensed?
The Onfido Flutter SDK is available under the MIT license.
The Onfido Flutter SDK is available under the MIT license.
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.onfido.sdk.capture:onfido-capture-sdk:14.0.0"
implementation "com.onfido.sdk.capture:onfido-capture-sdk:15.4.0"
implementation "com.onfido.sdk:onfido-workflow:15.4.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package com.onfido.sdk.flutter

import android.app.Activity
import android.content.Intent
import android.util.Log
import androidx.annotation.NonNull
import com.onfido.android.sdk.capture.ExitCode
import com.onfido.android.sdk.capture.Onfido
import com.onfido.android.sdk.capture.OnfidoFactory
import com.onfido.android.sdk.capture.errors.OnfidoException
import com.onfido.android.sdk.capture.upload.Captures
import com.onfido.android.sdk.workflow.OnfidoWorkflow
import com.onfido.workflow.OnfidoWorkflow
import com.onfido.sdk.flutter.api.FlutterActivityProvider
import com.onfido.sdk.flutter.bridge.BaseMethod
import com.onfido.sdk.flutter.bridge.StartMethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.onfido.sdk.flutter.bridge

import com.onfido.android.sdk.workflow.OnfidoWorkflow
import com.onfido.android.sdk.workflow.WorkflowConfig
import com.onfido.workflow.OnfidoWorkflow
import com.onfido.sdk.flutter.api.FlutterActivityProvider
import com.onfido.sdk.flutter.serializer.deserializeWorkflowConfig
import io.flutter.plugin.common.MethodCall
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ internal fun Any?.deserializeOnfidoBuilder(
steps.add(FlowStep.PROOF_OF_ADDRESS)
}

if (flowSteps["enableNFC"] == true) {
builder.withNFCReadFeature()
}

val captureDocument = flowSteps["documentCapture"] as? Map<*, *>
val docType = (captureDocument?.get("documentType") as? String)
val country = captureDocument?.get("countryCode") as? String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.onfido.sdk.flutter.serializer

import com.onfido.android.sdk.workflow.WorkflowConfig
import com.onfido.workflow.WorkflowConfig

fun Any.deserializeWorkflowConfig(): WorkflowConfig {
if (this !is Map<*, *>) throw Exception("Invalid arguments for start method")
Expand Down
4 changes: 4 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

// 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"
}
13 changes: 13 additions & 0 deletions example/android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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.**
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Flutter (1.0.0)
- Onfido (27.0.0)
- Onfido (27.4.0)
- onfido_sdk (0.0.1):
- Flutter
- Onfido (= 27.0.0)
- Onfido (= 27.4.0)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -21,8 +21,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Onfido: bdbc3ed45598aa106ab2ea021d94e2e28c6b5be3
onfido_sdk: f896f14ed9b1dd5e4e9e60d834e25031bdd057b5
Onfido: e36f284b865adcf99d9c905590a64ac09d4a576b
onfido_sdk: 4e393e51b9b9e57377ca9820c17b1ea4f1dd2f28

PODFILE CHECKSUM: b5c9e6f0565041472ddf8660fd13c905cedfd655

Expand Down
14 changes: 14 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,19 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A0000002472001</string>
<string>00000000000000</string>
<string>D2760000850101</string>
</array>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>12FC</string>
</array>
<key>NFCReaderUsageDescription</key>
<string>Required to read ePassport</string>
</dict>
</plist>
Loading

0 comments on commit 5204006

Please sign in to comment.