@dynamic-labs/react-native-extension 4.0.0-alpha.14 → 4.0.0-alpha.15
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/index.cjs +31 -7
- package/index.js +32 -8
- package/package.json +5 -5
- package/src/ReactNativeExtension/setupStorageHandler/index.d.ts +1 -0
- package/src/ReactNativeExtension/setupStorageHandler/setupStorageHandler.d.ts +2 -0
- package/src/ReactNativeExtension/setupSecureStorageHandler/index.d.ts +0 -1
- package/src/ReactNativeExtension/setupSecureStorageHandler/setupSecureStorageHandler.d.ts +0 -2
package/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ var expoLinking = require('expo-linking');
|
|
|
14
14
|
var expoWebBrowser = require('expo-web-browser');
|
|
15
15
|
var expoSecureStore = require('expo-secure-store');
|
|
16
16
|
|
|
17
|
-
var version = "4.0.0-alpha.
|
|
17
|
+
var version = "4.0.0-alpha.15";
|
|
18
18
|
|
|
19
19
|
function _extends() {
|
|
20
20
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -239,11 +239,35 @@ const setupPlatformHandler = core => {
|
|
|
239
239
|
}));
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
const assertValidSource = source => {
|
|
243
|
+
if (source !== 'secureStorage') {
|
|
244
|
+
throw new Error(`Invalid storage source "${source}"`);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const setupStorageHandler = core => {
|
|
248
|
+
const storageRequestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
249
|
+
storageRequestChannel.handle('getItem', _a => __awaiter(void 0, [_a], void 0, function* ({
|
|
250
|
+
key,
|
|
251
|
+
source
|
|
252
|
+
}) {
|
|
253
|
+
assertValidSource(source);
|
|
254
|
+
return expoSecureStore.getItemAsync(key);
|
|
255
|
+
}));
|
|
256
|
+
storageRequestChannel.handle('deleteItem', _b => __awaiter(void 0, [_b], void 0, function* ({
|
|
257
|
+
key,
|
|
258
|
+
source
|
|
259
|
+
}) {
|
|
260
|
+
assertValidSource(source);
|
|
261
|
+
return expoSecureStore.deleteItemAsync(key);
|
|
262
|
+
}));
|
|
263
|
+
storageRequestChannel.handle('setItem', _c => __awaiter(void 0, [_c], void 0, function* ({
|
|
264
|
+
key,
|
|
265
|
+
data,
|
|
266
|
+
source
|
|
267
|
+
}) {
|
|
268
|
+
assertValidSource(source);
|
|
269
|
+
return expoSecureStore.setItemAsync(key, data);
|
|
270
|
+
}));
|
|
247
271
|
};
|
|
248
272
|
|
|
249
273
|
const defaultWebviewUrl = `https://webview.dynamicauth.com/${version}`;
|
|
@@ -267,7 +291,7 @@ const ReactNativeExtension = ({
|
|
|
267
291
|
if (appOrigin) core.manifest.setAppOrigin(appOrigin);
|
|
268
292
|
setupPasskeyHandler(core);
|
|
269
293
|
setupPlatformHandler(core);
|
|
270
|
-
|
|
294
|
+
setupStorageHandler(core);
|
|
271
295
|
return {
|
|
272
296
|
reactNative: {
|
|
273
297
|
WebView: createWebView({
|
package/index.js
CHANGED
|
@@ -8,9 +8,9 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
8
|
import { createPasskey, PasskeyStamper } from '@turnkey/react-native-passkey-stamper';
|
|
9
9
|
import { createURL, openURL } from 'expo-linking';
|
|
10
10
|
import { openAuthSessionAsync } from 'expo-web-browser';
|
|
11
|
-
import { getItemAsync,
|
|
11
|
+
import { getItemAsync, deleteItemAsync, setItemAsync } from 'expo-secure-store';
|
|
12
12
|
|
|
13
|
-
var version = "4.0.0-alpha.
|
|
13
|
+
var version = "4.0.0-alpha.15";
|
|
14
14
|
|
|
15
15
|
function _extends() {
|
|
16
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -235,11 +235,35 @@ const setupPlatformHandler = core => {
|
|
|
235
235
|
}));
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
const assertValidSource = source => {
|
|
239
|
+
if (source !== 'secureStorage') {
|
|
240
|
+
throw new Error(`Invalid storage source "${source}"`);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const setupStorageHandler = core => {
|
|
244
|
+
const storageRequestChannel = createRequestChannel(core.messageTransport);
|
|
245
|
+
storageRequestChannel.handle('getItem', _a => __awaiter(void 0, [_a], void 0, function* ({
|
|
246
|
+
key,
|
|
247
|
+
source
|
|
248
|
+
}) {
|
|
249
|
+
assertValidSource(source);
|
|
250
|
+
return getItemAsync(key);
|
|
251
|
+
}));
|
|
252
|
+
storageRequestChannel.handle('deleteItem', _b => __awaiter(void 0, [_b], void 0, function* ({
|
|
253
|
+
key,
|
|
254
|
+
source
|
|
255
|
+
}) {
|
|
256
|
+
assertValidSource(source);
|
|
257
|
+
return deleteItemAsync(key);
|
|
258
|
+
}));
|
|
259
|
+
storageRequestChannel.handle('setItem', _c => __awaiter(void 0, [_c], void 0, function* ({
|
|
260
|
+
key,
|
|
261
|
+
data,
|
|
262
|
+
source
|
|
263
|
+
}) {
|
|
264
|
+
assertValidSource(source);
|
|
265
|
+
return setItemAsync(key, data);
|
|
266
|
+
}));
|
|
243
267
|
};
|
|
244
268
|
|
|
245
269
|
const defaultWebviewUrl = `https://webview.dynamicauth.com/${version}`;
|
|
@@ -263,7 +287,7 @@ const ReactNativeExtension = ({
|
|
|
263
287
|
if (appOrigin) core.manifest.setAppOrigin(appOrigin);
|
|
264
288
|
setupPasskeyHandler(core);
|
|
265
289
|
setupPlatformHandler(core);
|
|
266
|
-
|
|
290
|
+
setupStorageHandler(core);
|
|
267
291
|
return {
|
|
268
292
|
reactNative: {
|
|
269
293
|
WebView: createWebView({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/react-native-extension",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.15",
|
|
4
4
|
"main": "./index.cjs",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@turnkey/react-native-passkey-stamper": "0.2.5",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/client": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/message-transport": "4.0.0-alpha.
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.15",
|
|
19
|
+
"@dynamic-labs/client": "4.0.0-alpha.15",
|
|
20
|
+
"@dynamic-labs/logger": "4.0.0-alpha.15",
|
|
21
|
+
"@dynamic-labs/message-transport": "4.0.0-alpha.15"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.2.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setupStorageHandler } from './setupStorageHandler';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setupSecureStorageHandler } from './setupSecureStorageHandler';
|