@dynamic-labs/react-native-extension 4.83.0 → 4.83.1

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.
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
@@ -39,7 +39,13 @@ class KeyStoreKeyManager {
39
39
  }
40
40
 
41
41
  fun generateKeyPair(alias: String): String {
42
- require(!hasKey(alias)) { "Key already exists for alias: $alias" }
42
+
43
+ // Defensive: if alias somehow exists, clean it up before generating.
44
+ // Matches iOS Secure Enclave's permissive overwrite semantics and keeps
45
+ // the function single-call atomic so callers don't need to pre-delete.
46
+ if (hasKey(alias)) {
47
+ deleteKey(alias)
48
+ }
43
49
 
44
50
  val specBuilder = KeyGenParameterSpec.Builder(
45
51
  alias,
package/index.cjs CHANGED
@@ -34,7 +34,7 @@ function _interopNamespace(e) {
34
34
  return Object.freeze(n);
35
35
  }
36
36
 
37
- var version = "4.83.0";
37
+ var version = "4.83.1";
38
38
 
39
39
  function _extends() {
40
40
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -47,8 +47,9 @@ function _extends() {
47
47
  }
48
48
 
49
49
  class WebViewFailedToLoadError extends Error {
50
- constructor() {
50
+ constructor(meta) {
51
51
  super('Could not load Dynamic WebView');
52
+ this.meta = meta;
52
53
  }
53
54
  }
54
55
 
@@ -322,13 +323,15 @@ const shouldAllowNavigation = (request, webViewUrl) => {
322
323
  return false;
323
324
  };
324
325
 
326
+ const DEFAULT_RECOVERY_TIMEOUT_MS = 20000;
327
+ const DEFAULT_LOADING_TIMEOUT_MS = 20000;
325
328
  const WebView = ({
326
329
  webviewUrl: initialWebViewUrl,
327
330
  core,
328
331
  webviewDebuggingEnabled: _webviewDebuggingEnabled = false,
329
332
  disableRecovery: _disableRecovery = false,
330
- recoveryTimeout: _recoveryTimeout = 8000,
331
- loadingTimeout: _loadingTimeout = 10000
333
+ recoveryTimeout: _recoveryTimeout = DEFAULT_RECOVERY_TIMEOUT_MS,
334
+ loadingTimeout: _loadingTimeout = DEFAULT_LOADING_TIMEOUT_MS
332
335
  }) => {
333
336
  const webViewRef = react.useRef(null);
334
337
  const {
package/index.js CHANGED
@@ -12,7 +12,7 @@ import { openAuthSessionAsync } from 'expo-web-browser';
12
12
  import { getItemAsync, deleteItemAsync, setItemAsync } from 'expo-secure-store';
13
13
  import { createPasskey, PasskeyStamper } from '@turnkey/react-native-passkey-stamper';
14
14
 
15
- var version = "4.83.0";
15
+ var version = "4.83.1";
16
16
 
17
17
  function _extends() {
18
18
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -25,8 +25,9 @@ function _extends() {
25
25
  }
26
26
 
27
27
  class WebViewFailedToLoadError extends Error {
28
- constructor() {
28
+ constructor(meta) {
29
29
  super('Could not load Dynamic WebView');
30
+ this.meta = meta;
30
31
  }
31
32
  }
32
33
 
@@ -300,13 +301,15 @@ const shouldAllowNavigation = (request, webViewUrl) => {
300
301
  return false;
301
302
  };
302
303
 
304
+ const DEFAULT_RECOVERY_TIMEOUT_MS = 20000;
305
+ const DEFAULT_LOADING_TIMEOUT_MS = 20000;
303
306
  const WebView = ({
304
307
  webviewUrl: initialWebViewUrl,
305
308
  core,
306
309
  webviewDebuggingEnabled: _webviewDebuggingEnabled = false,
307
310
  disableRecovery: _disableRecovery = false,
308
- recoveryTimeout: _recoveryTimeout = 8000,
309
- loadingTimeout: _loadingTimeout = 10000
311
+ recoveryTimeout: _recoveryTimeout = DEFAULT_RECOVERY_TIMEOUT_MS,
312
+ loadingTimeout: _loadingTimeout = DEFAULT_LOADING_TIMEOUT_MS
310
313
  }) => {
311
314
  const webViewRef = useRef(null);
312
315
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/react-native-extension",
3
- "version": "4.83.0",
3
+ "version": "4.83.1",
4
4
  "main": "./index.cjs",
5
5
  "module": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -18,11 +18,11 @@
18
18
  "@turnkey/react-native-passkey-stamper": "1.2.7",
19
19
  "@react-native-documents/picker": "^11.0.0",
20
20
  "react-native-fs": ">=2.20.0",
21
- "@dynamic-labs/assert-package-version": "4.83.0",
22
- "@dynamic-labs/client": "4.83.0",
23
- "@dynamic-labs/logger": "4.83.0",
24
- "@dynamic-labs/message-transport": "4.83.0",
25
- "@dynamic-labs/webview-messages": "4.83.0"
21
+ "@dynamic-labs/assert-package-version": "4.83.1",
22
+ "@dynamic-labs/client": "4.83.1",
23
+ "@dynamic-labs/logger": "4.83.1",
24
+ "@dynamic-labs/message-transport": "4.83.1",
25
+ "@dynamic-labs/webview-messages": "4.83.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=18.0.0 <20.0.0",
@@ -1,3 +1,86 @@
1
+ /**
2
+ * Categorical phase the WebView was in when the failure was raised.
3
+ *
4
+ * Use this for high-level grouping; the duration fields on
5
+ * {@link WebViewFailedToLoadErrorMeta} give the granular timing data.
6
+ */
7
+ export type WebViewFailedToLoadErrorPhase = 'html_load' | 'sdk_bootstrap' | 'after_clear_state' | 'native_error' | 'embedded_native_error' | 'unknown';
8
+ /**
9
+ * Structured context attached to {@link WebViewFailedToLoadError} so the
10
+ * resulting error log carries enough information to tell *which* step the
11
+ * WebView was stuck in when the failure was raised, and how long each step
12
+ * took.
13
+ *
14
+ * The setter on `InitializationModule.error` forwards this object directly
15
+ * to `logger.error`, so every field below ends up as a structured field on
16
+ * the same Datadog log as the error message.
17
+ */
18
+ export type WebViewFailedToLoadErrorMeta = {
19
+ phase: WebViewFailedToLoadErrorPhase;
20
+ /**
21
+ * Milliseconds between RN's `onLoadStart` and `onLoad` callbacks (the
22
+ * HTML + asset fetch). `null` if `onLoad` never fired.
23
+ */
24
+ htmlLoadMs: number | null;
25
+ /**
26
+ * Milliseconds between RN's `onLoad` and `onLoadEnd` callbacks. Usually
27
+ * small; mostly there to flag pathological cases. `null` if `onLoadEnd`
28
+ * never fired.
29
+ */
30
+ onLoadToOnLoadEndMs: number | null;
31
+ /**
32
+ * Milliseconds between `onLoadEnd` and the first `manifest` request
33
+ * received from the webview-side SDK. Proxy for "the JS bundle is alive
34
+ * and the message bridge works". `null` if the manifest request never
35
+ * arrived.
36
+ */
37
+ manifestReceivedMs: number | null;
38
+ /**
39
+ * Milliseconds between `onLoadEnd` and the webview-side SDK signalling
40
+ * it has finished initialising (via the `sdkHasLoadedEventName` store
41
+ * change). `null` if the SDK never signalled it was ready.
42
+ */
43
+ sdkReadyMs: number | null;
44
+ /**
45
+ * Number of `retry` increments in the WebView URL at the time of failure
46
+ * (covers OS-kill reloads, load_error reloads, and recovery reloads).
47
+ */
48
+ retryCount: number;
49
+ /**
50
+ * Whether the `clear-state` query parameter was present in the URL when
51
+ * the failure was raised. `true` indicates we already retried with a
52
+ * clean state and still couldn't finish loading.
53
+ */
54
+ hadClearState: boolean;
55
+ /**
56
+ * Number of times RN's `onError` fired across the lifetime of the
57
+ * WebView component instance.
58
+ */
59
+ nativeErrorCount: number;
60
+ /**
61
+ * Number of times the OS killed the WebView process (via
62
+ * `onContentProcessDidTerminate` on iOS or `onRenderProcessGone` on
63
+ * Android) across the lifetime of the WebView component instance.
64
+ */
65
+ osKillCount: number;
66
+ /** The configured value for `loadingTimeout` (ms). */
67
+ loadingTimeoutMs: number;
68
+ /** The configured value for `recoveryTimeout` (ms). */
69
+ recoveryTimeoutMs: number;
70
+ /** The URL the WebView was attempting to load when the failure occurred. */
71
+ webviewUrl?: string;
72
+ /**
73
+ * Native error info, only populated when the failure originated from the
74
+ * embedded native WebView path (iOS WKWebView / Android WebView), where
75
+ * we get a single `onLoadError` event with these fields.
76
+ */
77
+ nativeErrorCode?: number;
78
+ nativeErrorDescription?: string;
79
+ nativeErrorDomain?: string;
80
+ nativeErrorIsProvisional?: boolean;
81
+ nativeErrorFailedUrl?: string;
82
+ };
1
83
  export declare class WebViewFailedToLoadError extends Error {
2
- constructor();
84
+ readonly meta?: WebViewFailedToLoadErrorMeta;
85
+ constructor(meta?: WebViewFailedToLoadErrorMeta);
3
86
  }