@dynamic-labs-sdk/client 1.7.0 → 1.8.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.
- package/android/build.gradle +231 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +8 -0
- package/android/gradlew +251 -0
- package/android/gradlew.bat +94 -0
- package/android/settings.gradle +30 -0
- package/android/src/main/java/xyz/dynamic/client/DynamicClientPackage.kt +52 -0
- package/android/src/main/java/xyz/dynamic/client/keychain/KeyStoreKeyManager.kt +147 -0
- package/android/src/main/java/xyz/dynamic/client/keychain/KeychainModule.kt +85 -0
- package/android/src/main/java/xyz/dynamic/client/manifest/ReactNativeManifestModule.kt +25 -0
- package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewClient.kt +83 -0
- package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewHost.kt +518 -0
- package/android/src/main/java/xyz/dynamic/client/webview/DynamicWebViewModule.kt +147 -0
- package/android/src/test/java/xyz/dynamic/client/keychain/KeyStoreKeyManagerTest.kt +288 -0
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewClientTest.kt +196 -0
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostOpenTest.kt +347 -0
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewHostTest.kt +171 -0
- package/android/src/test/java/xyz/dynamic/client/webview/DynamicWebViewModuleTest.kt +191 -0
- package/dist/{InvalidParamError-Crwntjl7.native.esm.js → InvalidParamError-BKnC9rcJ.esm.js} +441 -10
- package/dist/InvalidParamError-BKnC9rcJ.esm.js.map +1 -0
- package/dist/{InvalidParamError-fQLJaGBW.esm.js → InvalidParamError-Btv8VGSa.native.esm.js} +3 -3
- package/dist/InvalidParamError-Btv8VGSa.native.esm.js.map +1 -0
- package/dist/{InvalidParamError-CTssOe86.cjs → InvalidParamError-DGBih-LJ.cjs} +550 -4
- package/dist/InvalidParamError-DGBih-LJ.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-DF_S7gqo.esm.js → NotWaasWalletAccountError-CHr72wTH.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DF_S7gqo.esm.js.map → NotWaasWalletAccountError-CHr72wTH.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-BJLGGYmU.native.esm.js → NotWaasWalletAccountError-CRmyVoB3.native.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-BJLGGYmU.native.esm.js.map → NotWaasWalletAccountError-CRmyVoB3.native.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-2RaDipZu.cjs → NotWaasWalletAccountError-i1FozGep.cjs} +3 -3
- package/dist/{NotWaasWalletAccountError-2RaDipZu.cjs.map → NotWaasWalletAccountError-i1FozGep.cjs.map} +1 -1
- package/dist/core.cjs +23 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +7 -7
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/WebViewLoadFailedError.d.ts +1 -1
- package/dist/errors/WebViewLoadFailedError.d.ts.map +1 -1
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-C1p9Rrg3.cjs → getNetworkProviderFromNetworkId-BdgI7g5U.cjs} +11 -317
- package/dist/getNetworkProviderFromNetworkId-BdgI7g5U.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js → getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js} +6 -6
- package/dist/getNetworkProviderFromNetworkId-Bm41knUq.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BWhaD23J.esm.js → getNetworkProviderFromNetworkId-CRuh5pgc.esm.js} +4 -242
- package/dist/getNetworkProviderFromNetworkId-CRuh5pgc.esm.js.map +1 -0
- package/dist/{getSignedSessionId-CxxYNC_8.cjs → getSignedSessionId-Cwmt4BkY.cjs} +3 -3
- package/dist/{getSignedSessionId-CxxYNC_8.cjs.map → getSignedSessionId-Cwmt4BkY.cjs.map} +1 -1
- package/dist/{getSignedSessionId-c7dS4PQ9.esm.js → getSignedSessionId-D2w_IRdt.esm.js} +3 -3
- package/dist/{getSignedSessionId-c7dS4PQ9.esm.js.map → getSignedSessionId-D2w_IRdt.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DPOXdh6y.native.esm.js → getSignedSessionId-S6CBWkOn.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-DPOXdh6y.native.esm.js.map → getSignedSessionId-S6CBWkOn.native.esm.js.map} +1 -1
- package/dist/getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs +347 -0
- package/dist/getVerifiedCredentialForWalletAccount-CDuP1kaI.cjs.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-Cahp763h.esm.js → getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js.map → getVerifiedCredentialForWalletAccount-D33r7Drd.native.esm.js.map} +1 -1
- package/dist/getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js +269 -0
- package/dist/getVerifiedCredentialForWalletAccount-QwfkKHfr.esm.js.map +1 -0
- package/dist/index.cjs +67 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +5 -5
- package/dist/index.native.esm.js.map +1 -1
- package/dist/isMfaRequiredForAction-5p3i98-Z.esm.js +318 -0
- package/dist/isMfaRequiredForAction-5p3i98-Z.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-D8G5PBAd.native.esm.js → isMfaRequiredForAction-cmElIVof.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-D8G5PBAd.native.esm.js.map → isMfaRequiredForAction-cmElIVof.native.esm.js.map} +1 -1
- package/dist/isMfaRequiredForAction-z74isCQ7.cjs +405 -0
- package/dist/isMfaRequiredForAction-z74isCQ7.cjs.map +1 -0
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
- package/dist/modules/waas/createWaasClient/translateNativeOpenError.d.ts.map +1 -1
- package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts +1 -2
- package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs +9 -9
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +8 -5
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +8 -4
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +9 -8
- package/dist/waasCore.native.esm.js.map +1 -1
- package/dynamic-labs-sdk-client.podspec +27 -0
- package/ios/DynamicClientKeychain.h +4 -0
- package/ios/DynamicClientKeychain.mm +101 -0
- package/ios/DynamicClientManifest.h +4 -0
- package/ios/DynamicClientManifest.mm +45 -0
- package/ios/DynamicClientWebView.h +5 -0
- package/ios/DynamicClientWebView.mm +143 -0
- package/ios/DynamicWebViewImpl.swift +603 -0
- package/ios/LiveSecKeyAPI.swift +86 -0
- package/ios/ReactNativeManifestImpl.swift +20 -0
- package/ios/SecKeyAPI.swift +57 -0
- package/ios/SecureEnclaveKeyManager.swift +191 -0
- package/package.json +14 -5
- package/react-native.config.cjs +14 -0
- package/src/turboModules/NativeDynamicWebView.native.spec.ts +61 -0
- package/src/turboModules/NativeDynamicWebView.ts +40 -0
- package/src/turboModules/NativeKeychain.native.spec.ts +47 -0
- package/src/turboModules/NativeKeychain.ts +19 -0
- package/src/turboModules/NativeReactNativeManifest.native.spec.ts +55 -0
- package/src/turboModules/NativeReactNativeManifest.ts +28 -0
- package/dist/InvalidParamError-CTssOe86.cjs.map +0 -1
- package/dist/InvalidParamError-Crwntjl7.native.esm.js.map +0 -1
- package/dist/InvalidParamError-fQLJaGBW.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BCSmILlH.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BWhaD23J.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-C1p9Rrg3.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-Cahp763h.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs +0 -887
- package/dist/getVerifiedCredentialForWalletAccount-Di8dM5Wx.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-DuNbORNW.native.esm.js +0 -701
- package/dist/isMfaRequiredForAction-BjRvPrU6.esm.js +0 -79
- package/dist/isMfaRequiredForAction-BjRvPrU6.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-hlhj0qAC.cjs +0 -96
- package/dist/isMfaRequiredForAction-hlhj0qAC.cjs.map +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#import "DynamicClientWebView.h"
|
|
2
|
+
#import <React/RCTBridgeModule.h>
|
|
3
|
+
#import <React/RCTEventEmitter.h>
|
|
4
|
+
#import <DynamicClientSpec/DynamicClientSpec.h>
|
|
5
|
+
#if __has_include(<dynamic_labs_sdk_client/dynamic_labs_sdk_client-Swift.h>)
|
|
6
|
+
#import <dynamic_labs_sdk_client/dynamic_labs_sdk_client-Swift.h>
|
|
7
|
+
#else
|
|
8
|
+
#import "dynamic_labs_sdk_client-Swift.h"
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
static NSString *const kMessageEventName = @"dynamicBridgeMessage";
|
|
12
|
+
|
|
13
|
+
@interface DynamicClientWebView () <NativeDynamicWebViewSpec, DynamicWebViewImplDelegate> {
|
|
14
|
+
DynamicWebViewImpl *_impl;
|
|
15
|
+
BOOL _hasListeners;
|
|
16
|
+
// Messages that arrived before JS attached its listener (e.g. the
|
|
17
|
+
// iframe-ready handshake posted between `open` resolving and `onMessage`
|
|
18
|
+
// subscribing). Flushed in order on startObserving so the handshake is not
|
|
19
|
+
// lost. Accessed from two queues — the WKScriptMessageHandler callback runs
|
|
20
|
+
// on the main thread while startObserving/stopObserving run on the
|
|
21
|
+
// RCTEventEmitter method queue — so all access is serialized with
|
|
22
|
+
// @synchronized(self).
|
|
23
|
+
NSMutableArray<NSDictionary *> *_bufferedEvents;
|
|
24
|
+
}
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
@implementation DynamicClientWebView
|
|
28
|
+
|
|
29
|
+
RCT_EXPORT_MODULE()
|
|
30
|
+
|
|
31
|
+
- (instancetype)init {
|
|
32
|
+
self = [super init];
|
|
33
|
+
if (self) {
|
|
34
|
+
_impl = [[DynamicWebViewImpl alloc] init];
|
|
35
|
+
_impl.delegate = self;
|
|
36
|
+
_bufferedEvents = [NSMutableArray array];
|
|
37
|
+
}
|
|
38
|
+
return self;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#pragma mark - RCTEventEmitter
|
|
42
|
+
|
|
43
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
44
|
+
return @[ kMessageEventName ];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)startObserving {
|
|
48
|
+
// Flush messages buffered before the first listener attached, in order, so an
|
|
49
|
+
// early handshake message is delivered rather than dropped. Snapshot under
|
|
50
|
+
// the lock; send outside it so sendEventWithName: never runs while holding it.
|
|
51
|
+
NSArray<NSDictionary *> *pending;
|
|
52
|
+
@synchronized(self) {
|
|
53
|
+
_hasListeners = YES;
|
|
54
|
+
pending = [_bufferedEvents copy];
|
|
55
|
+
[_bufferedEvents removeAllObjects];
|
|
56
|
+
}
|
|
57
|
+
for (NSDictionary *event in pending) {
|
|
58
|
+
[self sendEventWithName:kMessageEventName body:event];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)stopObserving {
|
|
63
|
+
@synchronized(self) {
|
|
64
|
+
_hasListeners = NO;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#pragma mark - NativeDynamicWebViewSpec
|
|
69
|
+
|
|
70
|
+
- (void)open:(NSString *)instanceId
|
|
71
|
+
url:(NSString *)url
|
|
72
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
73
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
74
|
+
[_impl openWithInstanceId:instanceId
|
|
75
|
+
url:url
|
|
76
|
+
completion:^(NSError * _Nullable error) {
|
|
77
|
+
if (error) {
|
|
78
|
+
// The Swift impl stores a discriminator string under the
|
|
79
|
+
// `DynamicWebViewReason` userInfo key. Surface it as the RCT reject
|
|
80
|
+
// code so the JS wrapper can translate to a typed
|
|
81
|
+
// `WebViewLoadFailedError` without parsing messages.
|
|
82
|
+
NSString *reason = error.userInfo[@"DynamicWebViewReason"];
|
|
83
|
+
NSString *rejectCode = reason
|
|
84
|
+
? [NSString stringWithFormat:@"webview_%@", reason]
|
|
85
|
+
: @"webview_load_failed_error";
|
|
86
|
+
reject(rejectCode, error.localizedDescription, error);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
resolve([NSNull null]);
|
|
90
|
+
}];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (void)sendMessage:(NSString *)instanceId data:(NSDictionary *)data {
|
|
94
|
+
[_impl sendMessageWithInstanceId:instanceId data:data];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)close:(NSString *)instanceId {
|
|
98
|
+
[_impl closeWithInstanceId:instanceId];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (void)addListener:(NSString *)eventName {
|
|
102
|
+
// Delegate to RCTEventEmitter so its internal listener counter increments
|
|
103
|
+
// and `startObserving` fires on the 0 -> 1 transition. Declaring this method
|
|
104
|
+
// in the TurboModule spec is required for codegen compatibility; forgetting
|
|
105
|
+
// to chain to super silently breaks event delivery (hasListeners stays NO).
|
|
106
|
+
[super addListener:eventName];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
- (void)removeListeners:(double)count {
|
|
110
|
+
[super removeListeners:count];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#pragma mark - DynamicWebViewImplDelegate
|
|
114
|
+
|
|
115
|
+
- (void)didReceiveMessageForInstanceId:(NSString *)instanceId
|
|
116
|
+
data:(id)data {
|
|
117
|
+
NSDictionary *event =
|
|
118
|
+
@{ @"instanceId": instanceId, @"data": data ?: [NSNull null] };
|
|
119
|
+
@synchronized(self) {
|
|
120
|
+
if (!_hasListeners) {
|
|
121
|
+
// Buffer until a listener attaches; otherwise an early message (the
|
|
122
|
+
// iframe-ready handshake) would be silently dropped and the ceremony
|
|
123
|
+
// would stall until the WaaS handshake timeout.
|
|
124
|
+
[_bufferedEvents addObject:event];
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
[self sendEventWithName:kMessageEventName body:event];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#pragma mark - TurboModule
|
|
132
|
+
|
|
133
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
134
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
135
|
+
return std::make_shared<facebook::react::NativeDynamicWebViewSpecJSI>(
|
|
136
|
+
params);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
140
|
+
return NO;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@end
|