react-native-security-suite 0.9.22 → 1.0.0-rc.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.
Files changed (189) hide show
  1. package/README.md +235 -69
  2. package/android/build.gradle +11 -0
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/securitysuite/CryptoConfig.java +158 -0
  5. package/android/src/main/java/com/securitysuite/CryptoUtils.java +152 -0
  6. package/android/src/main/java/com/securitysuite/EcdhKeyStore.java +60 -0
  7. package/android/src/main/java/com/securitysuite/HeaderSanitizer.java +75 -0
  8. package/android/src/main/java/com/securitysuite/JWSGenerator.java +237 -32
  9. package/android/src/main/java/com/securitysuite/JwsFetchPayload.java +81 -0
  10. package/android/src/main/java/com/securitysuite/Obfuscation.java +57 -0
  11. package/android/src/main/java/com/securitysuite/SecureStorageNative.java +211 -0
  12. package/android/src/main/java/com/securitysuite/SecureView.java +2 -10
  13. package/android/src/main/java/com/securitysuite/SecureWindowHelper.java +30 -0
  14. package/android/src/main/java/com/securitysuite/SecuritySuiteModule.java +310 -102
  15. package/android/src/main/java/com/securitysuite/Sslpinning.java +219 -106
  16. package/android/src/main/java/com/securitysuite/security/AppIntegrityChecker.java +133 -0
  17. package/android/src/main/java/com/securitysuite/security/EmulatorDetector.java +145 -0
  18. package/android/src/main/java/com/securitysuite/security/RuntimeDetector.java +234 -0
  19. package/android/src/test/java/com/securitysuite/JWSGeneratorTest.java +153 -0
  20. package/android/src/test/java/com/securitysuite/SecureStorageNativeTest.java +37 -0
  21. package/ios/CryptoConfig.swift +124 -0
  22. package/ios/JWSGenerator.swift +288 -0
  23. package/ios/JWSGeneratorTests.swift +168 -0
  24. package/ios/KeychainHelper.swift +104 -0
  25. package/ios/Obfuscation.swift +42 -0
  26. package/ios/SecureStorageNative.swift +84 -0
  27. package/ios/Security/AppIntegrityChecker.swift +85 -0
  28. package/ios/Security/EmulatorDetector.swift +45 -0
  29. package/ios/Security/RuntimeDetector.swift +107 -0
  30. package/ios/SecuritySuite.mm +28 -4
  31. package/ios/SecuritySuite.swift +407 -131
  32. package/ios/SslPinning.swift +242 -263
  33. package/lib/commonjs/clipboard/index.js +3 -0
  34. package/lib/commonjs/clipboard/index.js.map +1 -0
  35. package/lib/commonjs/crypto/index.js +39 -0
  36. package/lib/commonjs/crypto/index.js.map +1 -0
  37. package/lib/commonjs/device/index.js +40 -0
  38. package/lib/commonjs/device/index.js.map +1 -0
  39. package/lib/commonjs/errors.js +62 -0
  40. package/lib/commonjs/errors.js.map +1 -0
  41. package/lib/commonjs/index.js +220 -151
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/integrity/index.js +40 -0
  44. package/lib/commonjs/integrity/index.js.map +1 -0
  45. package/lib/commonjs/jws.js +141 -0
  46. package/lib/commonjs/jws.js.map +1 -0
  47. package/lib/commonjs/legacy/cryptoOptions.js +20 -0
  48. package/lib/commonjs/legacy/cryptoOptions.js.map +1 -0
  49. package/lib/commonjs/native/bridge.js +23 -0
  50. package/lib/commonjs/native/bridge.js.map +1 -0
  51. package/lib/commonjs/network/index.js +3 -0
  52. package/lib/commonjs/network/index.js.map +1 -0
  53. package/lib/commonjs/risk/score.js +36 -0
  54. package/lib/commonjs/risk/score.js.map +1 -0
  55. package/lib/commonjs/runtime/index.js +31 -0
  56. package/lib/commonjs/runtime/index.js.map +1 -0
  57. package/lib/commonjs/screen/index.js +13 -0
  58. package/lib/commonjs/screen/index.js.map +1 -0
  59. package/lib/commonjs/securitySuite/index.js +42 -0
  60. package/lib/commonjs/securitySuite/index.js.map +1 -0
  61. package/lib/commonjs/storage/index.js +3 -0
  62. package/lib/commonjs/storage/index.js.map +1 -0
  63. package/lib/commonjs/types/detection.js +2 -0
  64. package/lib/commonjs/types/detection.js.map +1 -0
  65. package/lib/module/clipboard/index.js +3 -0
  66. package/lib/module/clipboard/index.js.map +1 -0
  67. package/lib/module/crypto/index.js +35 -0
  68. package/lib/module/crypto/index.js.map +1 -0
  69. package/lib/module/device/index.js +36 -0
  70. package/lib/module/device/index.js.map +1 -0
  71. package/lib/module/errors.js +55 -0
  72. package/lib/module/errors.js.map +1 -0
  73. package/lib/module/index.js +147 -148
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/integrity/index.js +36 -0
  76. package/lib/module/integrity/index.js.map +1 -0
  77. package/lib/module/jws.js +127 -0
  78. package/lib/module/jws.js.map +1 -0
  79. package/lib/module/legacy/cryptoOptions.js +16 -0
  80. package/lib/module/legacy/cryptoOptions.js.map +1 -0
  81. package/lib/module/native/bridge.js +19 -0
  82. package/lib/module/native/bridge.js.map +1 -0
  83. package/lib/module/network/index.js +3 -0
  84. package/lib/module/network/index.js.map +1 -0
  85. package/lib/module/risk/score.js +32 -0
  86. package/lib/module/risk/score.js.map +1 -0
  87. package/lib/module/runtime/index.js +27 -0
  88. package/lib/module/runtime/index.js.map +1 -0
  89. package/lib/module/screen/index.js +5 -0
  90. package/lib/module/screen/index.js.map +1 -0
  91. package/lib/module/securitySuite/index.js +38 -0
  92. package/lib/module/securitySuite/index.js.map +1 -0
  93. package/lib/module/storage/index.js +3 -0
  94. package/lib/module/storage/index.js.map +1 -0
  95. package/lib/module/types/detection.js +2 -0
  96. package/lib/module/types/detection.js.map +1 -0
  97. package/lib/typescript/commonjs/docs/api-v1-proposal.d.ts +215 -0
  98. package/lib/typescript/commonjs/docs/api-v1-proposal.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/SecureView.d.ts +1 -1
  100. package/lib/typescript/commonjs/src/SecureView.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/clipboard/index.d.ts +2 -0
  102. package/lib/typescript/commonjs/src/clipboard/index.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/src/crypto/index.d.ts +15 -0
  104. package/lib/typescript/commonjs/src/crypto/index.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/src/device/index.d.ts +11 -0
  106. package/lib/typescript/commonjs/src/device/index.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/errors.d.ts +17 -0
  108. package/lib/typescript/commonjs/src/errors.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/helpers.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/src/index.d.ts +77 -24
  111. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/src/integrity/index.d.ts +6 -0
  113. package/lib/typescript/commonjs/src/integrity/index.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/src/jws.d.ts +44 -0
  115. package/lib/typescript/commonjs/src/jws.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/src/legacy/cryptoOptions.d.ts +35 -0
  117. package/lib/typescript/commonjs/src/legacy/cryptoOptions.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/src/native/bridge.d.ts +12 -0
  119. package/lib/typescript/commonjs/src/native/bridge.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/src/network/index.d.ts +2 -0
  121. package/lib/typescript/commonjs/src/network/index.d.ts.map +1 -0
  122. package/lib/typescript/commonjs/src/risk/score.d.ts +12 -0
  123. package/lib/typescript/commonjs/src/risk/score.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/src/runtime/index.d.ts +6 -0
  125. package/lib/typescript/commonjs/src/runtime/index.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/src/screen/index.d.ts +3 -0
  127. package/lib/typescript/commonjs/src/screen/index.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/src/securitySuite/index.d.ts +6 -0
  129. package/lib/typescript/commonjs/src/securitySuite/index.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/src/storage/index.d.ts +2 -0
  131. package/lib/typescript/commonjs/src/storage/index.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/src/types/detection.d.ts +41 -0
  133. package/lib/typescript/commonjs/src/types/detection.d.ts.map +1 -0
  134. package/lib/typescript/module/docs/api-v1-proposal.d.ts +215 -0
  135. package/lib/typescript/module/docs/api-v1-proposal.d.ts.map +1 -0
  136. package/lib/typescript/module/src/SecureView.d.ts +1 -1
  137. package/lib/typescript/module/src/SecureView.d.ts.map +1 -1
  138. package/lib/typescript/module/src/clipboard/index.d.ts +2 -0
  139. package/lib/typescript/module/src/clipboard/index.d.ts.map +1 -0
  140. package/lib/typescript/module/src/crypto/index.d.ts +15 -0
  141. package/lib/typescript/module/src/crypto/index.d.ts.map +1 -0
  142. package/lib/typescript/module/src/device/index.d.ts +11 -0
  143. package/lib/typescript/module/src/device/index.d.ts.map +1 -0
  144. package/lib/typescript/module/src/errors.d.ts +17 -0
  145. package/lib/typescript/module/src/errors.d.ts.map +1 -0
  146. package/lib/typescript/module/src/helpers.d.ts.map +1 -1
  147. package/lib/typescript/module/src/index.d.ts +77 -24
  148. package/lib/typescript/module/src/index.d.ts.map +1 -1
  149. package/lib/typescript/module/src/integrity/index.d.ts +6 -0
  150. package/lib/typescript/module/src/integrity/index.d.ts.map +1 -0
  151. package/lib/typescript/module/src/jws.d.ts +44 -0
  152. package/lib/typescript/module/src/jws.d.ts.map +1 -0
  153. package/lib/typescript/module/src/legacy/cryptoOptions.d.ts +35 -0
  154. package/lib/typescript/module/src/legacy/cryptoOptions.d.ts.map +1 -0
  155. package/lib/typescript/module/src/native/bridge.d.ts +12 -0
  156. package/lib/typescript/module/src/native/bridge.d.ts.map +1 -0
  157. package/lib/typescript/module/src/network/index.d.ts +2 -0
  158. package/lib/typescript/module/src/network/index.d.ts.map +1 -0
  159. package/lib/typescript/module/src/risk/score.d.ts +12 -0
  160. package/lib/typescript/module/src/risk/score.d.ts.map +1 -0
  161. package/lib/typescript/module/src/runtime/index.d.ts +6 -0
  162. package/lib/typescript/module/src/runtime/index.d.ts.map +1 -0
  163. package/lib/typescript/module/src/screen/index.d.ts +3 -0
  164. package/lib/typescript/module/src/screen/index.d.ts.map +1 -0
  165. package/lib/typescript/module/src/securitySuite/index.d.ts +6 -0
  166. package/lib/typescript/module/src/securitySuite/index.d.ts.map +1 -0
  167. package/lib/typescript/module/src/storage/index.d.ts +2 -0
  168. package/lib/typescript/module/src/storage/index.d.ts.map +1 -0
  169. package/lib/typescript/module/src/types/detection.d.ts +41 -0
  170. package/lib/typescript/module/src/types/detection.d.ts.map +1 -0
  171. package/package.json +2 -10
  172. package/src/clipboard/index.ts +1 -0
  173. package/src/crypto/index.ts +49 -0
  174. package/src/device/index.ts +47 -0
  175. package/src/errors.ts +84 -0
  176. package/src/index.tsx +293 -195
  177. package/src/integrity/index.ts +46 -0
  178. package/src/jws.ts +213 -0
  179. package/src/legacy/cryptoOptions.ts +49 -0
  180. package/src/native/bridge.ts +37 -0
  181. package/src/network/index.ts +1 -0
  182. package/src/risk/score.ts +49 -0
  183. package/src/runtime/index.ts +43 -0
  184. package/src/screen/index.ts +2 -0
  185. package/src/securitySuite/index.ts +45 -0
  186. package/src/storage/index.ts +1 -0
  187. package/src/types/detection.ts +46 -0
  188. package/android/src/main/java/com/securitysuite/StorageEncryption.java +0 -52
  189. package/ios/StorageEncryption.swift +0 -89
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SecurityErrorCode = exports.SecurityError = void 0;
7
+ exports.isSecurityError = isSecurityError;
8
+ exports.mapNativeError = mapNativeError;
9
+ let SecurityErrorCode = exports.SecurityErrorCode = /*#__PURE__*/function (SecurityErrorCode) {
10
+ SecurityErrorCode["ROOT_DETECTED"] = "ROOT_DETECTED";
11
+ SecurityErrorCode["JAILBREAK_DETECTED"] = "JAILBREAK_DETECTED";
12
+ SecurityErrorCode["FRIDA_DETECTED"] = "FRIDA_DETECTED";
13
+ SecurityErrorCode["DEBUGGER_DETECTED"] = "DEBUGGER_DETECTED";
14
+ SecurityErrorCode["SSL_PINNING_FAILED"] = "SSL_PINNING_FAILED";
15
+ SecurityErrorCode["SECURE_STORAGE_UNAVAILABLE"] = "SECURE_STORAGE_UNAVAILABLE";
16
+ SecurityErrorCode["CRYPTO_KEY_NOT_FOUND"] = "CRYPTO_KEY_NOT_FOUND";
17
+ return SecurityErrorCode;
18
+ }({});
19
+ const NATIVE_CODE_MAP = {
20
+ ROOT_DETECTED: SecurityErrorCode.ROOT_DETECTED,
21
+ JAILBREAK_DETECTED: SecurityErrorCode.JAILBREAK_DETECTED,
22
+ FRIDA_DETECTED: SecurityErrorCode.FRIDA_DETECTED,
23
+ DEBUGGER_DETECTED: SecurityErrorCode.DEBUGGER_DETECTED,
24
+ SSL_PINNING_FAILED: SecurityErrorCode.SSL_PINNING_FAILED,
25
+ SECURE_STORAGE_ERROR: SecurityErrorCode.SECURE_STORAGE_UNAVAILABLE,
26
+ SECURE_STORAGE_UNAVAILABLE: SecurityErrorCode.SECURE_STORAGE_UNAVAILABLE,
27
+ GET_SHARED_KEY_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
28
+ ENCRYPT_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
29
+ DECRYPT_ERROR: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND,
30
+ CRYPTO_KEY_NOT_FOUND: SecurityErrorCode.CRYPTO_KEY_NOT_FOUND
31
+ };
32
+ class SecurityError extends Error {
33
+ constructor(code, message, details) {
34
+ super(message);
35
+ this.name = 'SecurityError';
36
+ this.code = code;
37
+ this.details = details;
38
+ }
39
+ }
40
+ exports.SecurityError = SecurityError;
41
+ function isSecurityError(error) {
42
+ return error instanceof SecurityError;
43
+ }
44
+ function mapNativeError(error) {
45
+ if (error instanceof SecurityError) {
46
+ return error;
47
+ }
48
+ const nativeError = error;
49
+ const code = typeof nativeError?.code === 'string' ? nativeError.code : error instanceof Error && 'code' in error ? String(error.code) : undefined;
50
+ const message = typeof nativeError?.message === 'string' ? nativeError.message : error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown security error';
51
+ if (code && NATIVE_CODE_MAP[code]) {
52
+ return new SecurityError(NATIVE_CODE_MAP[code], message, {
53
+ nativeCode: code,
54
+ ...(nativeError?.userInfo ?? {})
55
+ });
56
+ }
57
+ if (error instanceof Error) {
58
+ return error;
59
+ }
60
+ return new Error(message);
61
+ }
62
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SecurityErrorCode","exports","NATIVE_CODE_MAP","ROOT_DETECTED","JAILBREAK_DETECTED","FRIDA_DETECTED","DEBUGGER_DETECTED","SSL_PINNING_FAILED","SECURE_STORAGE_ERROR","SECURE_STORAGE_UNAVAILABLE","GET_SHARED_KEY_ERROR","CRYPTO_KEY_NOT_FOUND","ENCRYPT_ERROR","DECRYPT_ERROR","SecurityError","Error","constructor","code","message","details","name","isSecurityError","error","mapNativeError","nativeError","String","undefined","nativeCode","userInfo"],"sourceRoot":"../../src","sources":["errors.ts"],"mappings":";;;;;;;;IAAYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAU7B,MAAME,eAAkD,GAAG;EACzDC,aAAa,EAAEH,iBAAiB,CAACG,aAAa;EAC9CC,kBAAkB,EAAEJ,iBAAiB,CAACI,kBAAkB;EACxDC,cAAc,EAAEL,iBAAiB,CAACK,cAAc;EAChDC,iBAAiB,EAAEN,iBAAiB,CAACM,iBAAiB;EACtDC,kBAAkB,EAAEP,iBAAiB,CAACO,kBAAkB;EACxDC,oBAAoB,EAAER,iBAAiB,CAACS,0BAA0B;EAClEA,0BAA0B,EAAET,iBAAiB,CAACS,0BAA0B;EACxEC,oBAAoB,EAAEV,iBAAiB,CAACW,oBAAoB;EAC5DC,aAAa,EAAEZ,iBAAiB,CAACW,oBAAoB;EACrDE,aAAa,EAAEb,iBAAiB,CAACW,oBAAoB;EACrDA,oBAAoB,EAAEX,iBAAiB,CAACW;AAC1C,CAAC;AAEM,MAAMG,aAAa,SAASC,KAAK,CAAC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 +8,90 @@ var _exportNames = {
8
8
  getSharedKey: true,
9
9
  encryptBySharedKey: true,
10
10
  decryptBySharedKey: true,
11
+ generateJWS: true,
12
+ obfuscate: true,
13
+ deobfuscate: true,
11
14
  getDeviceId: true,
12
15
  encrypt: true,
13
16
  decrypt: true,
14
17
  SecureStorage: true,
15
18
  fetch: true,
16
- deviceHasSecurityRisk: true
19
+ deviceHasSecurityRisk: true,
20
+ SecurityError: true,
21
+ SecurityErrorCode: true,
22
+ mapNativeError: true,
23
+ isSecurityError: true,
24
+ DeviceSecurity: true,
25
+ RuntimeSecurity: true,
26
+ AppIntegrity: true,
27
+ Crypto: true,
28
+ SecuritySuite: true
17
29
  };
18
- exports.default = exports.decryptBySharedKey = exports.decrypt = exports.SecureStorage = void 0;
30
+ Object.defineProperty(exports, "AppIntegrity", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _index3.AppIntegrity;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "Crypto", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _index4.Crypto;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "DeviceSecurity", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _index.DeviceSecurity;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "RuntimeSecurity", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _index2.RuntimeSecurity;
52
+ }
53
+ });
54
+ exports.SecureStorage = void 0;
55
+ Object.defineProperty(exports, "SecurityError", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _errors.SecurityError;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, "SecurityErrorCode", {
62
+ enumerable: true,
63
+ get: function () {
64
+ return _errors.SecurityErrorCode;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, "SecuritySuite", {
68
+ enumerable: true,
69
+ get: function () {
70
+ return _index5.SecuritySuite;
71
+ }
72
+ });
73
+ exports.deobfuscate = exports.default = exports.decryptBySharedKey = exports.decrypt = void 0;
19
74
  exports.deviceHasSecurityRisk = deviceHasSecurityRisk;
20
75
  exports.encryptBySharedKey = exports.encrypt = void 0;
21
76
  exports.fetch = fetch;
22
- exports.getSharedKey = exports.getPublicKey = exports.getDeviceId = void 0;
77
+ exports.getSharedKey = exports.getPublicKey = exports.getDeviceId = exports.generateJWS = void 0;
78
+ Object.defineProperty(exports, "isSecurityError", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _errors.isSecurityError;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "mapNativeError", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _errors.mapNativeError;
88
+ }
89
+ });
90
+ exports.obfuscate = void 0;
23
91
  var _reactNative = require("react-native");
24
- var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
25
92
  var _helpers = require("./helpers.js");
93
+ var _cryptoOptions = require("./legacy/cryptoOptions.js");
94
+ var _jws = require("./jws.js");
26
95
  var _SecureView = require("./SecureView.js");
27
96
  Object.keys(_SecureView).forEach(function (key) {
28
97
  if (key === "default" || key === "__esModule") return;
@@ -35,196 +104,196 @@ Object.keys(_SecureView).forEach(function (key) {
35
104
  }
36
105
  });
37
106
  });
38
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
39
- /*
40
- * SSL Pinnning start
41
- */
107
+ var _errors = require("./errors.js");
108
+ var _index = require("./device/index.js");
109
+ var _index2 = require("./runtime/index.js");
110
+ var _index3 = require("./integrity/index.js");
111
+ var _index4 = require("./crypto/index.js");
112
+ var _index5 = require("./securitySuite/index.js");
113
+ /** @deprecated Use `JwsHeaders` (optional `Record<string, JwsHeaderValue>`) instead. */
42
114
 
43
115
  const LINKING_ERROR = `The package 'react-native-security-suite' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
44
116
  ios: "- You have run 'pod install'\n",
45
117
  default: ''
46
118
  }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
47
- const SecuritySuite = _reactNative.NativeModules.SecuritySuite ? _reactNative.NativeModules.SecuritySuite : new Proxy({}, {
119
+ const NativeSecuritySuiteModule = _reactNative.NativeModules.SecuritySuite ? _reactNative.NativeModules.SecuritySuite : new Proxy({}, {
48
120
  get() {
49
121
  throw new Error(LINKING_ERROR);
50
122
  }
51
123
  });
52
- const getPublicKey = () => SecuritySuite.getPublicKey();
124
+ const getPublicKey = () => NativeSecuritySuiteModule.getPublicKey();
125
+
126
+ /**
127
+ * @deprecated Prefer `Crypto.establishSharedKey()` which keeps the derived key in native memory.
128
+ */
53
129
  exports.getPublicKey = getPublicKey;
54
- const getSharedKey = serverPublicKey => SecuritySuite.getSharedKey(serverPublicKey);
130
+ const getSharedKey = (serverPublicKey, options) => NativeSecuritySuiteModule.getSharedKey(serverPublicKey, (0, _cryptoOptions.toNativeCryptoOptions)(options));
55
131
  exports.getSharedKey = getSharedKey;
56
- const encryptBySharedKey = input => input && typeof input === 'string' ? SecuritySuite.encrypt(input) : '';
132
+ const encryptBySharedKey = (input, options) => {
133
+ if (!input || typeof input !== 'string') {
134
+ return Promise.reject(new Error('Input must be a non-empty string'));
135
+ }
136
+ return NativeSecuritySuiteModule.encrypt(input, (0, _cryptoOptions.toNativeCryptoOptions)(options));
137
+ };
57
138
  exports.encryptBySharedKey = encryptBySharedKey;
58
- const decryptBySharedKey = input => input && typeof input === 'string' ? SecuritySuite.decrypt(input) : '';
139
+ const decryptBySharedKey = (input, options) => {
140
+ if (!input || typeof input !== 'string') {
141
+ return Promise.reject(new Error('Input must be a non-empty string'));
142
+ }
143
+ return NativeSecuritySuiteModule.decrypt(input, (0, _cryptoOptions.toNativeCryptoOptions)(options));
144
+ };
59
145
  exports.decryptBySharedKey = decryptBySharedKey;
146
+ const generateJWS = options => {
147
+ const nativeOptions = (0, _jws.toNativeGenerateJWSOptions)(options);
148
+ return NativeSecuritySuiteModule.generateJWS(nativeOptions);
149
+ };
150
+ exports.generateJWS = generateJWS;
151
+ function normalizeFetchOptions(options) {
152
+ if (!options.jws) {
153
+ return options;
154
+ }
155
+ const nativeJws = (0, _jws.toNativeJwsFetchOptions)(options.jws);
156
+ return {
157
+ ...options,
158
+ jws: {
159
+ algorithm: nativeJws.algorithm,
160
+ secret: nativeJws.secret,
161
+ headers: nativeJws.headers,
162
+ detached: nativeJws.detached,
163
+ ...(options.jws.headerName ? {
164
+ headerName: options.jws.headerName
165
+ } : {}),
166
+ ...(options.jws.payload !== undefined ? {
167
+ payload: nativeJws.payload
168
+ } : {})
169
+ }
170
+ };
171
+ }
172
+
173
+ /**
174
+ * Local obfuscation only — NOT secure encryption. Requires an explicit secret.
175
+ * Never use for credentials, tokens, or PII at rest.
176
+ */
177
+ const obfuscate = (input, secret) => NativeSecuritySuiteModule.obfuscate(input, secret);
178
+ exports.obfuscate = obfuscate;
179
+ const deobfuscate = (input, secret) => NativeSecuritySuiteModule.deobfuscate(input, secret);
180
+ exports.deobfuscate = deobfuscate;
60
181
  const getDeviceId = () => new Promise((resolve, reject) => {
61
- SecuritySuite.getDeviceId((result, error) => {
62
- if (error !== null) reject(error);else resolve(result);
182
+ NativeSecuritySuiteModule.getDeviceId((result, error) => {
183
+ if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('GET_DEVICE_ID_ERROR'));
63
184
  });
64
185
  });
186
+
187
+ /**
188
+ * @deprecated Use `obfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
189
+ */
65
190
  exports.getDeviceId = getDeviceId;
66
191
  const encrypt = (input, hardEncryption = true, secretKey = null) => new Promise((resolve, reject) => {
67
- if (!input) resolve(input);
68
- SecuritySuite.storageEncrypt(input, secretKey, hardEncryption, (result, error) => {
69
- if (error !== null) reject(error);else resolve(result);
192
+ if (!input) {
193
+ resolve(input);
194
+ return;
195
+ }
196
+ if (!secretKey) {
197
+ reject(new Error('secretKey is required. Device identifiers are not accepted as encryption keys.'));
198
+ return;
199
+ }
200
+ NativeSecuritySuiteModule.storageEncrypt(input, secretKey, hardEncryption, (result, error) => {
201
+ if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('ENCRYPT_ERROR'));
70
202
  });
71
203
  });
204
+
205
+ /**
206
+ * @deprecated Use `deobfuscate()` with an explicit secret, or `SecureStorage` for at-rest data.
207
+ */
72
208
  exports.encrypt = encrypt;
73
209
  const decrypt = (input, hardEncryption = true, secretKey = null) => new Promise((resolve, reject) => {
74
- if (!input) resolve(input);
75
- SecuritySuite.storageDecrypt(input, secretKey, hardEncryption, (result, error) => {
76
- if (error !== null) reject(error);else resolve(result);
210
+ if (!input) {
211
+ resolve(input);
212
+ return;
213
+ }
214
+ if (!secretKey) {
215
+ reject(new Error('secretKey is required. Device identifiers are not accepted as encryption keys.'));
216
+ return;
217
+ }
218
+ NativeSecuritySuiteModule.storageDecrypt(input, secretKey, hardEncryption, (result, error) => {
219
+ if (error !== null) reject(error);else if (result !== null) resolve(result);else reject(new Error('DECRYPT_ERROR'));
77
220
  });
78
221
  });
79
222
  exports.decrypt = decrypt;
223
+ const SECURE_STORAGE_FAILED = 'Secure storage operation failed';
224
+ function wrapSecureStorage(operation, promise) {
225
+ return promise.catch(error => {
226
+ const detail = error instanceof Error ? error.message : typeof error === 'string' ? error : 'Unknown error';
227
+ throw new Error(`${SECURE_STORAGE_FAILED} (${operation}): ${detail}`);
228
+ });
229
+ }
230
+
231
+ /** Hardware-backed encrypted storage (Keychain on iOS, EncryptedSharedPreferences on Android). */
80
232
  const SecureStorage = exports.SecureStorage = {
81
- setItem: async (key, value) => {
82
- try {
83
- const encryptedKey = await encrypt(key, false);
84
- const encryptedValue = await encrypt(value);
85
- return _asyncStorage.default.setItem(encryptedKey, encryptedValue);
86
- } catch (e) {
87
- console.error('setItem error: ', e);
88
- }
233
+ setItem: (key, value) => wrapSecureStorage('setItem', NativeSecuritySuiteModule.secureStorageSetItem(key, value)),
234
+ getItem: key => wrapSecureStorage('getItem', NativeSecuritySuiteModule.secureStorageGetItem(key)),
235
+ removeItem: key => wrapSecureStorage('removeItem', NativeSecuritySuiteModule.secureStorageRemoveItem(key)),
236
+ getAllKeys: () => wrapSecureStorage('getAllKeys', NativeSecuritySuiteModule.secureStorageGetAllKeys()),
237
+ clear: () => wrapSecureStorage('clear', NativeSecuritySuiteModule.secureStorageClear()),
238
+ multiSet: async keyValuePairs => {
239
+ await Promise.all(keyValuePairs.map(([key, value]) => SecureStorage.setItem(key, value)));
89
240
  },
90
- getItem: async key => {
91
- try {
92
- const encryptedKey = await encrypt(key, false);
93
- const encryptedData = await _asyncStorage.default.getItem(encryptedKey);
94
- return decrypt(encryptedData ?? '');
95
- } catch (e) {
96
- console.error('getItem error: ', e);
97
- return '';
98
- }
241
+ multiGet: async keys => Promise.all(keys.map(async key => [key, await SecureStorage.getItem(key)])),
242
+ multiRemove: async keys => {
243
+ await Promise.all(keys.map(key => SecureStorage.removeItem(key)));
99
244
  },
245
+ /** @deprecated Use multiSet instead. */
100
246
  mergeItem: async (key, value) => {
101
- try {
102
- const encryptedKey = await encrypt(key, false);
103
- const encryptedData = await _asyncStorage.default.getItem(encryptedKey);
104
- const data = await decrypt(encryptedData ?? '');
105
- if (!(0, _helpers.isJsonString)(data) || !(0, _helpers.isJsonString)(value)) return;
106
- const mergedData = await JSON.stringify(Object.assign(JSON.parse(data), JSON.parse(value)));
107
- const encryptedValue = await encrypt(mergedData);
108
- return _asyncStorage.default.setItem(encryptedKey, encryptedValue);
109
- } catch (e) {
110
- console.error('mergeItem error: ', e);
247
+ const existing = await SecureStorage.getItem(key);
248
+ if (!existing) {
249
+ await SecureStorage.setItem(key, value);
250
+ return;
111
251
  }
112
- },
113
- removeItem: async key => {
114
252
  try {
115
- const encryptedKey = await encrypt(key, false);
116
- return _asyncStorage.default.removeItem(encryptedKey);
117
- } catch (e) {
118
- console.error('removeItem error: ', e);
119
- }
120
- },
121
- getAllKeys: async () => {
122
- try {
123
- const encryptedKeys = await _asyncStorage.default.getAllKeys();
124
- return await Promise.all(encryptedKeys.map(async item => {
125
- const decryptedKey = await decrypt(item, false);
126
- return decryptedKey ? decryptedKey : item;
127
- }));
128
- } catch (e) {
129
- console.error('getAllKeys error: ', e);
130
- return [];
131
- }
132
- },
133
- multiSet: async keyValuePairs => {
134
- try {
135
- const encryptedKeyValuePairs = await Promise.all(keyValuePairs.map(async item => {
136
- if (item.length === 2 && item[0] && item[1]) {
137
- const encryptedKey = await encrypt(item[0], false);
138
- const encryptedValue = await encrypt(item[1]);
139
- return [encryptedKey, encryptedValue];
140
- }
141
- return null;
142
- }));
143
- _asyncStorage.default.multiSet(encryptedKeyValuePairs);
144
- } catch (e) {
145
- console.error('multiSet error: ', e);
146
- }
147
- },
148
- multiGet: async keys => {
149
- try {
150
- if (!Array.isArray(keys)) return [];
151
- const encryptedKeys = await Promise.all(keys.map(async item => await encrypt(item, false)));
152
- const encryptedItems = await _asyncStorage.default.multiGet(encryptedKeys);
153
- return await Promise.all(encryptedItems && encryptedItems.length ? encryptedItems.map(async item => {
154
- const decryptedKey = await decrypt(item[0], false);
155
- const decryptedalue = await decrypt(item[1]);
156
- return [decryptedKey, decryptedalue];
157
- }) : []);
158
- } catch (e) {
159
- console.error('multiGet error: ', e);
160
- return [];
161
- }
162
- },
163
- multiMerge: async keyValuePairs => {
164
- try {
165
- keyValuePairs.map(async item => {
166
- if (item.length === 2 && item[0] && item[1]) {
167
- const encryptedKey = await encrypt(item[0], false);
168
- const encryptedData = await _asyncStorage.default.getItem(item[0]);
169
- const data = await decrypt(encryptedData ?? '');
170
- if (!(0, _helpers.isJsonString)(data) || !(0, _helpers.isJsonString)(item[1])) return null;
171
- const mergedData = await JSON.stringify(Object.assign(JSON.parse(data), JSON.parse(item[1])));
172
- const encryptedValue = await encrypt(mergedData, false);
173
- return _asyncStorage.default.setItem(encryptedKey, encryptedValue);
174
- }
175
- return null;
253
+ const merged = JSON.stringify({
254
+ ...JSON.parse(existing),
255
+ ...JSON.parse(value)
176
256
  });
177
- } catch (e) {
178
- console.error('multiMerge error: ', e);
179
- }
180
- },
181
- multiRemove: async keys => {
182
- try {
183
- if (!Array.isArray(keys)) return keys;
184
- const encryptedKeys = await Promise.all(keys.map(async item => await encrypt(item, false)));
185
- return _asyncStorage.default.multiRemove(encryptedKeys);
186
- } catch (e) {
187
- console.error('multiRemove error: ', e);
257
+ await SecureStorage.setItem(key, merged);
258
+ } catch {
259
+ throw new Error('mergeItem requires valid JSON strings');
188
260
  }
189
261
  },
190
- clear: async () => {
191
- try {
192
- return _asyncStorage.default.clear();
193
- } catch (e) {
194
- console.error('clear error: ', e);
195
- }
262
+ /** @deprecated Use multiSet instead. */
263
+ multiMerge: async keyValuePairs => {
264
+ await Promise.all(keyValuePairs.map(([key, value]) => SecureStorage.mergeItem(key, value)));
196
265
  }
197
266
  };
198
- function fetch(url, options, loggerIsEnabled = false) {
267
+ function fetch(url, options, loggerIsEnabled = __DEV__) {
199
268
  return new Promise((resolve, reject) => {
200
- SecuritySuite.fetch(url, {
201
- ...options,
269
+ NativeSecuritySuiteModule.fetch(url, {
270
+ ...normalizeFetchOptions(options),
202
271
  loggerIsEnabled
203
272
  }, (result, error) => {
204
- try {
205
- if (error === null) {
206
- resolve({
207
- ...result,
208
- json: () => (0, _helpers.jsonParse)(result.response)
209
- });
210
- } else {
211
- const errorJson = (0, _helpers.jsonParse)(error.error);
212
- reject({
213
- json: () => errorJson,
214
- error: error?.error ?? error,
215
- status: error?.status ?? '',
216
- url: error?.url ?? '',
217
- ...errorJson
218
- });
219
- }
220
- } catch (e) {
221
- console.error('SSL Pinnning fetch error: ', e);
273
+ if (error === null) {
274
+ resolve({
275
+ ...result,
276
+ json: () => (0, _helpers.jsonParse)(result.response)
277
+ });
278
+ } else {
279
+ const errorJson = (0, _helpers.jsonParse)(typeof error?.error === 'string' ? error.error : JSON.stringify(error));
280
+ reject({
281
+ json: () => errorJson,
282
+ error: error?.error ?? error,
283
+ status: error?.status ?? 0,
284
+ url: error?.url ?? url,
285
+ path: errorJson?.path ?? '',
286
+ message: errorJson?.message ?? String(error?.error ?? error),
287
+ code: errorJson?.code ?? '',
288
+ duration: error?.duration ?? '',
289
+ ...errorJson
290
+ });
222
291
  }
223
292
  });
224
293
  });
225
294
  }
226
295
  function deviceHasSecurityRisk() {
227
- return SecuritySuite.deviceHasSecurityRisk();
296
+ return NativeSecuritySuiteModule.deviceHasSecurityRisk();
228
297
  }
229
- var _default = exports.default = SecuritySuite;
298
+ var _default = exports.default = NativeSecuritySuiteModule;
230
299
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_asyncStorage","_interopRequireDefault","_helpers","_SecureView","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","__esModule","default","LINKING_ERROR","Platform","select","ios","SecuritySuite","NativeModules","Proxy","Error","getPublicKey","getSharedKey","serverPublicKey","encryptBySharedKey","input","encrypt","decryptBySharedKey","decrypt","getDeviceId","Promise","resolve","reject","result","error","hardEncryption","secretKey","storageEncrypt","storageDecrypt","SecureStorage","setItem","value","encryptedKey","encryptedValue","AsyncStorage","console","getItem","encryptedData","mergeItem","data","isJsonString","mergedData","JSON","stringify","assign","parse","removeItem","getAllKeys","encryptedKeys","all","map","item","decryptedKey","multiSet","keyValuePairs","encryptedKeyValuePairs","length","multiGet","Array","isArray","encryptedItems","decryptedalue","multiMerge","multiRemove","clear","fetch","url","options","loggerIsEnabled","json","jsonParse","response","errorJson","status","deviceHasSecurityRisk","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GA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KAAoB,KAAK;MACjD,IAAI;QACF,IAAIA,KAAK,KAAK,IAAI,EAAE;UAClBH,OAAO,CAAC;YACN,GAAGE,MAAM;YACT8C,IAAI,EAAEA,CAAA,KAAM,IAAAC,kBAAS,EAAC/C,MAAM,CAACgD,QAAQ;UACvC,CAAC,CAAC;QACJ,CAAC,MAAM;UACL,MAAMC,SAAS,GAAG,IAAAF,kBAAS,EAAC9C,KAAK,CAACA,KAAK,CAAC;UACxCF,MAAM,CAAC;YACL+C,IAAI,EAAEA,CAAA,KAAMG,SAAS;YACrBhD,KAAK,EAAEA,KAAK,EAAEA,KAAK,IAAIA,KAAK;YAC5BiD,MAAM,EAAEjD,KAAK,EAAEiD,MAAM,IAAI,EAAE;YAC3BP,GAAG,EAAE1C,KAAK,EAAE0C,GAAG,IAAI,EAAE;YACrB,GAAGM;UACL,CAAC,CAAC;QACJ;MACF,CAAC,CAAC,OAAOxE,CAAC,EAAE;QACVmC,OAAO,CAACX,KAAK,CAAC,4BAA4B,EAAExB,CAAC,CAAC;MAChD;IACF,CACF,CAAC;EACH,CAAC,CAAC;AACJ;AAEO,SAAS0E,qBAAqBA,CAAA,EAAqB;EACxD,OAAOnE,aAAa,CAACmE,qBAAqB,CAAC,CAAC;AAC9C;AAAC,IAAAC,QAAA,GAAA/E,OAAA,CAAAM,OAAA,GAEcK,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_helpers","_cryptoOptions","_jws","_SecureView","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_errors","_index","_index2","_index3","_index4","_index5","LINKING_ERROR","Platform","select","ios","default","NativeSecuritySuiteModule","NativeModules","SecuritySuite","Proxy","Error","getPublicKey","getSharedKey","serverPublicKey","options","toNativeCryptoOptions","encryptBySharedKey","input","Promise","reject","encrypt","decryptBySharedKey","decrypt","generateJWS","nativeOptions","toNativeGenerateJWSOptions","normalizeFetchOptions","jws","nativeJws","toNativeJwsFetchOptions","algorithm","secret","headers","detached","headerName","payload","undefined","obfuscate","deobfuscate","getDeviceId","resolve","result","error","hardEncryption","secretKey","storageEncrypt","storageDecrypt","SECURE_STORAGE_FAILED","wrapSecureStorage","operation","promise","catch","detail","message","SecureStorage","setItem","value","secureStorageSetItem","getItem","secureStorageGetItem","removeItem","secureStorageRemoveItem","getAllKeys","secureStorageGetAllKeys","clear","secureStorageClear","multiSet","keyValuePairs","all","map","multiGet","multiRemove","mergeItem","existing","merged","JSON","stringify","parse","multiMerge","fetch","url","loggerIsEnabled","__DEV__","json","jsonParse","response","errorJson","status","path","String","code","duration","deviceHasSecurityRisk","_default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAIA,IAAAG,IAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AAAAK,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAmBA,IAAAS,OAAA,GAAAjB,OAAA;AACA,IAAAkB,MAAA,GAAAlB,OAAA;AACA,IAAAmB,OAAA,GAAAnB,OAAA;AACA,IAAAoB,OAAA,GA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AGC,MAAM;UACT0C,IAAI,EAAEA,CAAA,KAAM,IAAAC,kBAAS,EAAC3C,MAAM,CAAC4C,QAAQ;QACvC,CAAC,CAAC;MACJ,CAAC,MAAM;QACL,MAAMC,SAAS,GAAG,IAAAF,kBAAS,EACzB,OAAO1C,KAAK,EAAEA,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACA,KAAK,GAAGiC,IAAI,CAACC,SAAS,CAAClC,KAAK,CACvE,CAAC;QACDvB,MAAM,CAAC;UACLgE,IAAI,EAAEA,CAAA,KAAMG,SAAS;UACrB5C,KAAK,EAAEA,KAAK,EAAEA,KAAK,IAAIA,KAAK;UAC5B6C,MAAM,EAAE7C,KAAK,EAAE6C,MAAM,IAAI,CAAC;UAC1BP,GAAG,EAAEtC,KAAK,EAAEsC,GAAG,IAAIA,GAAG;UACtBQ,IAAI,EAAEF,SAAS,EAAEE,IAAI,IAAI,EAAE;UAC3BnC,OAAO,EAAEiC,SAAS,EAAEjC,OAAO,IAAIoC,MAAM,CAAC/C,KAAK,EAAEA,KAAK,IAAIA,KAAK,CAAC;UAC5DgD,IAAI,EAAEJ,SAAS,EAAEI,IAAI,IAAI,EAAE;UAC3BC,QAAQ,EAAEjD,KAAK,EAAEiD,QAAQ,IAAI,EAAE;UAC/B,GAAGL;QACL,CAAC,CAAC;MACJ;IACF,CACF,CAAC;EACH,CAAC,CAAC;AACJ;AAEO,SAASM,qBAAqBA,CAAA,EAAqB;EACxD,OAAOtF,yBAAyB,CAACsF,qBAAqB,CAAC,CAAC;AAC1D;AAAC,IAAAC,QAAA,GAAAtG,OAAA,CAAAc,OAAA,GAEcC,yBAAyB","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AppIntegrity = void 0;
7
+ var _bridge = require("../native/bridge.js");
8
+ function parseBuildType(value) {
9
+ if (value === 'debug' || value === 'release' || value === 'testflight') {
10
+ return value;
11
+ }
12
+ return 'release';
13
+ }
14
+ function parseIntegrityReport(raw) {
15
+ const report = {
16
+ validSignature: Boolean(raw.validSignature),
17
+ debuggable: Boolean(raw.debuggable),
18
+ tampered: Boolean(raw.tampered),
19
+ buildType: parseBuildType(raw.buildType)
20
+ };
21
+ if (raw.installerTrusted !== undefined) {
22
+ report.installerTrusted = Boolean(raw.installerTrusted);
23
+ }
24
+ if (typeof raw.signingCertificateSha256 === 'string') {
25
+ report.signingCertificateSha256 = raw.signingCertificateSha256;
26
+ }
27
+ if (raw.installerPackage === null || typeof raw.installerPackage === 'string') {
28
+ report.installerPackage = raw.installerPackage;
29
+ }
30
+ if (typeof raw.bundleIdentifier === 'string') {
31
+ report.bundleIdentifier = raw.bundleIdentifier;
32
+ }
33
+ return report;
34
+ }
35
+ const AppIntegrity = exports.AppIntegrity = {
36
+ verify() {
37
+ return (0, _bridge.getNativeModule)().appIntegrityVerify().then(result => parseIntegrityReport(result));
38
+ }
39
+ };
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bridge","require","parseBuildType","value","parseIntegrityReport","raw","report","validSignature","Boolean","debuggable","tampered","buildType","installerTrusted","undefined","signingCertificateSha256","installerPackage","bundleIdentifier","AppIntegrity","exports","verify","getNativeModule","appIntegrityVerify","then","result"],"sourceRoot":"../../../src","sources":["integrity/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAGA,SAASC,cAAcA,CAACC,KAAc,EAAa;EACjD,IAAIA,KAAK,KAAK,OAAO,IAAIA,KAAK,KAAK,SAAS,IAAIA,KAAK,KAAK,YAAY,EAAE;IACtE,OAAOA,KAAK;EACd;EACA,OAAO,SAAS;AAClB;AAEA,SAASC,oBAAoBA,CAACC,GAA4B,EAAsB;EAC9E,MAAMC,MAA0B,GAAG;IACjCC,cAAc,EAAEC,OAAO,CAACH,GAAG,CAACE,cAAc,CAAC;IAC3CE,UAAU,EAAED,OAAO,CAACH,GAAG,CAACI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