@dynamic-labs-sdk/client 1.8.1 → 1.8.2
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/dist/{InvalidParamError-Btv8VGSa.native.esm.js → InvalidParamError-BqFQnYCi.native.esm.js} +23 -10
- package/dist/{InvalidParamError-Btv8VGSa.native.esm.js.map → InvalidParamError-BqFQnYCi.native.esm.js.map} +1 -1
- package/dist/{InvalidParamError-DGBih-LJ.cjs → InvalidParamError-CmwKWCyr.cjs} +24 -11
- package/dist/{InvalidParamError-DGBih-LJ.cjs.map → InvalidParamError-CmwKWCyr.cjs.map} +1 -1
- package/dist/{InvalidParamError-BKnC9rcJ.esm.js → InvalidParamError-c1J0Vmze.esm.js} +23 -10
- package/dist/{InvalidParamError-BKnC9rcJ.esm.js.map → InvalidParamError-c1J0Vmze.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-CRmyVoB3.native.esm.js → NotWaasWalletAccountError-Be0QB89x.native.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-CRmyVoB3.native.esm.js.map → NotWaasWalletAccountError-Be0QB89x.native.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-CHr72wTH.esm.js → NotWaasWalletAccountError-CgwG_c2-.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-CHr72wTH.esm.js.map → NotWaasWalletAccountError-CgwG_c2-.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-i1FozGep.cjs → NotWaasWalletAccountError-DKEpLrGc.cjs} +3 -3
- package/dist/{NotWaasWalletAccountError-i1FozGep.cjs.map → NotWaasWalletAccountError-DKEpLrGc.cjs.map} +1 -1
- package/dist/client/core/createCore/getInitialState.d.ts +1 -1
- package/dist/client/core/createCore/getInitialState.d.ts.map +1 -1
- package/dist/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
- package/dist/client/types/DynamicClient.d.ts +9 -0
- package/dist/client/types/DynamicClient.d.ts.map +1 -1
- package/dist/core.cjs +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/{getNetworkProviderFromNetworkId-CRuh5pgc.esm.js → getNetworkProviderFromNetworkId-CGpE_Y95.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-CRuh5pgc.esm.js.map → getNetworkProviderFromNetworkId-CGpE_Y95.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js → getNetworkProviderFromNetworkId-Cke-DBhx.native.esm.js} +4 -4
- package/dist/{getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js.map → getNetworkProviderFromNetworkId-Cke-DBhx.native.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BdgI7g5U.cjs → getNetworkProviderFromNetworkId-DXzopnuR.cjs} +4 -4
- package/dist/{getNetworkProviderFromNetworkId-BdgI7g5U.cjs.map → getNetworkProviderFromNetworkId-DXzopnuR.cjs.map} +1 -1
- package/dist/{getSignedSessionId-D2w_IRdt.esm.js → getSignedSessionId-C1uLkDjy.esm.js} +3 -3
- package/dist/{getSignedSessionId-D2w_IRdt.esm.js.map → getSignedSessionId-C1uLkDjy.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-S6CBWkOn.native.esm.js → getSignedSessionId-C7YR-jNH.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-S6CBWkOn.native.esm.js.map → getSignedSessionId-C7YR-jNH.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-Cwmt4BkY.cjs → getSignedSessionId-CbWFH_TM.cjs} +3 -3
- package/dist/{getSignedSessionId-Cwmt4BkY.cjs.map → getSignedSessionId-CbWFH_TM.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js → getVerifiedCredentialForWalletAccount-DAmdvMY5.native.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js.map → getVerifiedCredentialForWalletAccount-DAmdvMY5.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js → getVerifiedCredentialForWalletAccount-DPTHL1pO.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js.map → getVerifiedCredentialForWalletAccount-DPTHL1pO.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs → getVerifiedCredentialForWalletAccount-DidFNLGP.cjs} +3 -3
- package/dist/{getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs.map → getVerifiedCredentialForWalletAccount-DidFNLGP.cjs.map} +1 -1
- package/dist/index.cjs +19 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +19 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +19 -7
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-z74isCQ7.cjs → isMfaRequiredForAction-BNipdNF5.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-z74isCQ7.cjs.map → isMfaRequiredForAction-BNipdNF5.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-5p3i98-Z.esm.js → isMfaRequiredForAction-DCwLx4Ik.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-5p3i98-Z.esm.js.map → isMfaRequiredForAction-DCwLx4Ik.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-cmElIVof.native.esm.js → isMfaRequiredForAction-Dx4BPJVg.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-cmElIVof.native.esm.js.map → isMfaRequiredForAction-Dx4BPJVg.native.esm.js.map} +1 -1
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/initializeClient/state.d.ts +9 -0
- package/dist/modules/initializeClient/state.d.ts.map +1 -1
- package/dist/modules/state/raiseStateEvents/events.d.ts +4 -0
- package/dist/modules/state/raiseStateEvents/events.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.d.ts +4 -0
- package/dist/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.d.ts.map +1 -1
- package/dist/utils/getNonce/state.d.ts +5 -0
- package/dist/utils/getNonce/state.d.ts.map +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +3 -3
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.native.esm.js +3 -3
- package/package.json +11 -4
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/android/gradlew +0 -251
- package/android/gradlew.bat +0 -94
- package/android/settings.gradle +0 -30
- package/android/src/test/java/xyz/dynamic/client/keychain/KeyStoreKeyManagerTest.kt +0 -288
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewClientTest.kt +0 -196
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostOpenTest.kt +0 -347
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostTest.kt +0 -171
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewModuleTest.kt +0 -191
- package/react-native.config.cjs +0 -14
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
package xyz.dynamic.client.webview
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.net.Uri
|
|
5
|
-
import android.os.Looper
|
|
6
|
-
import android.webkit.WebView
|
|
7
|
-
import androidx.webkit.JavaScriptReplyProxy
|
|
8
|
-
import androidx.webkit.WebMessageCompat
|
|
9
|
-
import androidx.webkit.WebViewCompat
|
|
10
|
-
import androidx.webkit.WebViewFeature
|
|
11
|
-
import com.facebook.react.bridge.Arguments
|
|
12
|
-
import com.facebook.react.bridge.JavaOnlyArray
|
|
13
|
-
import com.facebook.react.bridge.JavaOnlyMap
|
|
14
|
-
import com.facebook.react.bridge.Promise
|
|
15
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
16
|
-
import com.facebook.react.bridge.ReadableType
|
|
17
|
-
import com.facebook.react.bridge.WritableMap
|
|
18
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
19
|
-
import io.mockk.CapturingSlot
|
|
20
|
-
import io.mockk.Runs
|
|
21
|
-
import io.mockk.every
|
|
22
|
-
import io.mockk.just
|
|
23
|
-
import io.mockk.mockk
|
|
24
|
-
import io.mockk.mockkStatic
|
|
25
|
-
import io.mockk.slot
|
|
26
|
-
import io.mockk.unmockkAll
|
|
27
|
-
import io.mockk.verify
|
|
28
|
-
import org.junit.After
|
|
29
|
-
import org.junit.Assert.assertEquals
|
|
30
|
-
import org.junit.Before
|
|
31
|
-
import org.junit.Test
|
|
32
|
-
import org.junit.runner.RunWith
|
|
33
|
-
import org.robolectric.Robolectric
|
|
34
|
-
import org.robolectric.RobolectricTestRunner
|
|
35
|
-
import org.robolectric.Shadows.shadowOf
|
|
36
|
-
import org.robolectric.annotation.Config
|
|
37
|
-
|
|
38
|
-
// The androidx.webkit + Arguments statics are mocked (they delegate to the
|
|
39
|
-
// device WebView / JNI). A real Robolectric Activity backs WebView construction
|
|
40
|
-
// so open() reaches the live-host state needed to exercise invalidate().
|
|
41
|
-
@RunWith(RobolectricTestRunner::class)
|
|
42
|
-
@Config(sdk = [35])
|
|
43
|
-
class DynamicWebViewModuleTest {
|
|
44
|
-
|
|
45
|
-
private lateinit var activity: Activity
|
|
46
|
-
private lateinit var reactContext: ReactApplicationContext
|
|
47
|
-
private lateinit var module: DynamicWebViewModule
|
|
48
|
-
private lateinit var eventEmitter: RCTDeviceEventEmitter
|
|
49
|
-
private lateinit var webSlot: CapturingSlot<WebView>
|
|
50
|
-
private lateinit var listenerSlot: CapturingSlot<WebViewCompat.WebMessageListener>
|
|
51
|
-
|
|
52
|
-
@Before
|
|
53
|
-
fun setUp() {
|
|
54
|
-
activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
|
55
|
-
reactContext = mockk(relaxed = true)
|
|
56
|
-
every { reactContext.currentActivity } returns activity
|
|
57
|
-
every { reactContext.runOnUiQueueThread(any()) } answers { firstArg<Runnable>().run() }
|
|
58
|
-
|
|
59
|
-
eventEmitter = mockk(relaxed = true)
|
|
60
|
-
every {
|
|
61
|
-
reactContext.getJSModule(RCTDeviceEventEmitter::class.java)
|
|
62
|
-
} returns eventEmitter
|
|
63
|
-
|
|
64
|
-
mockkStatic(Arguments::class)
|
|
65
|
-
every { Arguments.createMap() } answers { JavaOnlyMap() }
|
|
66
|
-
every { Arguments.createArray() } answers { JavaOnlyArray() }
|
|
67
|
-
|
|
68
|
-
mockkStatic(WebViewFeature::class)
|
|
69
|
-
every { WebViewFeature.isFeatureSupported(any()) } returns false
|
|
70
|
-
every {
|
|
71
|
-
WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)
|
|
72
|
-
} returns true
|
|
73
|
-
|
|
74
|
-
mockkStatic(WebViewCompat::class)
|
|
75
|
-
webSlot = slot()
|
|
76
|
-
listenerSlot = slot()
|
|
77
|
-
every {
|
|
78
|
-
WebViewCompat.addWebMessageListener(
|
|
79
|
-
capture(webSlot),
|
|
80
|
-
any(),
|
|
81
|
-
any(),
|
|
82
|
-
capture(listenerSlot),
|
|
83
|
-
)
|
|
84
|
-
} just Runs
|
|
85
|
-
every {
|
|
86
|
-
WebViewCompat.addDocumentStartJavaScript(any(), any(), any())
|
|
87
|
-
} returns mockk(relaxed = true)
|
|
88
|
-
every { WebViewCompat.setProfile(any(), any()) } just Runs
|
|
89
|
-
|
|
90
|
-
module = DynamicWebViewModule(reactContext)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@After
|
|
94
|
-
fun tearDown() {
|
|
95
|
-
unmockkAll()
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
private fun idleMain() = shadowOf(Looper.getMainLooper()).idle()
|
|
99
|
-
|
|
100
|
-
// region invalidate (#12 — ConcurrentModificationException)
|
|
101
|
-
|
|
102
|
-
@Test
|
|
103
|
-
fun invalidate_closesEveryActiveHostWithoutConcurrentModification() {
|
|
104
|
-
val p1 = mockk<Promise>(relaxed = true)
|
|
105
|
-
val p2 = mockk<Promise>(relaxed = true)
|
|
106
|
-
|
|
107
|
-
module.open("a", "https://app.dynamicauth.com/x", p1)
|
|
108
|
-
module.open("b", "https://app.dynamicauth.com/y", p2)
|
|
109
|
-
idleMain() // run the posted opens → two live hosts
|
|
110
|
-
|
|
111
|
-
module.invalidate()
|
|
112
|
-
idleMain() // run the posted close-all; the .toList() snapshot avoids CME
|
|
113
|
-
|
|
114
|
-
// Both hosts torn down (cancelled) proves the iteration completed across
|
|
115
|
-
// >1 host — without the snapshot this throws ConcurrentModificationException.
|
|
116
|
-
verify { p1.reject("webview_cancelled", any<String>(), any<WritableMap>()) }
|
|
117
|
-
verify { p2.reject("webview_cancelled", any<String>(), any<WritableMap>()) }
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// endregion
|
|
121
|
-
|
|
122
|
-
// region emitMessage payload mapping (#13 — array payloads)
|
|
123
|
-
|
|
124
|
-
@Test
|
|
125
|
-
fun putBridgeData_mapsArrayPayloadOntoDataField() {
|
|
126
|
-
val target = JavaOnlyMap()
|
|
127
|
-
putBridgeData(target, JavaOnlyArray().apply { pushString("x") })
|
|
128
|
-
assertEquals(ReadableType.Array, target.getType("data"))
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@Test
|
|
132
|
-
fun putBridgeData_mapsMapStringNullAndUnknownFallthrough() {
|
|
133
|
-
val map = JavaOnlyMap()
|
|
134
|
-
|
|
135
|
-
putBridgeData(map, JavaOnlyMap())
|
|
136
|
-
assertEquals(ReadableType.Map, map.getType("data"))
|
|
137
|
-
|
|
138
|
-
putBridgeData(map, "s")
|
|
139
|
-
assertEquals(ReadableType.String, map.getType("data"))
|
|
140
|
-
|
|
141
|
-
putBridgeData(map, null)
|
|
142
|
-
assertEquals(ReadableType.Null, map.getType("data"))
|
|
143
|
-
|
|
144
|
-
putBridgeData(map, 42)
|
|
145
|
-
assertEquals(ReadableType.Null, map.getType("data"))
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// endregion
|
|
149
|
-
|
|
150
|
-
// region pre-listener event buffering (F4 — handshake not dropped)
|
|
151
|
-
|
|
152
|
-
// Drives a bridge message into the host's WebMessageListener so it flows
|
|
153
|
-
// through onBridgeMessage -> onMessage -> module.emitMessage.
|
|
154
|
-
private fun deliverBridgeMessage(payload: String) {
|
|
155
|
-
listenerSlot.captured.onPostMessage(
|
|
156
|
-
webSlot.captured,
|
|
157
|
-
mockk<WebMessageCompat> { every { data } returns payload },
|
|
158
|
-
Uri.parse("https://app.dynamicauth.com"),
|
|
159
|
-
true,
|
|
160
|
-
mockk<JavaScriptReplyProxy>(relaxed = true),
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@Test
|
|
165
|
-
fun emitMessage_buffersBeforeFirstListenerThenFlushesOnSubscribe() {
|
|
166
|
-
module.open("a", "https://app.dynamicauth.com/x", mockk(relaxed = true))
|
|
167
|
-
idleMain()
|
|
168
|
-
|
|
169
|
-
// Handshake arrives before any JS listener subscribed → must be buffered,
|
|
170
|
-
// not emitted (RCTDeviceEventEmitter.emit would otherwise drop it).
|
|
171
|
-
deliverBridgeMessage("{\"type\":\"iframe-ready\"}")
|
|
172
|
-
verify(exactly = 0) { eventEmitter.emit(any(), any()) }
|
|
173
|
-
|
|
174
|
-
// First subscriber attaches → buffered event flushes.
|
|
175
|
-
module.addListener(DynamicWebViewModule.MESSAGE_EVENT_NAME)
|
|
176
|
-
verify { eventEmitter.emit(DynamicWebViewModule.MESSAGE_EVENT_NAME, any()) }
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@Test
|
|
180
|
-
fun emitMessage_emitsDirectlyAfterListenerAttached() {
|
|
181
|
-
module.open("a", "https://app.dynamicauth.com/x", mockk(relaxed = true))
|
|
182
|
-
idleMain()
|
|
183
|
-
module.addListener(DynamicWebViewModule.MESSAGE_EVENT_NAME)
|
|
184
|
-
|
|
185
|
-
deliverBridgeMessage("{\"type\":\"sign\"}")
|
|
186
|
-
|
|
187
|
-
verify { eventEmitter.emit(DynamicWebViewModule.MESSAGE_EVENT_NAME, any()) }
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// endregion
|
|
191
|
-
}
|
package/react-native.config.cjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
dependency: {
|
|
3
|
-
platforms: {
|
|
4
|
-
ios: {
|
|
5
|
-
podspecPath: `${__dirname}/dynamic-labs-sdk-client.podspec`,
|
|
6
|
-
},
|
|
7
|
-
android: {
|
|
8
|
-
sourceDir: `${__dirname}/android`,
|
|
9
|
-
packageImportPath: 'import xyz.dynamic.client.DynamicClientPackage;',
|
|
10
|
-
packageInstance: 'new DynamicClientPackage()',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|