react-native-security-suite 0.2.0 → 0.3.0

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.
Files changed (56) hide show
  1. package/LICENSE +1 -2
  2. package/android/build.gradle +85 -43
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +1 -3
  5. package/android/src/main/AndroidManifestDeprecated.xml +3 -0
  6. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/SecuritySuiteModule.java +1 -1
  7. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/SecuritySuitePackage.java +1 -1
  8. package/android/src/main/java/com/{reactnativesecuritysuite → securitysuite}/StorageEncryption.java +1 -2
  9. package/ios/SecuritySuite.xcodeproj/project.pbxproj +12 -10
  10. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -3
  11. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcuserdata/mohammadnavabi.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  12. package/lib/commonjs/helpers.js +0 -3
  13. package/lib/commonjs/helpers.js.map +1 -1
  14. package/lib/commonjs/index.js +17 -37
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/module/helpers.js +0 -1
  17. package/lib/module/helpers.js.map +1 -1
  18. package/lib/module/index.js +17 -14
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/typescript/helpers.d.ts +1 -0
  21. package/lib/typescript/helpers.d.ts.map +1 -0
  22. package/lib/typescript/index.d.ts +2 -1
  23. package/lib/typescript/index.d.ts.map +1 -0
  24. package/package.json +45 -35
  25. package/react-native-security-suite.podspec +18 -2
  26. package/src/index.tsx +24 -16
  27. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  28. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  29. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  30. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  31. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  32. package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
  33. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  34. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  35. package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
  36. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  37. package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
  38. package/android/.gradle/7.4/gc.properties +0 -0
  39. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  40. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  41. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  42. package/android/.gradle/file-system.probe +0 -0
  43. package/android/.gradle/vcs-1/gc.properties +0 -0
  44. package/android/.idea/compiler.xml +0 -6
  45. package/android/.idea/gradle.xml +0 -17
  46. package/android/.idea/jarRepositories.xml +0 -40
  47. package/android/.idea/misc.xml +0 -10
  48. package/android/.idea/vcs.xml +0 -6
  49. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  50. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  51. package/android/gradlew +0 -234
  52. package/android/gradlew.bat +0 -89
  53. package/android/local.properties +0 -8
  54. package/ios/SecuritySuite.xcodeproj/project.xcworkspace/xcuserdata/Navabi.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  55. /package/ios/{SecuritySuite.m → SecuritySuite.mm} +0 -0
  56. /package/ios/SecuritySuite.xcodeproj/xcuserdata/{Navabi.xcuserdatad → mohammadnavabi.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -0
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Mohammad Navabi
4
-
3
+ Copyright (c) 2023 Mohammad Navabi
5
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
5
  of this software and associated documentation files (the "Software"), to deal
7
6
  in the Software without restriction, including without limitation the rights
@@ -1,60 +1,102 @@
1
1
  buildscript {
2
- if (project == rootProject) {
3
- repositories {
4
- google()
5
- mavenCentral()
6
- jcenter()
7
- }
8
-
9
- dependencies {
10
- classpath 'com.android.tools.build:gradle:3.5.3'
11
- }
12
- }
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:7.2.1"
9
+ }
13
10
  }
14
11
 
15
- apply plugin: 'com.android.library'
12
+ def isNewArchitectureEnabled() {
13
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14
+ }
15
+
16
+ apply plugin: "com.android.library"
17
+
18
+
19
+ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
16
20
 
17
- def safeExtGet(prop, fallback) {
18
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
21
+ if (isNewArchitectureEnabled()) {
22
+ apply plugin: "com.facebook.react"
19
23
  }
20
24
 
21
- android {
22
- compileSdkVersion safeExtGet('SecuritySuite_compileSdkVersion', 31)
23
- defaultConfig {
24
- minSdkVersion safeExtGet('SecuritySuite_minSdkVersion', 21)
25
- targetSdkVersion safeExtGet('SecuritySuite_targetSdkVersion', 31)
26
- versionCode 1
27
- versionName "1.0"
25
+ def getExtOrDefault(name) {
26
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["SecuritySuite_" + name]
27
+ }
28
28
 
29
- }
29
+ def getExtOrIntegerDefault(name) {
30
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SecuritySuite_" + name]).toInteger()
31
+ }
30
32
 
31
- buildTypes {
32
- release {
33
- minifyEnabled false
34
- }
35
- }
36
- lintOptions {
37
- disable 'GradleCompatible'
33
+ def supportsNamespace() {
34
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
35
+ def major = parsed[0].toInteger()
36
+ def minor = parsed[1].toInteger()
37
+
38
+ // Namespace support was added in 7.3.0
39
+ if (major == 7 && minor >= 3) {
40
+ return true
41
+ }
42
+
43
+ return major >= 8
44
+ }
45
+
46
+ android {
47
+ if (supportsNamespace()) {
48
+ namespace "com.securitysuite"
49
+ } else {
50
+ sourceSets {
51
+ main {
52
+ manifest.srcFile "src/main/AndroidManifestDeprecated.xml"
53
+ }
38
54
  }
39
- compileOptions {
40
- sourceCompatibility JavaVersion.VERSION_1_8
41
- targetCompatibility JavaVersion.VERSION_1_8
55
+ }
56
+
57
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
58
+
59
+ defaultConfig {
60
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
61
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
62
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
63
+ }
64
+ buildTypes {
65
+ release {
66
+ minifyEnabled false
42
67
  }
68
+ }
69
+
70
+ lintOptions {
71
+ disable "GradleCompatible"
72
+ }
73
+
74
+ compileOptions {
75
+ sourceCompatibility JavaVersion.VERSION_1_8
76
+ targetCompatibility JavaVersion.VERSION_1_8
77
+ }
78
+
43
79
  }
44
80
 
45
81
  repositories {
46
- mavenLocal()
47
- maven {
48
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49
- url("$rootDir/../node_modules/react-native/android")
50
- }
51
- google()
52
- mavenCentral()
53
- jcenter()
82
+ mavenCentral()
83
+ google()
84
+ jcenter()
54
85
  }
55
86
 
87
+
56
88
  dependencies {
57
- //noinspection GradleDynamicVersion
58
- implementation "com.facebook.react:react-native:+" // From node_modules
59
- implementation "com.scottyab:rootbeer-lib:0.1.0"
89
+ // For < 0.71, this will be from the local maven repo
90
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
91
+ //noinspection GradleDynamicVersion
92
+ implementation "com.facebook.react:react-native:+"
93
+ implementation "com.scottyab:rootbeer-lib:0.1.0"
94
+ }
95
+
96
+ if (isNewArchitectureEnabled()) {
97
+ react {
98
+ jsRootDir = file("../src/")
99
+ libraryName = "SecuritySuite"
100
+ codegenJavaPackageName = "com.securitysuite"
101
+ }
60
102
  }
@@ -0,0 +1,5 @@
1
+ SecuritySuite_kotlinVersion=1.7.0
2
+ SecuritySuite_minSdkVersion=21
3
+ SecuritySuite_targetSdkVersion=31
4
+ SecuritySuite_compileSdkVersion=31
5
+ SecuritySuite_ndkversion=21.4.7075529
@@ -1,4 +1,2 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.reactnativesecuritysuite">
3
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
2
  </manifest>
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.securitysuite">
3
+ </manifest>
@@ -1,4 +1,4 @@
1
- package com.reactnativesecuritysuite;
1
+ package com.securitysuite;
2
2
 
3
3
  import com.facebook.react.bridge.Callback;
4
4
  import com.facebook.react.bridge.Promise;
@@ -1,4 +1,4 @@
1
- package com.reactnativesecuritysuite;
1
+ package com.securitysuite;
2
2
 
3
3
  import androidx.annotation.NonNull;
4
4
 
@@ -1,5 +1,4 @@
1
- package com.reactnativesecuritysuite;
2
-
1
+ package com.securitysuite;
3
2
 
4
3
  import android.util.Base64;
5
4
 
@@ -7,8 +7,8 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- 59F427012A67C7B90072365D /* StorageEncryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59F426FF2A67C7B90072365D /* StorageEncryption.swift */; };
11
- 59F427022A67C7B90072365D /* DataHashingMethods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59F427002A67C7B90072365D /* DataHashingMethods.swift */; };
10
+ 48C650222A751374001FA3B0 /* StorageEncryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48C650202A751374001FA3B0 /* StorageEncryption.swift */; };
11
+ 48C650232A751374001FA3B0 /* DataHashingMethods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48C650212A751374001FA3B0 /* DataHashingMethods.swift */; };
12
12
  F4FF95D7245B92E800C19C63 /* SecuritySuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* SecuritySuite.swift */; };
13
13
  /* End PBXBuildFile section */
14
14
 
@@ -26,9 +26,9 @@
26
26
 
27
27
  /* Begin PBXFileReference section */
28
28
  134814201AA4EA6300B7C361 /* libSecuritySuite.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSecuritySuite.a; sourceTree = BUILT_PRODUCTS_DIR; };
29
- 59F426FF2A67C7B90072365D /* StorageEncryption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageEncryption.swift; sourceTree = "<group>"; };
30
- 59F427002A67C7B90072365D /* DataHashingMethods.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataHashingMethods.swift; sourceTree = "<group>"; };
31
- B3E7B5891CC2AC0600A0062D /* SecuritySuite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecuritySuite.m; sourceTree = "<group>"; };
29
+ 48C650202A751374001FA3B0 /* StorageEncryption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageEncryption.swift; sourceTree = "<group>"; };
30
+ 48C650212A751374001FA3B0 /* DataHashingMethods.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataHashingMethods.swift; sourceTree = "<group>"; };
31
+ B3E7B5891CC2AC0600A0062D /* SecuritySuite.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecuritySuite.mm; sourceTree = "<group>"; };
32
32
  F4FF95D5245B92E700C19C63 /* SecuritySuite-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SecuritySuite-Bridging-Header.h"; sourceTree = "<group>"; };
33
33
  F4FF95D6245B92E800C19C63 /* SecuritySuite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecuritySuite.swift; sourceTree = "<group>"; };
34
34
  /* End PBXFileReference section */
@@ -56,10 +56,10 @@
56
56
  isa = PBXGroup;
57
57
  children = (
58
58
  F4FF95D6245B92E800C19C63 /* SecuritySuite.swift */,
59
- B3E7B5891CC2AC0600A0062D /* SecuritySuite.m */,
59
+ B3E7B5891CC2AC0600A0062D /* SecuritySuite.mm */,
60
60
  F4FF95D5245B92E700C19C63 /* SecuritySuite-Bridging-Header.h */,
61
- 59F427002A67C7B90072365D /* DataHashingMethods.swift */,
62
- 59F426FF2A67C7B90072365D /* StorageEncryption.swift */,
61
+ 48C650212A751374001FA3B0 /* DataHashingMethods.swift */,
62
+ 48C650202A751374001FA3B0 /* StorageEncryption.swift */,
63
63
  134814211AA4EA7D00B7C361 /* Products */,
64
64
  );
65
65
  sourceTree = "<group>";
@@ -121,8 +121,8 @@
121
121
  isa = PBXSourcesBuildPhase;
122
122
  buildActionMask = 2147483647;
123
123
  files = (
124
- 59F427022A67C7B90072365D /* DataHashingMethods.swift in Sources */,
125
- 59F427012A67C7B90072365D /* StorageEncryption.swift in Sources */,
124
+ 48C650232A751374001FA3B0 /* DataHashingMethods.swift in Sources */,
125
+ 48C650222A751374001FA3B0 /* StorageEncryption.swift in Sources */,
126
126
  F4FF95D7245B92E800C19C63 /* SecuritySuite.swift in Sources */,
127
127
  );
128
128
  runOnlyForDeploymentPostprocessing = 0;
@@ -158,6 +158,7 @@
158
158
  COPY_PHASE_STRIP = NO;
159
159
  ENABLE_STRICT_OBJC_MSGSEND = YES;
160
160
  ENABLE_TESTABILITY = YES;
161
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
161
162
  GCC_C_LANGUAGE_STANDARD = gnu99;
162
163
  GCC_DYNAMIC_NO_PIC = NO;
163
164
  GCC_NO_COMMON_BLOCKS = YES;
@@ -208,6 +209,7 @@
208
209
  COPY_PHASE_STRIP = YES;
209
210
  ENABLE_NS_ASSERTIONS = NO;
210
211
  ENABLE_STRICT_OBJC_MSGSEND = YES;
212
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
211
213
  GCC_C_LANGUAGE_STANDARD = gnu99;
212
214
  GCC_NO_COMMON_BLOCKS = YES;
213
215
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -1,7 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Workspace
3
3
  version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
4
  </Workspace>
@@ -4,16 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isJsonString = void 0;
7
-
8
7
  const isJsonString = value => {
9
8
  try {
10
9
  JSON.parse(value);
11
10
  } catch (e) {
12
11
  return false;
13
12
  }
14
-
15
13
  return true;
16
14
  };
17
-
18
15
  exports.isJsonString = isJsonString;
19
16
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isJsonString","value","JSON","parse","e"],"sources":["helpers.ts"],"sourcesContent":["export const isJsonString = (value: string): boolean => {\n try {\n JSON.parse(value);\n } catch (e) {\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;;AAAO,MAAMA,YAAY,GAAIC,KAAD,IAA4B;EACtD,IAAI;IACFC,IAAI,CAACC,KAAL,CAAWF,KAAX;EACD,CAFD,CAEE,OAAOG,CAAP,EAAU;IACV,OAAO,KAAP;EACD;;EACD,OAAO,IAAP;AACD,CAPM"}
1
+ {"version":3,"names":["isJsonString","value","JSON","parse","e","exports"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAIC,KAAa,IAAc;EACtD,IAAI;IACFC,IAAI,CAACC,KAAK,CAACF,KAAK,CAAC;EACnB,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb,CAAC;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA"}
@@ -6,17 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.decryptBySharedKey = exports.decrypt = exports.SecureStorage = void 0;
7
7
  exports.deviceHasSecurityRisk = deviceHasSecurityRisk;
8
8
  exports.getSharedKey = exports.getPublicKey = exports.getDeviceId = exports.encryptBySharedKey = exports.encrypt = void 0;
9
-
10
9
  var _reactNative = require("react-native");
11
-
12
10
  var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
13
-
14
11
  var _lodash = _interopRequireDefault(require("lodash"));
15
-
16
12
  var _helpers = require("./helpers");
17
-
18
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
14
  const LINKING_ERROR = `The package 'react-native-security-suite' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
21
15
  ios: "- You have run 'pod install'\n",
22
16
  default: ''
@@ -25,33 +19,21 @@ const SecuritySuite = _reactNative.NativeModules.SecuritySuite ? _reactNative.Na
25
19
  get() {
26
20
  throw new Error(LINKING_ERROR);
27
21
  }
28
-
29
22
  });
30
-
31
23
  const getPublicKey = () => SecuritySuite.getPublicKey();
32
-
33
24
  exports.getPublicKey = getPublicKey;
34
-
35
25
  const getSharedKey = serverPublicKey => SecuritySuite.getSharedKey(serverPublicKey);
36
-
37
26
  exports.getSharedKey = getSharedKey;
38
-
39
27
  const encryptBySharedKey = input => input && typeof input === 'string' ? SecuritySuite.encrypt(input) : '';
40
-
41
28
  exports.encryptBySharedKey = encryptBySharedKey;
42
-
43
29
  const decryptBySharedKey = input => input && typeof input === 'string' ? SecuritySuite.decrypt(input) : '';
44
-
45
30
  exports.decryptBySharedKey = decryptBySharedKey;
46
-
47
31
  const getDeviceId = () => new Promise((resolve, reject) => {
48
32
  SecuritySuite.getDeviceId((result, error) => {
49
33
  if (error !== null) reject(error);else resolve(result);
50
34
  });
51
35
  });
52
-
53
36
  exports.getDeviceId = getDeviceId;
54
-
55
37
  const encrypt = function (input) {
56
38
  let hardEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
57
39
  let secretKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
@@ -62,9 +44,7 @@ const encrypt = function (input) {
62
44
  });
63
45
  });
64
46
  };
65
-
66
47
  exports.encrypt = encrypt;
67
-
68
48
  const decrypt = function (input) {
69
49
  let hardEncryption = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
70
50
  let secretKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
@@ -75,7 +55,6 @@ const decrypt = function (input) {
75
55
  });
76
56
  });
77
57
  };
78
-
79
58
  exports.decrypt = decrypt;
80
59
  const SecureStorage = {
81
60
  setItem: async (key, value) => {
@@ -131,15 +110,16 @@ const SecureStorage = {
131
110
  multiSet: async keyValuePairs => {
132
111
  try {
133
112
  const encryptedKeyValuePairs = await Promise.all(keyValuePairs.map(async item => {
134
- if (item.length !== 2) return [];
135
- const encryptedKey = await encrypt(item[0], false);
136
- const encryptedValue = await encrypt(item[1]);
137
- return [encryptedKey, encryptedValue];
113
+ if (item.length === 2 && item[0] && item[1]) {
114
+ const encryptedKey = await encrypt(item[0], false);
115
+ const encryptedValue = await encrypt(item[1]);
116
+ return [encryptedKey, encryptedValue];
117
+ }
118
+ return null;
138
119
  }));
139
-
140
120
  _asyncStorage.default.multiSet(encryptedKeyValuePairs);
141
121
  } catch (e) {
142
- return e;
122
+ console.error('multiSet error: ', e);
143
123
  }
144
124
  },
145
125
  multiGet: async keys => {
@@ -159,14 +139,16 @@ const SecureStorage = {
159
139
  multiMerge: async keyValuePairs => {
160
140
  try {
161
141
  return keyValuePairs.map(async item => {
162
- if (item.length !== 2) return;
163
- const encryptedKey = await encrypt(item[0], false);
164
- const encryptedData = await _asyncStorage.default.getItem(item[0]);
165
- const data = await decrypt(encryptedData ?? '');
166
- if (!(0, _helpers.isJsonString)(data) || !(0, _helpers.isJsonString)(item[1])) return null;
167
- const mergedData = await JSON.stringify(_lodash.default.merge(JSON.parse(data), JSON.parse(item[1])));
168
- const encryptedValue = await encrypt(mergedData, false);
169
- return _asyncStorage.default.setItem(encryptedKey, encryptedValue);
142
+ if (item.length === 2 && item[0] && item[1]) {
143
+ const encryptedKey = await encrypt(item[0], false);
144
+ const encryptedData = await _asyncStorage.default.getItem(item[0]);
145
+ const data = await decrypt(encryptedData ?? '');
146
+ if (!(0, _helpers.isJsonString)(data) || !(0, _helpers.isJsonString)(item[1])) return null;
147
+ const mergedData = await JSON.stringify(_lodash.default.merge(JSON.parse(data), JSON.parse(item[1])));
148
+ const encryptedValue = await encrypt(mergedData, false);
149
+ return _asyncStorage.default.setItem(encryptedKey, encryptedValue);
150
+ }
151
+ return null;
170
152
  });
171
153
  } catch (e) {
172
154
  return e;
@@ -190,11 +172,9 @@ const SecureStorage = {
190
172
  }
191
173
  };
192
174
  exports.SecureStorage = SecureStorage;
193
-
194
175
  function deviceHasSecurityRisk() {
195
176
  return SecuritySuite.deviceHasSecurityRisk();
196
177
  }
197
-
198
178
  var _default = SecuritySuite;
199
179
  exports.default = _default;
200
180
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","SecuritySuite","NativeModules","Proxy","get","Error","getPublicKey","getSharedKey","serverPublicKey","encryptBySharedKey","input","encrypt","decryptBySharedKey","decrypt","getDeviceId","Promise","resolve","reject","result","error","hardEncryption","secretKey","storageEncrypt","storageDecrypt","SecureStorage","setItem","key","value","encryptedKey","encryptedValue","AsyncStorage","e","getItem","encryptedData","mergeItem","data","isJsonString","mergedData","JSON","stringify","_","merge","parse","removeItem","getAllKeys","encryptedKeys","all","map","item","decryptedKey","multiSet","keyValuePairs","encryptedKeyValuePairs","length","multiGet","keys","Array","isArray","encryptedItems","decryptedalue","multiMerge","multiRemove","clear","deviceHasSecurityRisk"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport _ from 'lodash';\nimport { isJsonString } from './helpers';\n\nconst LINKING_ERROR =\n `The package 'react-native-security-suite' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SecuritySuite = NativeModules.SecuritySuite\n ? NativeModules.SecuritySuite\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const getPublicKey = (): Promise<string> => SecuritySuite.getPublicKey();\n\nexport const getSharedKey = (serverPublicKey: string): Promise<string> =>\n SecuritySuite.getSharedKey(serverPublicKey);\n\nexport const encryptBySharedKey = (input: string): Promise<string> =>\n input && typeof input === 'string' ? SecuritySuite.encrypt(input) : '';\n\nexport const decryptBySharedKey = (input: string) =>\n input && typeof input === 'string' ? SecuritySuite.decrypt(input) : '';\n\nexport const getDeviceId = (): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n SecuritySuite.getDeviceId((result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n });\n });\n\nexport const encrypt = (\n input: string,\n hardEncryption = true,\n secretKey = null\n): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n if (!input) resolve(input);\n\n SecuritySuite.storageEncrypt(\n input,\n secretKey,\n hardEncryption,\n (result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n }\n );\n });\n\nexport const decrypt = (\n input: string,\n hardEncryption = true,\n secretKey = null\n): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n if (!input) resolve(input);\n\n SecuritySuite.storageDecrypt(\n input,\n secretKey,\n hardEncryption,\n (result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n }\n );\n });\n\nexport const SecureStorage = {\n setItem: async (key: string, value: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedValue = await encrypt(value);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n } catch (e) {\n return e;\n }\n },\n getItem: async (key: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedData = await AsyncStorage.getItem(encryptedKey);\n return decrypt(encryptedData ?? '');\n } catch (e) {\n return e;\n }\n },\n mergeItem: async (key: string, value: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedData = await AsyncStorage.getItem(encryptedKey);\n const data = await decrypt(encryptedData ?? '');\n if (!isJsonString(data) || !isJsonString(value)) return null;\n const mergedData = await JSON.stringify(\n _.merge(JSON.parse(data), JSON.parse(value))\n );\n const encryptedValue = await encrypt(mergedData);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n } catch (e) {\n return e;\n }\n },\n removeItem: async (key: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n return AsyncStorage.removeItem(encryptedKey);\n } catch (e) {\n return e;\n }\n },\n getAllKeys: async () => {\n try {\n const encryptedKeys = await AsyncStorage.getAllKeys();\n return await Promise.all(\n encryptedKeys.map(async (item: string): Promise<string> => {\n const decryptedKey = await decrypt(item, false);\n return decryptedKey ? decryptedKey : item;\n })\n );\n } catch (e) {\n return e;\n }\n },\n multiSet: async (keyValuePairs: Array<Array<string>>) => {\n try {\n const encryptedKeyValuePairs: any = await Promise.all(\n keyValuePairs.map(async (item: Array<string>) => {\n if (item.length !== 2) return [];\n const encryptedKey = await encrypt(item[0], false);\n const encryptedValue = await encrypt(item[1]);\n return [encryptedKey, encryptedValue];\n })\n );\n AsyncStorage.multiSet(encryptedKeyValuePairs);\n } catch (e) {\n return e;\n }\n },\n multiGet: async (keys: Array<string>) => {\n try {\n if (!Array.isArray(keys)) return null;\n const encryptedKeys = await Promise.all(\n keys.map(\n async (item: string): Promise<string> => await encrypt(item, false)\n )\n );\n const encryptedItems = await AsyncStorage.multiGet(encryptedKeys);\n return await Promise.all(\n encryptedItems && encryptedItems.length\n ? encryptedItems.map(async (item: any): Promise<string[]> => {\n const decryptedKey = await decrypt(item[0], false);\n const decryptedalue = await decrypt(item[1]);\n return [decryptedKey, decryptedalue];\n })\n : []\n );\n } catch (e) {\n return e;\n }\n },\n multiMerge: async (keyValuePairs: Array<Array<string>>) => {\n try {\n return keyValuePairs.map(async (item: Array<string>) => {\n if (item.length !== 2) return;\n const encryptedKey = await encrypt(item[0], false);\n const encryptedData = await AsyncStorage.getItem(item[0]);\n const data = await decrypt(encryptedData ?? '');\n if (!isJsonString(data) || !isJsonString(item[1])) return null;\n const mergedData = await JSON.stringify(\n _.merge(JSON.parse(data), JSON.parse(item[1]))\n );\n const encryptedValue = await encrypt(mergedData, false);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n });\n } catch (e) {\n return e;\n }\n },\n multiRemove: async (keys: Array<string>) => {\n try {\n if (!Array.isArray(keys)) return keys;\n const encryptedKeys = await Promise.all(\n keys.map(\n async (item: string): Promise<string> => await encrypt(item, false)\n )\n );\n return AsyncStorage.multiRemove(encryptedKeys);\n } catch (e) {\n return e;\n }\n },\n clear: async () => {\n try {\n return AsyncStorage.clear();\n } catch (e) {\n return e;\n }\n },\n};\n\nexport function deviceHasSecurityRisk(): Promise<boolean> {\n return SecuritySuite.deviceHasSecurityRisk();\n}\n\nexport default SecuritySuite;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,aAAa,GAChB,sFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGC,0BAAA,CAAcD,aAAd,GAClBC,0BAAA,CAAcD,aADI,GAElB,IAAIE,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ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,EAAU;MACV,OAAOA,CAAP;IACD;EACF,CA7G0B;EA8G3B8B,WAAW,EAAE,MAAON,IAAP,IAA+B;IAC1C,IAAI;MACF,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,IAAd,CAAL,EAA0B,OAAOA,IAAP;MAC1B,MAAMV,aAAa,GAAG,MAAM9B,OAAO,CAAC+B,GAAR,CAC1BS,IAAI,CAACR,GAAL,CACE,MAAOC,IAAP,IAAyC,MAAMrC,OAAO,CAACqC,IAAD,EAAO,KAAP,CADxD,CAD0B,CAA5B;MAKA,OAAOlB,qBAAA,CAAa+B,WAAb,CAAyBhB,aAAzB,CAAP;IACD,CARD,CAQE,OAAOd,CAAP,EAAU;MACV,OAAOA,CAAP;IACD;EACF,CA1H0B;EA2H3B+B,KAAK,EAAE,YAAY;IACjB,IAAI;MACF,OAAOhC,qBAAA,CAAagC,KAAb,EAAP;IACD,CAFD,CAEE,OAAO/B,CAAP,EAAU;MACV,OAAOA,CAAP;IACD;EACF;AAjI0B,CAAtB;;;AAoIA,SAASgC,qBAAT,GAAmD;EACxD,OAAO9D,aAAa,CAAC8D,qBAAd,EAAP;AACD;;eAEc9D,a"}
1
+ {"version":3,"names":["_reactNative","require","_asyncStorage","_interopRequireDefault","_lodash","_helpers","obj","__esModule","default","LINKING_ERROR","Platform","select","ios","SecuritySuite","NativeModules","Proxy","get","Error","getPublicKey","exports","getSharedKey","serverPublicKey","encryptBySharedKey","input","encrypt","decryptBySharedKey","decrypt","getDeviceId","Promise","resolve","reject","result","error","hardEncryption","arguments","length","undefined","secretKey","storageEncrypt","storageDecrypt","SecureStorage","setItem","key","value","encryptedKey","encryptedValue","AsyncStorage","e","getItem","encryptedData","mergeItem","data","isJsonString","mergedData","JSON","stringify","_","merge","parse","removeItem","getAllKeys","encryptedKeys","all","map","item","decryptedKey","multiSet","keyValuePairs","encryptedKeyValuePairs","console","multiGet","keys","Array","isArray","encryptedItems","decryptedalue","multiMerge","multiRemove","clear","deviceHasSecurityRisk","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AOP,qBAAY,CAACL,OAAO,CAACG,YAAY,EAAEC,cAAc,CAAC;QAC3D;QAEA,OAAO,IAAI;MACb,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOE,CAAC,EAAE;MACV,OAAOA,CAAC;IACV;EACF,CAAC;EACD8B,WAAW,EAAE,MAAON,IAAmB,IAAK;IAC1C,IAAI;MACF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,EAAE,OAAOA,IAAI;MACrC,MAAMV,aAAa,GAAG,MAAMjC,OAAO,CAACkC,GAAG,CACrCS,IAAI,CAACR,GAAG,CACN,MAAOC,IAAY,IAAsB,MAAMxC,OAAO,CAACwC,IAAI,EAAE,KAAK,CACpE,CACF,CAAC;MACD,OAAOlB,qBAAY,CAAC+B,WAAW,CAAChB,aAAa,CAAC;IAChD,CAAC,CAAC,OAAOd,CAAC,EAAE;MACV,OAAOA,CAAC;IACV;EACF,CAAC;EACD+B,KAAK,EAAE,MAAAA,CAAA,KAAY;IACjB,IAAI;MACF,OAAOhC,qBAAY,CAACgC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,OAAO/B,CAAC,EAAE;MACV,OAAOA,CAAC;IACV;EACF;AACF,CAAC;AAAC5B,OAAA,CAAAqB,aAAA,GAAAA,aAAA;AAEK,SAASuC,qBAAqBA,CAAA,EAAqB;EACxD,OAAOlE,aAAa,CAACkE,qBAAqB,CAAC,CAAC;AAC9C;AAAC,IAAAC,QAAA,GAEcnE,aAAa;AAAAM,OAAA,CAAAX,OAAA,GAAAwE,QAAA"}
@@ -4,7 +4,6 @@ export const isJsonString = value => {
4
4
  } catch (e) {
5
5
  return false;
6
6
  }
7
-
8
7
  return true;
9
8
  };
10
9
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isJsonString","value","JSON","parse","e"],"sources":["helpers.ts"],"sourcesContent":["export const isJsonString = (value: string): boolean => {\n try {\n JSON.parse(value);\n } catch (e) {\n return false;\n }\n return true;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAIC,KAAD,IAA4B;EACtD,IAAI;IACFC,IAAI,CAACC,KAAL,CAAWF,KAAX;EACD,CAFD,CAEE,OAAOG,CAAP,EAAU;IACV,OAAO,KAAP;EACD;;EACD,OAAO,IAAP;AACD,CAPM"}
1
+ {"version":3,"names":["isJsonString","value","JSON","parse","e"],"sourceRoot":"../../src","sources":["helpers.ts"],"mappings":"AAAA,OAAO,MAAMA,YAAY,GAAIC,KAAa,IAAc;EACtD,IAAI;IACFC,IAAI,CAACC,KAAK,CAACF,KAAK,CAAC;EACnB,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,OAAO,KAAK;EACd;EACA,OAAO,IAAI;AACb,CAAC"}
@@ -10,7 +10,6 @@ const SecuritySuite = NativeModules.SecuritySuite ? NativeModules.SecuritySuite
10
10
  get() {
11
11
  throw new Error(LINKING_ERROR);
12
12
  }
13
-
14
13
  });
15
14
  export const getPublicKey = () => SecuritySuite.getPublicKey();
16
15
  export const getSharedKey = serverPublicKey => SecuritySuite.getSharedKey(serverPublicKey);
@@ -95,14 +94,16 @@ export const SecureStorage = {
95
94
  multiSet: async keyValuePairs => {
96
95
  try {
97
96
  const encryptedKeyValuePairs = await Promise.all(keyValuePairs.map(async item => {
98
- if (item.length !== 2) return [];
99
- const encryptedKey = await encrypt(item[0], false);
100
- const encryptedValue = await encrypt(item[1]);
101
- return [encryptedKey, encryptedValue];
97
+ if (item.length === 2 && item[0] && item[1]) {
98
+ const encryptedKey = await encrypt(item[0], false);
99
+ const encryptedValue = await encrypt(item[1]);
100
+ return [encryptedKey, encryptedValue];
101
+ }
102
+ return null;
102
103
  }));
103
104
  AsyncStorage.multiSet(encryptedKeyValuePairs);
104
105
  } catch (e) {
105
- return e;
106
+ console.error('multiSet error: ', e);
106
107
  }
107
108
  },
108
109
  multiGet: async keys => {
@@ -122,14 +123,16 @@ export const SecureStorage = {
122
123
  multiMerge: async keyValuePairs => {
123
124
  try {
124
125
  return keyValuePairs.map(async item => {
125
- if (item.length !== 2) return;
126
- const encryptedKey = await encrypt(item[0], false);
127
- const encryptedData = await AsyncStorage.getItem(item[0]);
128
- const data = await decrypt(encryptedData ?? '');
129
- if (!isJsonString(data) || !isJsonString(item[1])) return null;
130
- const mergedData = await JSON.stringify(_.merge(JSON.parse(data), JSON.parse(item[1])));
131
- const encryptedValue = await encrypt(mergedData, false);
132
- return AsyncStorage.setItem(encryptedKey, encryptedValue);
126
+ if (item.length === 2 && item[0] && item[1]) {
127
+ const encryptedKey = await encrypt(item[0], false);
128
+ const encryptedData = await AsyncStorage.getItem(item[0]);
129
+ const data = await decrypt(encryptedData ?? '');
130
+ if (!isJsonString(data) || !isJsonString(item[1])) return null;
131
+ const mergedData = await JSON.stringify(_.merge(JSON.parse(data), JSON.parse(item[1])));
132
+ const encryptedValue = await encrypt(mergedData, false);
133
+ return AsyncStorage.setItem(encryptedKey, encryptedValue);
134
+ }
135
+ return null;
133
136
  });
134
137
  } catch (e) {
135
138
  return e;
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","AsyncStorage","_","isJsonString","LINKING_ERROR","select","ios","default","SecuritySuite","Proxy","get","Error","getPublicKey","getSharedKey","serverPublicKey","encryptBySharedKey","input","encrypt","decryptBySharedKey","decrypt","getDeviceId","Promise","resolve","reject","result","error","hardEncryption","secretKey","storageEncrypt","storageDecrypt","SecureStorage","setItem","key","value","encryptedKey","encryptedValue","e","getItem","encryptedData","mergeItem","data","mergedData","JSON","stringify","merge","parse","removeItem","getAllKeys","encryptedKeys","all","map","item","decryptedKey","multiSet","keyValuePairs","encryptedKeyValuePairs","length","multiGet","keys","Array","isArray","encryptedItems","decryptedalue","multiMerge","multiRemove","clear","deviceHasSecurityRisk"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport _ from 'lodash';\nimport { isJsonString } from './helpers';\n\nconst LINKING_ERROR =\n `The package 'react-native-security-suite' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst SecuritySuite = NativeModules.SecuritySuite\n ? NativeModules.SecuritySuite\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const getPublicKey = (): Promise<string> => SecuritySuite.getPublicKey();\n\nexport const getSharedKey = (serverPublicKey: string): Promise<string> =>\n SecuritySuite.getSharedKey(serverPublicKey);\n\nexport const encryptBySharedKey = (input: string): Promise<string> =>\n input && typeof input === 'string' ? SecuritySuite.encrypt(input) : '';\n\nexport const decryptBySharedKey = (input: string) =>\n input && typeof input === 'string' ? SecuritySuite.decrypt(input) : '';\n\nexport const getDeviceId = (): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n SecuritySuite.getDeviceId((result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n });\n });\n\nexport const encrypt = (\n input: string,\n hardEncryption = true,\n secretKey = null\n): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n if (!input) resolve(input);\n\n SecuritySuite.storageEncrypt(\n input,\n secretKey,\n hardEncryption,\n (result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n }\n );\n });\n\nexport const decrypt = (\n input: string,\n hardEncryption = true,\n secretKey = null\n): Promise<string> =>\n new Promise((resolve: any, reject: any) => {\n if (!input) resolve(input);\n\n SecuritySuite.storageDecrypt(\n input,\n secretKey,\n hardEncryption,\n (result: string | null, error: string | null) => {\n if (error !== null) reject(error);\n else resolve(result);\n }\n );\n });\n\nexport const SecureStorage = {\n setItem: async (key: string, value: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedValue = await encrypt(value);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n } catch (e) {\n return e;\n }\n },\n getItem: async (key: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedData = await AsyncStorage.getItem(encryptedKey);\n return decrypt(encryptedData ?? '');\n } catch (e) {\n return e;\n }\n },\n mergeItem: async (key: string, value: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n const encryptedData = await AsyncStorage.getItem(encryptedKey);\n const data = await decrypt(encryptedData ?? '');\n if (!isJsonString(data) || !isJsonString(value)) return null;\n const mergedData = await JSON.stringify(\n _.merge(JSON.parse(data), JSON.parse(value))\n );\n const encryptedValue = await encrypt(mergedData);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n } catch (e) {\n return e;\n }\n },\n removeItem: async (key: string) => {\n try {\n const encryptedKey = await encrypt(key, false);\n return AsyncStorage.removeItem(encryptedKey);\n } catch (e) {\n return e;\n }\n },\n getAllKeys: async () => {\n try {\n const encryptedKeys = await AsyncStorage.getAllKeys();\n return await Promise.all(\n encryptedKeys.map(async (item: string): Promise<string> => {\n const decryptedKey = await decrypt(item, false);\n return decryptedKey ? decryptedKey : item;\n })\n );\n } catch (e) {\n return e;\n }\n },\n multiSet: async (keyValuePairs: Array<Array<string>>) => {\n try {\n const encryptedKeyValuePairs: any = await Promise.all(\n keyValuePairs.map(async (item: Array<string>) => {\n if (item.length !== 2) return [];\n const encryptedKey = await encrypt(item[0], false);\n const encryptedValue = await encrypt(item[1]);\n return [encryptedKey, encryptedValue];\n })\n );\n AsyncStorage.multiSet(encryptedKeyValuePairs);\n } catch (e) {\n return e;\n }\n },\n multiGet: async (keys: Array<string>) => {\n try {\n if (!Array.isArray(keys)) return null;\n const encryptedKeys = await Promise.all(\n keys.map(\n async (item: string): Promise<string> => await encrypt(item, false)\n )\n );\n const encryptedItems = await AsyncStorage.multiGet(encryptedKeys);\n return await Promise.all(\n encryptedItems && encryptedItems.length\n ? encryptedItems.map(async (item: any): Promise<string[]> => {\n const decryptedKey = await decrypt(item[0], false);\n const decryptedalue = await decrypt(item[1]);\n return [decryptedKey, decryptedalue];\n })\n : []\n );\n } catch (e) {\n return e;\n }\n },\n multiMerge: async (keyValuePairs: Array<Array<string>>) => {\n try {\n return keyValuePairs.map(async (item: Array<string>) => {\n if (item.length !== 2) return;\n const encryptedKey = await encrypt(item[0], false);\n const encryptedData = await AsyncStorage.getItem(item[0]);\n const data = await decrypt(encryptedData ?? '');\n if (!isJsonString(data) || !isJsonString(item[1])) return null;\n const mergedData = await JSON.stringify(\n _.merge(JSON.parse(data), JSON.parse(item[1]))\n );\n const encryptedValue = await encrypt(mergedData, false);\n return AsyncStorage.setItem(encryptedKey, encryptedValue);\n });\n } catch (e) {\n return e;\n }\n },\n multiRemove: async (keys: Array<string>) => {\n try {\n if (!Array.isArray(keys)) return keys;\n const encryptedKeys = await Promise.all(\n keys.map(\n async (item: string): Promise<string> => await encrypt(item, false)\n )\n );\n return AsyncStorage.multiRemove(encryptedKeys);\n } catch (e) {\n return e;\n }\n },\n clear: async () => {\n try {\n return AsyncStorage.clear();\n } catch (e) {\n return e;\n }\n },\n};\n\nexport function deviceHasSecurityRisk(): Promise<boolean> {\n return SecuritySuite.deviceHasSecurityRisk();\n}\n\nexport default SecuritySuite;\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AACA,OAAOC,YAAP,MAAyB,2CAAzB;AACA,OAAOC,CAAP,MAAc,QAAd;AACA,SAASC,YAAT,QAA6B,WAA7B;AAEA,MAAMC,aAAa,GAChB,sFAAD,GACAJ,QAAQ,CAACK,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGT,aAAa,CAACS,aAAd,GAClBT,aAAa,CAACS,aADI,GAElB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,OAAO,MAAMQ,YAAY,GAAG,MAAuBJ,aAAa,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4B,WAAW,EAAE,MAAON,IAAP,IAA+B;IAC1C,IAAI;MACF,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,IAAd,CAAL,EAA0B,OAAOA,IAAP;MAC1B,MAAMV,aAAa,GAAG,MAAM3B,OAAO,CAAC4B,GAAR,CAC1BS,IAAI,CAACR,GAAL,CACE,MAAOC,IAAP,IAAyC,MAAMlC,OAAO,CAACkC,IAAD,EAAO,KAAP,CADxD,CAD0B,CAA5B;MAKA,OAAOlD,YAAY,CAAC+D,WAAb,CAAyBhB,aAAzB,CAAP;IACD,CARD,CAQE,OAAOZ,CAAP,EAAU;MACV,OAAOA,CAAP;IACD;EACF,CA1H0B;EA2H3B6B,KAAK,EAAE,YAAY;IACjB,IAAI;MACF,OAAOhE,YAAY,CAACgE,KAAb,EAAP;IACD,CAFD,CAEE,OAAO7B,CAAP,EAAU;MACV,OAAOA,CAAP;IACD;EACF;AAjI0B,CAAtB;AAoIP,OAAO,SAAS8B,qBAAT,GAAmD;EACxD,OAAO1D,aAAa,CAAC0D,qBAAd,EAAP;AACD;AAED,eAAe1D,aAAf"}
1
+ {"version":3,"names":["NativeModules","Platform","AsyncStorage","_","isJsonString","LINKING_ERROR","select","ios","default","SecuritySuite","Proxy","get","Error","getPublicKey","getSharedKey","serverPublicKey","encryptBySharedKey","input","encrypt","decryptBySharedKey","decrypt","getDeviceId","Promise","resolve","reject","result","error","hardEncryption","arguments","length","undefined","secretKey","storageEncrypt","storageDecrypt","SecureStorage","setItem","key","value","encryptedKey","encryptedValue","e","getItem","encryptedData","mergeItem","data","mergedData","JSON","stringify","merge","parse","removeItem","getAllKeys","encryptedKeys","all","map","item","decryptedKey","multiSet","keyValuePairs","encryptedKeyValuePairs","console","multiGet","keys","Array","isArray","encryptedItems","decryptedalue","multiMerge","multiRemove","clear","deviceHasSecurityRisk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,OAAOC,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,YAAY,CAACkE,WAAW,CAAChB,aAAa,CAAC;IAChD,CAAC,CAAC,OAAOZ,CAAC,EAAE;MACV,OAAOA,CAAC;IACV;EACF,CAAC;EACD6B,KAAK,EAAE,MAAAA,CAAA,KAAY;IACjB,IAAI;MACF,OAAOnE,YAAY,CAACmE,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,OAAO7B,CAAC,EAAE;MACV,OAAOA,CAAC;IACV;EACF;AACF,CAAC;AAED,OAAO,SAAS8B,qBAAqBA,CAAA,EAAqB;EACxD,OAAO7D,aAAa,CAAC6D,qBAAqB,CAAC,CAAC;AAC9C;AAEA,eAAe7D,aAAa"}
@@ -1 +1,2 @@
1
1
  export declare const isJsonString: (value: string) => boolean;
2
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAO5C,CAAC"}
@@ -12,7 +12,7 @@ export declare const SecureStorage: {
12
12
  mergeItem: (key: string, value: string) => Promise<unknown>;
13
13
  removeItem: (key: string) => Promise<unknown>;
14
14
  getAllKeys: () => Promise<unknown>;
15
- multiSet: (keyValuePairs: Array<Array<string>>) => Promise<unknown>;
15
+ multiSet: (keyValuePairs: Array<Array<string>>) => Promise<void | string[][]>;
16
16
  multiGet: (keys: Array<string>) => Promise<unknown>;
17
17
  multiMerge: (keyValuePairs: Array<Array<string>>) => Promise<unknown>;
18
18
  multiRemove: (keys: Array<string>) => Promise<unknown>;
@@ -20,3 +20,4 @@ export declare const SecureStorage: {
20
20
  };
21
21
  export declare function deviceHasSecurityRisk(): Promise<boolean>;
22
22
  export default SecuritySuite;
23
+ //# sourceMappingURL=index.d.ts.map