react-native-docusign 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +23 -7
- package/android/build.gradle +8 -6
- package/ios/DocuSignManager.swift +33 -33
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Bug fixes
|
|
6
|
+
|
|
7
|
+
- **iOS**: Fix endless "we encountered an error, retrying..." loop in the captive signing UI on the second consecutive attempt within the same install. The signing UI registers a service worker on first visit, and `WKWebsiteDataStore.removeData` was being called with an explicit type set that did not include `WKWebsiteDataTypeServiceWorkerRegistrations` or the fetch cache. The stale service worker survived cookie clearing, app force-close, and even SDK-level logout, then intercepted the next signing WebView's fetch calls with stale cached responses. `clearWebCookiesAsync` now passes `WKWebsiteDataStore.allWebsiteDataTypes()`, which wipes service workers, fetch cache, disk cache, and every other WebKit-persisted data type.
|
|
8
|
+
- **iOS**: Always run the WebKit teardown before `DSMManager.login`, including on the first login of a process. The previous "skip teardown when `hasLoggedIn = false`" optimization assumed a fresh process implies fresh WebKit data; that assumption is wrong because `WKWebsiteDataStore` persists across iOS process kills while the in-memory `hasLoggedIn` flag does not. After a force-close, the next login is treated as "first" by the SDK and would skip the wipe, leaving the previous session's service worker behind.
|
|
9
|
+
|
|
10
|
+
### Build / packaging
|
|
11
|
+
|
|
12
|
+
- **Android**: Switch `sdk-pdf-2.1.4-stripped` import from `flatDir`-based `implementation(name: ..., ext: 'aar')` to a direct `implementation files("$projectDir/libs/sdk-pdf-2.1.4-stripped.aar")`. Gradle 9.0 no longer honors subproject-scoped `flatDir` when resolving across project boundaries, so the stripped AAR (placed by the Config Plugin) was not being found and the build failed with `Could not find :sdk-pdf-2.1.4-stripped:`.
|
|
13
|
+
|
|
3
14
|
## 1.0.3
|
|
4
15
|
|
|
5
16
|
### Build / packaging
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
React Native / Expo native module that wraps the official DocuSign iOS and Android SDKs, allowing apps to present the native DocuSign signing UI directly in-app (captive signing).
|
|
11
11
|
|
|
12
|
-
Built on the Expo Modules API. Works with Expo SDK 55
|
|
12
|
+
Built on the Expo Modules API. Works with Expo SDK 55+ (managed or bare with `expo prebuild`) and Expo Dev Client. Also usable in non-Expo React Native projects after running [`npx install-expo-modules`](https://docs.expo.dev/bare/installing-expo-modules/) to install `expo-modules-core`; in that case, run `expo prebuild` so the Config Plugin can fetch the DocuSign sdk-pdf AAR and inject the iOS / Android build settings, otherwise you must replicate those steps by hand.
|
|
13
13
|
|
|
14
14
|
> **Unofficial package.** This is a community wrapper. It is not affiliated with or endorsed by DocuSign, Inc. "DocuSign" is a trademark of DocuSign, Inc.
|
|
15
15
|
|
|
@@ -109,7 +109,7 @@ The DocuSign native SDKs are **NOT bundled** inside this npm package. They are d
|
|
|
109
109
|
|
|
110
110
|
### Android Glide collision workaround
|
|
111
111
|
|
|
112
|
-
DocuSign's `com.docusign:sdk-pdf:2.1.4` AAR ships a pre-generated `com.bumptech.glide.GeneratedAppGlideModuleImpl.class` that collides at dex time with any other Glide-based library in the host app (notably `expo-image`, `react-native-fast-image`, and similar). To avoid this without redistributing DocuSign's binary, the Expo Config Plugin downloads `sdk-pdf-2.1.4.aar` directly from DocuSign's public Maven during `expo prebuild`, removes the offending class in-memory, and writes the stripped artifact to `node_modules/react-native-docusign/android/libs/`. The existing flatDir injection picks it up at consumer build time. The download is cached after the first run.
|
|
112
|
+
DocuSign's `com.docusign:sdk-pdf:2.1.4` AAR ships a pre-generated `com.bumptech.glide.GeneratedAppGlideModuleImpl.class` that collides at dex time with any other Glide-based library in the host app (notably `expo-image`, `react-native-fast-image`, and similar). To avoid this without redistributing DocuSign's binary, the Expo Config Plugin downloads `sdk-pdf-2.1.4.aar` directly from DocuSign's public Maven during `expo prebuild`, verifies its SHA-256 against a pinned hash, removes the offending class from the AAR's `classes.jar` in-memory, and writes the stripped artifact to `node_modules/react-native-docusign/android/libs/`. The existing flatDir injection picks it up at consumer build time. The download is cached after the first run; corrupted or partial caches are detected and regenerated. SHA mismatch or fetch failure aborts `expo prebuild` with an actionable error rather than silently letting the Android build fail later at the dex step.
|
|
113
113
|
|
|
114
114
|
### What ships inside this package
|
|
115
115
|
|
|
@@ -720,7 +720,7 @@ The module rejects promises with coded exceptions you can inspect at the call si
|
|
|
720
720
|
| Error code | When | Mitigation |
|
|
721
721
|
| ------------------- | --------------------------------------------- | -------------------------------------------------------------- |
|
|
722
722
|
| `initialize_failed` | SDK failed to configure | Check integrator key and network connectivity |
|
|
723
|
-
| `login_failed` | Access token
|
|
723
|
+
| `login_failed` | Access token rejected, or Keychain misconfigured (iOS) | Fetch a fresh token from your backend; on iOS also verify `AppIdentifierPrefix` is set in `Info.plist` (see [Permissions](#permissions)) |
|
|
724
724
|
| `signing_failed` | SDK failed to present or complete signing | Check envelope ID, recipient info, SDK login state |
|
|
725
725
|
| `not_initialized` | `initialize()` was not called first | Call `initialize()` before any other method |
|
|
726
726
|
| `not_logged_in` | `loginWithAccessToken()` was not called first | Call `loginWithAccessToken()` before `presentCaptiveSigning()` |
|
|
@@ -756,10 +756,11 @@ try {
|
|
|
756
756
|
|
|
757
757
|
The config plugin writes these keys automatically, or you can configure them manually:
|
|
758
758
|
|
|
759
|
-
| Key | Purpose
|
|
760
|
-
| -------------------------------- |
|
|
761
|
-
| `NSCameraUsageDescription` | Required when users capture signatures or attach photos via camera
|
|
762
|
-
| `NSPhotoLibraryUsageDescription` | Required when users attach photos from the photo library
|
|
759
|
+
| Key | Purpose |
|
|
760
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
761
|
+
| `NSCameraUsageDescription` | Required when users capture signatures or attach photos via camera |
|
|
762
|
+
| `NSPhotoLibraryUsageDescription` | Required when users attach photos from the photo library |
|
|
763
|
+
| `AppIdentifierPrefix` | **Required.** Enables the DocuSign iOS SDK to store auth tokens in the Apple Keychain. Without this key, `loginWithAccessToken` fails with `login_failed / unauthorized` even when the token is valid. Set to `$(AppIdentifierPrefix)`; Xcode resolves this to your team ID prefix at build time. |
|
|
763
764
|
|
|
764
765
|
### Android `AndroidManifest.xml`
|
|
765
766
|
|
|
@@ -799,6 +800,21 @@ The SDK login state is in-memory and does not survive app restarts. Always call
|
|
|
799
800
|
|
|
800
801
|
DocuSign access tokens are valid for about 1 hour. If a token expires while the signing UI is open, the SDK emits an error event and the promise rejects. Catch the error, fetch a fresh session from your backend, and retry.
|
|
801
802
|
|
|
803
|
+
### `login_failed` on iOS even with a valid token
|
|
804
|
+
|
|
805
|
+
If `loginWithAccessToken` rejects with `login_failed` (or the SDK logs "unauthorized") but the same token works on Android, the most likely cause is a missing `AppIdentifierPrefix` entry in your `Info.plist`.
|
|
806
|
+
|
|
807
|
+
The DocuSign iOS SDK uses the Apple Keychain to store auth state. Without `AppIdentifierPrefix`, it cannot access the Keychain group and rejects the login at the SDK level, regardless of token validity.
|
|
808
|
+
|
|
809
|
+
**Fix:** add this entry to your `Info.plist` (or to `ios.infoPlist` in `app.config.ts` for Expo projects):
|
|
810
|
+
|
|
811
|
+
```xml
|
|
812
|
+
<key>AppIdentifierPrefix</key>
|
|
813
|
+
<string>$(AppIdentifierPrefix)</string>
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
Xcode resolves `$(AppIdentifierPrefix)` to your Apple Developer team ID prefix at build time. A native rebuild (`expo prebuild` + `expo run:ios`) is required after adding the key.
|
|
817
|
+
|
|
802
818
|
### Signing UI does not appear on iOS
|
|
803
819
|
|
|
804
820
|
The SDK presents its UI on the topmost view controller. If you are presenting from within a modal, the module walks the presented view controller chain. If signing still does not appear, call `presentCaptiveSigning()` after any existing modals have been dismissed.
|
package/android/build.gradle
CHANGED
|
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|
|
2
2
|
apply plugin: 'kotlin-android'
|
|
3
3
|
|
|
4
4
|
group = 'expo.modules.docusign'
|
|
5
|
-
version = '1.0.
|
|
5
|
+
version = '1.0.4'
|
|
6
6
|
|
|
7
7
|
buildscript {
|
|
8
8
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -41,7 +41,7 @@ android {
|
|
|
41
41
|
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
42
42
|
targetSdkVersion safeExtGet("targetSdkVersion", 35)
|
|
43
43
|
versionCode 1
|
|
44
|
-
versionName "1.0.
|
|
44
|
+
versionName "1.0.4"
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
buildFeatures {
|
|
@@ -58,9 +58,6 @@ repositories {
|
|
|
58
58
|
maven {
|
|
59
59
|
url "https://docucdn-a.akamaihd.net/prod/docusignandroidsdk"
|
|
60
60
|
}
|
|
61
|
-
flatDir {
|
|
62
|
-
dirs "$projectDir/libs"
|
|
63
|
-
}
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
dependencies {
|
|
@@ -77,5 +74,10 @@ dependencies {
|
|
|
77
74
|
exclude group: 'com.docusign', module: 'sdk-pdf'
|
|
78
75
|
}
|
|
79
76
|
implementation 'com.docusign:sdk-common:2.1.4'
|
|
80
|
-
|
|
77
|
+
// Direct file reference instead of flatDir (name:..., ext:...). Gradle 9.0 no
|
|
78
|
+
// longer honors subproject-scoped flatDir when resolving across project
|
|
79
|
+
// boundaries, so the stripped AAR (placed at libs/sdk-pdf-2.1.4-stripped.aar
|
|
80
|
+
// by the config plugin) wasn't found and the build failed with
|
|
81
|
+
// "Could not find :sdk-pdf-2.1.4-stripped:".
|
|
82
|
+
implementation files("$projectDir/libs/sdk-pdf-2.1.4-stripped.aar")
|
|
81
83
|
}
|
|
@@ -205,28 +205,17 @@ internal final class DocuSignManager: NSObject {
|
|
|
205
205
|
? Date(timeIntervalSinceNow: TimeInterval(expiresIn))
|
|
206
206
|
: nil
|
|
207
207
|
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
userId: userId,
|
|
220
|
-
userName: userName,
|
|
221
|
-
email: email,
|
|
222
|
-
effectiveHost: effectiveHost,
|
|
223
|
-
integratorKey: integratorKey,
|
|
224
|
-
expiryDate: expiryDate,
|
|
225
|
-
completion: completion
|
|
226
|
-
)
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
|
|
208
|
+
// Always tear down WebKit data + DocuSign auth before DSMManager.login.
|
|
209
|
+
// Earlier versions skipped this on first login (when hasLoggedIn=false) on the
|
|
210
|
+
// assumption that a fresh launch implies fresh WebKit data. That assumption is
|
|
211
|
+
// wrong: WKWebsiteDataStore persists across process kills, so a second launch
|
|
212
|
+
// after a force-close still carries the previous session's WebKit state — most
|
|
213
|
+
// critically, the DocuSign signing UI's service worker registration. Without
|
|
214
|
+
// a wipe, that stale service worker intercepts fetch calls inside the next
|
|
215
|
+
// signing WebView and produces an endless "we encountered an error, retrying..."
|
|
216
|
+
// loop even though the new envelope and tokens are valid. The teardown is
|
|
217
|
+
// sequenced via WKWebsiteDataStore.removeData completion before DSMManager.login
|
|
218
|
+
// is invoked, so there is no race with the WebView session bootstrap.
|
|
230
219
|
clearWebCookiesAsync { [weak self] in
|
|
231
220
|
guard let self = self else { return }
|
|
232
221
|
_ = DSMManager.logout()
|
|
@@ -308,20 +297,31 @@ internal final class DocuSignManager: NSObject {
|
|
|
308
297
|
}
|
|
309
298
|
}
|
|
310
299
|
|
|
311
|
-
/// Clears DocuSign SDK cookies plus
|
|
312
|
-
///
|
|
313
|
-
///
|
|
314
|
-
///
|
|
315
|
-
///
|
|
300
|
+
/// Clears DocuSign SDK cookies plus all WKWebsiteDataStore data and invokes
|
|
301
|
+
/// `completion` on the main thread once teardown is complete. The DocuSign SDK's
|
|
302
|
+
/// `clearAllWebCookies` has no completion handler, so we layer
|
|
303
|
+
/// `WKWebsiteDataStore.removeData` on top to obtain a real signal that teardown
|
|
304
|
+
/// finished before re-logging in.
|
|
305
|
+
///
|
|
306
|
+
/// We pass `WKWebsiteDataStore.allWebsiteDataTypes()` rather than an explicit
|
|
307
|
+
/// subset because the DocuSign signing UI registers a service worker on first
|
|
308
|
+
/// visit, and service worker registrations + the fetch cache are stored
|
|
309
|
+
/// separately from cookies/localStorage/IndexedDB. Clearing only the common
|
|
310
|
+
/// subset leaves the SW behind on disk, which then intercepts the next signing
|
|
311
|
+
/// WebView's fetch calls with stale cached responses.
|
|
312
|
+
///
|
|
313
|
+
/// Note: this wipes the **default** `WKWebsiteDataStore`, which is shared by
|
|
314
|
+
/// every WKWebView in the host process that does not specify a private or
|
|
315
|
+
/// non-persistent configuration. Host apps that use WKWebView for other
|
|
316
|
+
/// content (OAuth flows, in-app browsers, help centers) will have those
|
|
317
|
+
/// WebViews' cookies, caches, and service workers cleared whenever
|
|
318
|
+
/// `loginWithAccessToken` runs. If you need to isolate DocuSign's WebKit
|
|
319
|
+
/// state from the rest of your app, use a non-default data store for those
|
|
320
|
+
/// other WebViews.
|
|
316
321
|
private func clearWebCookiesAsync(completion: @escaping () -> Void) {
|
|
317
322
|
DSMManager.clearAllWebCookies()
|
|
318
323
|
let dataStore = WKWebsiteDataStore.default()
|
|
319
|
-
let types
|
|
320
|
-
WKWebsiteDataTypeCookies,
|
|
321
|
-
WKWebsiteDataTypeSessionStorage,
|
|
322
|
-
WKWebsiteDataTypeLocalStorage,
|
|
323
|
-
WKWebsiteDataTypeIndexedDBDatabases
|
|
324
|
-
]
|
|
324
|
+
let types = WKWebsiteDataStore.allWebsiteDataTypes()
|
|
325
325
|
let since = Date(timeIntervalSince1970: 0)
|
|
326
326
|
dataStore.removeData(ofTypes: types, modifiedSince: since) {
|
|
327
327
|
DispatchQueue.main.async { completion() }
|
package/package.json
CHANGED