Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 22 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It is private and unavailable until the native DiditAuth integration is ready.
| Platform | Minimum Version | Notes |
|----------|----------------|-------|
| iOS | 13.0+ | NFC passport reading requires iOS 15.0+ |
| Android | API 24+ (7.0) | Kotlin 1.9+, Java 17+ |
| Android | API 24+ (7.0) | Kotlin 2.1.10+, Android Gradle Plugin 8.6.0+, Gradle 8.7+, JDK 17 |

## Permissions

Expand Down Expand Up @@ -93,17 +93,15 @@ You do not need to request camera permission in your app code before calling `st

Workflows can include a **Bank** step (the person links a bank account) and a **Location** step (the device position is read once, with the person's consent). Both screens are drawn by the native SDKs, so this package needs no new API: they run inside `startVerification()` / `startVerificationWithWorkflow()`, and the outcome comes back as the same `VerificationResult`.

> **Development preview:** these steps currently use the native integration source pinned in `diditNativeSdkVersions.source` in `package.json`. Set `DIDIT_SDK_SOURCE_PATH` to a clean checkout at that revision before building either example. A missing or different checkout fails the build instead of substituting the 4.9.1 release, which does not contain these steps. The temporary source pin must move to the released native version before the stacked push and package release.

For Android source builds, apply this package's `android/native-source.gradle` from the host's `settings.gradle`. First run `yarn native:android` to build the pinned native revision with its own Gradle wrapper. The settings script exclusively resolves Didit artifacts from that local Maven repository, preventing a fallback to released artifacts. Both examples already do this; Expo prebuild adds it automatically.

### Bank

No setup. The SDK opens the bank's approval page in the system browser (a Custom Tab on Android, Safari in a sheet on iOS) and checks the result itself when the person comes back, so there is no permission, URL scheme or deep link to register.
No setup. The native SDKs open the bank's page (or a page Didit hosts) in the system browser, so there is no permission, URL scheme or deep link to register.

### Location on iOS

Location lives in the native SDK's optional `DiditSDK/Location` module, which is not included in the `all` variant. Use CocoaPods with `$DiditSdkIosLocationEnabled = true` before `use_native_modules!`, and declare both the selected variant and `DiditSDK/Location` with the same source path. The bare example's Podfile shows this setup. Expo users set `iosLocationEnabled: true` in this package's plugin options and run prebuild. SwiftPM linkage currently cannot opt into Location. Without the module, or without `NSLocationWhenInUseUsageDescription`, the step shows no prompt, reports that the device cannot place the person, and the workflow's own rules decide.
Location ships in the native SDK as complete **Location variants**, not as an add-on: `Core-Location`, `NFC-Location` and `All-Location` for CocoaPods, `DiditSDKCoreLocation`, `DiditSDKNFCLocation` and `DiditSDKLocation` (all with Location) for SwiftPM. Exactly one DiditSDK variant may be declared, so this package picks it for you from your variant: `all` maps to `All-Location`, `core` and `autodetection` map to `Core-Location`, `nfc` maps to `NFC-Location`.

Set `$DiditSdkIosLocationEnabled = true` before `use_native_modules!` (or `DIDIT_SDK_IOS_LOCATION_ENABLED=true`) and keep a single `pod didit_sdk_subspec` line as shown in [React Native CLI](#ios), with the Location mapping. With SwiftPM linkage the same flag selects the Location product and needs no pod line. Expo users set `iosLocationEnabled: true` in this package's plugin options and run prebuild. Without Location enabled, or without `NSLocationWhenInUseUsageDescription`, the step shows no prompt, reports that the device cannot place the person, and the workflow's own rules decide.

Add the purpose strings to `Info.plist`. `NSLocationTemporaryUsageDescriptionDictionary` is optional: it lets the step ask once for precise location when the person granted only an approximate one (iOS 14+), and its key must be exactly `DiditLocationVerification`.

Expand Down Expand Up @@ -175,29 +173,18 @@ A session that still reaches the step then reports the location as unavailable,

## Native SDK Variants

NFC and auto-detection are enabled by default on both platforms.
NFC is enabled by default on both platforms. Automatic capture is available in every variant.

The React Native plugin can install the same native SDK variants exposed by the iOS and Android SDKs:

| Variant | Automatic capture | NFC passport reading | Use when |
|---------|-------------------|----------------------|----------|
| `all` | Yes | Yes | You want the complete SDK (default) |
| `core` | No | No | You only need manual capture and the smallest binary |
| `autodetection` | Yes | No | You need automatic capture without NFC |
| `nfc` | No | Yes | You need NFC passport reading without automatic capture |

### Empirical iOS Sizes
| Variant | NFC passport reading | Use when |
|---------|----------------------|----------|
| `all` | Yes | You want the complete SDK (default) |
| `core` | No | You do not need NFC passport reading |
| `nfc` | Yes | You want the NFC variant |
| `autodetection` | No | Deprecated: identical to `core` |

Measured against the React Native example app using a Release `iphoneos` build with native iOS SDK 4.0.2. `DiditSDK` is linked statically into the app executable, so the app executable is the most useful place to see the SDK's impact. Compressed values are IPA-like zips of the `.app` payload.

| Variant | `.app` bundle | App executable Mach-O | OpenSSL framework | Compressed IPA-like zip |
|---------|--------------:|----------------------:|------------------:|------------------------:|
| `core` | 30.3 MB | 22.1 MB | - | 9.1 MB |
| `autodetection` | 49.4 MB | 41.1 MB | - | 15.2 MB |
| `nfc` | 41.3 MB | 23.1 MB | 9.8 MB | 14.2 MB |
| `all` | 60.3 MB | 42.2 MB | 9.8 MB | 20.3 MB |

When NFC is disabled, you do not need iOS NFC capabilities, NFC entitlements, Android NFC packaging rules, or NFC-related provisioning setup. When auto-detection is disabled, the document and face capture steps fall back to a manual shutter button.
When NFC is disabled, you do not need iOS NFC capabilities, NFC entitlements, Android NFC packaging rules, or NFC-related provisioning setup.

## Installation

Expand Down Expand Up @@ -249,7 +236,7 @@ The iOS podspec URL is derived from the native SDK version this package pins (`d
[
"@didit-protocol/sdk-react-native",
{
"iosPodspecUrl": "https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.9.1/DiditSDK.podspec"
"iosPodspecUrl": "https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.10.0/DiditSDK.podspec"
}
]
```
Expand All @@ -269,7 +256,7 @@ yarn add @didit-protocol/sdk-react-native
Add the DiditSDK pod to your `Podfile` (it's not on CocoaPods trunk). The default native variant is `all`:

```ruby
# Pick one: 'all', 'core', 'autodetection', 'nfc'
# Pick one: 'all', 'core', 'nfc' ('autodetection' is deprecated and identical to 'core')
$DiditSdkIosVariant = 'all'

def max_ios_version(*versions)
Expand All @@ -280,15 +267,17 @@ didit_sdk_ios_deployment_target = ['all', 'nfc'].include?($DiditSdkIosVariant) ?
platform :ios, didit_sdk_ios_deployment_target

# Inside your app target:
# Location ships as complete variants (All-Location, Core-Location, NFC-Location)
$DiditSdkIosLocationEnabled = false # true to enable the Location step
didit_sdk_location_suffix = $DiditSdkIosLocationEnabled ? '-Location' : ''
didit_sdk_subspec = case $DiditSdkIosVariant
when 'all' then 'DiditSDK/All'
when 'core' then 'DiditSDK/Core'
when 'autodetection' then 'DiditSDK/AutoDetection'
when 'nfc' then 'DiditSDK/NFC'
when 'all' then "DiditSDK/All#{didit_sdk_location_suffix}"
when 'core', 'autodetection' then "DiditSDK/Core#{didit_sdk_location_suffix}"
when 'nfc' then "DiditSDK/NFC#{didit_sdk_location_suffix}"
else
raise "Invalid $DiditSdkIosVariant '#{$DiditSdkIosVariant}'. Supported values: all, core, autodetection, nfc."
end
pod didit_sdk_subspec, :podspec => 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.9.1/DiditSDK.podspec'
pod didit_sdk_subspec, :podspec => 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.10.0/DiditSDK.podspec'
```

##### Swift Package Manager (optional)
Expand Down
44 changes: 24 additions & 20 deletions SdkReactNative.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,33 @@ end

didit_sdk_ios_min_version = ["all", "nfc"].include?(didit_sdk_ios_variant) ? max_ios_version.call(min_ios_version_supported, "15.0") : min_ios_version_supported

didit_sdk_subspec = case didit_sdk_ios_variant
when "all" then "DiditSDK/All"
when "core" then "DiditSDK/Core"
when "autodetection" then "DiditSDK/AutoDetection"
when "nfc" then "DiditSDK/NFC"
didit_sdk_ios_location_enabled = (
defined?($DiditSdkIosLocationEnabled) ? $DiditSdkIosLocationEnabled :
ENV.fetch("DIDIT_SDK_IOS_LOCATION_ENABLED", "false").downcase == "true"
)

# Location ships as complete variants, never as an add-on: exactly one DiditSDK
# subspec/product may be declared, or two DiditSDK.xcframeworks get vendored.
# `autodetection` is deprecated and identical to `core` since native 4.10.0, so
# it resolves to Core (and to the Core Location variant with Location).
didit_sdk_location_variant = didit_sdk_ios_variant == "autodetection" ? "core" : didit_sdk_ios_variant
didit_sdk_location_suffix = didit_sdk_ios_location_enabled ? "-Location" : ""
didit_sdk_subspec = case didit_sdk_location_variant
when "all" then "DiditSDK/All#{didit_sdk_location_suffix}"
when "core" then "DiditSDK/Core#{didit_sdk_location_suffix}"
when "nfc" then "DiditSDK/NFC#{didit_sdk_location_suffix}"
else
raise "Invalid DiditSdk iOS variant '#{didit_sdk_ios_variant}'. Set $DiditSdkIosVariant or DIDIT_SDK_IOS_VARIANT to one of: all, core, autodetection, nfc."
end

# The sdk-ios SwiftPM products, one per variant. Same binaries as the
# CocoaPods subspecs above, resolved from the git tag instead of a raw podspec
# URL - see issue #27.
didit_sdk_spm_product = case didit_sdk_ios_variant
when "all" then "DiditSDK"
when "core" then "DiditSDKCore"
when "autodetection" then "DiditSDKAutoDetection"
when "nfc" then "DiditSDKNFC"
didit_sdk_spm_location_suffix = didit_sdk_ios_location_enabled ? "Location" : ""
didit_sdk_spm_product = case didit_sdk_location_variant
when "all" then "DiditSDK#{didit_sdk_spm_location_suffix}"
when "core" then "DiditSDKCore#{didit_sdk_spm_location_suffix}"
when "nfc" then "DiditSDKNFC#{didit_sdk_spm_location_suffix}"
end

# How the native SDK is resolved: "spm" pulls it straight from the sdk-ios
Expand All @@ -59,13 +69,6 @@ didit_sdk_ios_linkage = (
ENV.fetch("DIDIT_SDK_IOS_LINKAGE", "cocoapods")
).downcase

didit_sdk_ios_location_enabled = (
defined?($DiditSdkIosLocationEnabled) ? $DiditSdkIosLocationEnabled :
ENV.fetch("DIDIT_SDK_IOS_LOCATION_ENABLED", "false").downcase == "true"
)
if didit_sdk_ios_location_enabled && didit_sdk_ios_linkage == "spm"
raise "Location requires CocoaPods linkage with the optional DiditSDK/Location subspec."
end
if package.dig("diditNativeSdkVersions", "source")
Pod::Executable.execute_command('node', [File.join(__dir__, 'native-sdk-source.js'), 'ios'])
raise "The pinned native source requires CocoaPods linkage." if didit_sdk_ios_linkage == "spm"
Expand Down Expand Up @@ -106,8 +109,10 @@ Pod::Spec.new do |s|
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/All"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/Core"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/AutoDetection"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/NFC"'
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/NFC"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/Core-Location"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/NFC-Location"',
'"${PODS_XCFRAMEWORKS_BUILD_DIR}/DiditSDK/All-Location"'
].join(" ")
}

Expand All @@ -119,7 +124,6 @@ Pod::Spec.new do |s|
)
else
s.dependency didit_sdk_subspec, didit_sdk_ios_version
s.dependency "DiditSDK/Location", didit_sdk_ios_version if didit_sdk_ios_location_enabled
end

install_modules_dependencies(s)
Expand Down
5 changes: 3 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.SdkReactNative = [
kotlinVersion: "2.0.21",
kotlinVersion: "2.1.20",
minSdkVersion: 24,
compileSdkVersion: 36,
targetSdkVersion: 36
Expand Down Expand Up @@ -65,8 +65,9 @@ switch (diditSdkAndroidVariant) {
case "core":
diditSdkAndroidArtifact = "didit-sdk-core"
break
// Deprecated and identical to core since native 4.10.0 (didit-sdk-autodetection is empty).
case "autodetection":
diditSdkAndroidArtifact = "didit-sdk-autodetection"
diditSdkAndroidArtifact = "didit-sdk-core"
break
case "nfc":
diditSdkAndroidArtifact = "didit-sdk-nfc"
Expand Down
25 changes: 10 additions & 15 deletions app.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,8 @@ function diditPodBlock(iosVariant, options, isRubyExpression = false) {
` $DiditSdkIosLocationEnabled = ${options.iosLocationEnabled}`,
];

if (
options.iosLinkage === 'spm' &&
(options.iosLocationEnabled || pkg.diditNativeSdkVersions.source)
) {
throw new Error(
'Location and native source builds require cocoapods iosLinkage.'
);
if (options.iosLinkage === 'spm' && pkg.diditNativeSdkVersions.source) {
throw new Error('Native source builds require cocoapods iosLinkage.');
}

if (options.iosLinkage === 'spm') {
Expand All @@ -163,12 +158,14 @@ function diditPodBlock(iosVariant, options, isRubyExpression = false) {
return lines.join('\n');
}

// Location ships as complete variants: one subspec, never variant + add-on.
// `autodetection` is deprecated and identical to `core` since native 4.10.0.
lines.push(
" didit_sdk_location_suffix = $DiditSdkIosLocationEnabled ? '-Location' : ''",
' didit_sdk_subspec = case $DiditSdkIosVariant',
" when 'all' then 'DiditSDK/All'",
" when 'core' then 'DiditSDK/Core'",
" when 'autodetection' then 'DiditSDK/AutoDetection'",
" when 'nfc' then 'DiditSDK/NFC'",
' when \'all\' then "DiditSDK/All#{didit_sdk_location_suffix}"',
" when 'core', 'autodetection' then \"DiditSDK/Core#{didit_sdk_location_suffix}\"",
' when \'nfc\' then "DiditSDK/NFC#{didit_sdk_location_suffix}"',
' else',
' raise "Invalid $DiditSdkIosVariant \'#{$DiditSdkIosVariant}\'. Supported values: all, core, autodetection, nfc."',
' end'
Expand All @@ -178,13 +175,11 @@ function diditPodBlock(iosVariant, options, isRubyExpression = false) {
lines.push(
` didit_source_script = Pod::Executable.execute_command('node', ['--print', "require.resolve('@didit-protocol/sdk-react-native/native-sdk-source')"]).strip`,
` didit_source_path = Pod::Executable.execute_command('node', [didit_source_script, 'ios']).strip`,
' pod didit_sdk_subspec, :path => didit_source_path',
" pod 'DiditSDK/Location', :path => didit_source_path if $DiditSdkIosLocationEnabled"
' pod didit_sdk_subspec, :path => didit_source_path'
);
} else {
lines.push(
` pod didit_sdk_subspec, :podspec => '${options.iosPodspecUrl}'`,
` pod 'DiditSDK/Location', :podspec => '${options.iosPodspecUrl}' if $DiditSdkIosLocationEnabled`
` pod didit_sdk_subspec, :podspec => '${options.iosPodspecUrl}'`
);
}

Expand Down
15 changes: 6 additions & 9 deletions example-expo/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,19 @@ platform :ios, podfile_properties['ios.deploymentTarget'] || '15.1'
prepare_react_native_project!

target 'DiditExpoExample' do
# @generated begin didit-sdk-react-native-pod - expo prebuild (DO NOT MODIFY) sync-d257bf333a2351b6f6bdf0abd31a5390f878696b
# @generated begin didit-sdk-react-native-pod - expo prebuild (DO NOT MODIFY) sync-3b2ae22d68929c05112be279a7f6ad8ec7f7db6d
$DiditSdkIosVariant = podfile_properties.fetch('didit.iosVariant', 'all')
$DiditSdkIosLinkage = 'cocoapods'
$DiditSdkIosLocationEnabled = true
didit_sdk_location_suffix = $DiditSdkIosLocationEnabled ? '-Location' : ''
didit_sdk_subspec = case $DiditSdkIosVariant
when 'all' then 'DiditSDK/All'
when 'core' then 'DiditSDK/Core'
when 'autodetection' then 'DiditSDK/AutoDetection'
when 'nfc' then 'DiditSDK/NFC'
when 'all' then "DiditSDK/All#{didit_sdk_location_suffix}"
when 'core', 'autodetection' then "DiditSDK/Core#{didit_sdk_location_suffix}"
when 'nfc' then "DiditSDK/NFC#{didit_sdk_location_suffix}"
else
raise "Invalid $DiditSdkIosVariant '#{$DiditSdkIosVariant}'. Supported values: all, core, autodetection, nfc."
end
didit_source_script = Pod::Executable.execute_command('node', ['--print', "require.resolve('@didit-protocol/sdk-react-native/native-sdk-source')"]).strip
didit_source_path = Pod::Executable.execute_command('node', [didit_source_script, 'ios']).strip
pod didit_sdk_subspec, :path => didit_source_path
pod 'DiditSDK/Location', :path => didit_source_path if $DiditSdkIosLocationEnabled
pod didit_sdk_subspec, :podspec => 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.10.0/DiditSDK.podspec'
# @generated end didit-sdk-react-native-pod
use_expo_modules!

Expand Down
10 changes: 5 additions & 5 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ target 'SdkReactNativeExample' do
else
# Developing against a local sdk-ios checkout still goes through CocoaPods.
$DiditSdkIosLinkage = 'cocoapods'
# Location ships as complete variants: declare exactly one subspec.
didit_sdk_location_suffix = $DiditSdkIosLocationEnabled ? '-Location' : ''
didit_sdk_subspec = case $DiditSdkIosVariant
when 'all' then 'DiditSDK/All'
when 'core' then 'DiditSDK/Core'
when 'autodetection' then 'DiditSDK/AutoDetection'
when 'nfc' then 'DiditSDK/NFC'
when 'all' then "DiditSDK/All#{didit_sdk_location_suffix}"
when 'core', 'autodetection' then "DiditSDK/Core#{didit_sdk_location_suffix}"
when 'nfc' then "DiditSDK/NFC#{didit_sdk_location_suffix}"
else
raise "Invalid $DiditSdkIosVariant '#{$DiditSdkIosVariant}'. Supported values: all, core, autodetection, nfc."
end
pod didit_sdk_subspec, :path => didit_sdk_ios_path
pod 'DiditSDK/Location', :path => didit_sdk_ios_path if $DiditSdkIosLocationEnabled
end

config = use_native_modules!
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"name": "@didit-protocol/sdk-react-native",
"version": "4.9.1",
"version": "4.10.0",
"diditNativeSdkVersions": {
"ios": "4.9.1",
"android": "4.9.1",
"source": {
"branch": "integration/console-v2",
"revision": "88259c3b2ac57520ead46579ee7c1fb56686cdb1"
}
"ios": "4.10.0",
"android": "4.10.0"
},
"description": "React Native wrapper for Didit Identity Verification SDK",
"main": "./lib/commonjs/index.js",
Expand Down
Loading
Loading