freerasp-react-native 5.2.3 → 6.0.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 (108) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +2 -0
  3. package/android/build.gradle +10 -3
  4. package/android/proguard-rules.pro +3 -3
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/FreeraspReactNativeModule.kt +177 -17
  7. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/FreeraspReactNativePackage.kt +1 -1
  8. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/PluginThreatHandler.kt +20 -7
  9. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/ScreenProtector.kt +1 -1
  10. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/dispatchers/ExecutionStateDispatcher.kt +3 -3
  11. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/dispatchers/ThreatDispatcher.kt +23 -3
  12. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/events/BaseRaspEvent.kt +1 -1
  13. package/android/src/main/java/app/talsec/rasp/reactnative/events/RaspExecutionStateEvent.kt +22 -0
  14. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/events/ThreatEvent.kt +6 -3
  15. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/exceptions/TalsecException.kt +1 -1
  16. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/interfaces/PluginExecutionStateListener.kt +2 -2
  17. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/interfaces/PluginThreatListener.kt +4 -2
  18. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/models/RNSuspiciousAppInfo.kt +1 -1
  19. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/utils/Extensions.kt +4 -4
  20. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/utils/RandomGenerator.kt +1 -1
  21. package/android/src/main/java/{com/freeraspreactnative → app/talsec/rasp/reactnative}/utils/Utils.kt +1 -1
  22. package/ios/FreeraspReactNative.swift +7 -5
  23. package/ios/models/RaspExecutionStates.swift +3 -3
  24. package/lib/commonjs/api/listeners/raspExecutionState.js +13 -7
  25. package/lib/commonjs/api/listeners/raspExecutionState.js.map +1 -1
  26. package/lib/commonjs/api/listeners/threat.js +19 -8
  27. package/lib/commonjs/api/listeners/threat.js.map +1 -1
  28. package/lib/commonjs/api/methods/internal.js +20 -0
  29. package/lib/commonjs/api/methods/internal.js.map +1 -0
  30. package/lib/commonjs/api/methods/native.js +113 -21
  31. package/lib/commonjs/api/methods/native.js.map +1 -1
  32. package/lib/commonjs/api/methods/reactNative.js +38 -10
  33. package/lib/commonjs/api/methods/reactNative.js.map +1 -1
  34. package/lib/commonjs/channels/raspExecutionState.js +3 -3
  35. package/lib/commonjs/channels/raspExecutionState.js.map +1 -1
  36. package/lib/commonjs/channels/threat.js +4 -4
  37. package/lib/commonjs/channels/threat.js.map +1 -1
  38. package/lib/commonjs/index.js +23 -0
  39. package/lib/commonjs/index.js.map +1 -1
  40. package/lib/commonjs/models/raspExecutionState.js +5 -2
  41. package/lib/commonjs/models/raspExecutionState.js.map +1 -1
  42. package/lib/commonjs/models/threat.js +2 -1
  43. package/lib/commonjs/models/threat.js.map +1 -1
  44. package/lib/commonjs/types/errors.js +50 -0
  45. package/lib/commonjs/types/errors.js.map +1 -0
  46. package/lib/commonjs/types/types.js +4 -0
  47. package/lib/module/api/listeners/raspExecutionState.js +10 -4
  48. package/lib/module/api/listeners/raspExecutionState.js.map +1 -1
  49. package/lib/module/api/listeners/threat.js +16 -5
  50. package/lib/module/api/listeners/threat.js.map +1 -1
  51. package/lib/module/api/methods/internal.js +13 -0
  52. package/lib/module/api/methods/internal.js.map +1 -0
  53. package/lib/module/api/methods/native.js +106 -17
  54. package/lib/module/api/methods/native.js.map +1 -1
  55. package/lib/module/api/methods/reactNative.js +39 -12
  56. package/lib/module/api/methods/reactNative.js.map +1 -1
  57. package/lib/module/channels/raspExecutionState.js +1 -1
  58. package/lib/module/channels/raspExecutionState.js.map +1 -1
  59. package/lib/module/channels/threat.js +2 -2
  60. package/lib/module/channels/threat.js.map +1 -1
  61. package/lib/module/index.js +2 -0
  62. package/lib/module/index.js.map +1 -1
  63. package/lib/module/models/raspExecutionState.js +5 -2
  64. package/lib/module/models/raspExecutionState.js.map +1 -1
  65. package/lib/module/models/threat.js +2 -1
  66. package/lib/module/models/threat.js.map +1 -1
  67. package/lib/module/types/errors.js +41 -0
  68. package/lib/module/types/errors.js.map +1 -0
  69. package/lib/module/types/types.js +1 -1
  70. package/lib/typescript/plugin/src/index.d.ts +1 -1
  71. package/lib/typescript/plugin/src/index.d.ts.map +1 -1
  72. package/lib/typescript/src/api/listeners/raspExecutionState.d.ts.map +1 -1
  73. package/lib/typescript/src/api/listeners/threat.d.ts.map +1 -1
  74. package/lib/typescript/src/api/methods/internal.d.ts +7 -0
  75. package/lib/typescript/src/api/methods/internal.d.ts.map +1 -0
  76. package/lib/typescript/src/api/methods/native.d.ts +56 -7
  77. package/lib/typescript/src/api/methods/native.d.ts.map +1 -1
  78. package/lib/typescript/src/api/methods/reactNative.d.ts +11 -2
  79. package/lib/typescript/src/api/methods/reactNative.d.ts.map +1 -1
  80. package/lib/typescript/src/channels/threat.d.ts +1 -0
  81. package/lib/typescript/src/channels/threat.d.ts.map +1 -1
  82. package/lib/typescript/src/index.d.ts +2 -0
  83. package/lib/typescript/src/index.d.ts.map +1 -1
  84. package/lib/typescript/src/models/raspExecutionState.d.ts +3 -1
  85. package/lib/typescript/src/models/raspExecutionState.d.ts.map +1 -1
  86. package/lib/typescript/src/models/threat.d.ts +1 -0
  87. package/lib/typescript/src/models/threat.d.ts.map +1 -1
  88. package/lib/typescript/src/types/errors.d.ts +26 -0
  89. package/lib/typescript/src/types/errors.d.ts.map +1 -0
  90. package/lib/typescript/src/types/types.d.ts +63 -26
  91. package/lib/typescript/src/types/types.d.ts.map +1 -1
  92. package/package.json +2 -2
  93. package/plugin/build/index.d.ts +1 -1
  94. package/plugin/build/index.js +1 -1
  95. package/plugin/tests/pluginProps.test.js +15 -0
  96. package/src/api/listeners/raspExecutionState.ts +9 -3
  97. package/src/api/listeners/threat.ts +29 -5
  98. package/src/api/methods/internal.ts +13 -0
  99. package/src/api/methods/native.ts +125 -21
  100. package/src/api/methods/reactNative.ts +46 -16
  101. package/src/channels/raspExecutionState.ts +1 -1
  102. package/src/channels/threat.ts +3 -3
  103. package/src/index.tsx +2 -0
  104. package/src/models/raspExecutionState.ts +12 -2
  105. package/src/models/threat.ts +2 -0
  106. package/src/types/errors.ts +57 -0
  107. package/src/types/types.ts +68 -26
  108. package/android/src/main/java/com/freeraspreactnative/events/RaspExecutionStateEvent.kt +0 -18
@@ -1,28 +1,54 @@
1
1
  import { talsecStart } from './native';
2
- import { useEffect } from 'react';
2
+ import { useEffect, useState } from 'react';
3
3
  import { setRaspExecutionStateListener, removeRaspExecutionStateEventListener } from '../listeners/raspExecutionState';
4
4
  import { setThreatListeners, removeThreatListener } from '../listeners/threat';
5
- import { onInvalidCallback } from './native';
5
+ import { TalsecError } from '../../types/errors';
6
6
  let isRaspStarted = false;
7
+ const toTalsecError = e => e instanceof TalsecError ? e : new TalsecError('talsec-failure', e instanceof Error ? e.message : String(e));
8
+
9
+ /**
10
+ * Registers the threat and RASP execution state listeners and starts freeRASP.
11
+ *
12
+ * freeRASP is started only once per app run; later mounts only re-register
13
+ * the listeners.
14
+ *
15
+ * @returns `started` once freeRASP runs, or the `TalsecError` that prevented
16
+ * the listeners from being registered or freeRASP from starting.
17
+ */
7
18
  export const useFreeRasp = (config, actions, raspExecutionStateActions) => {
19
+ const [status, setStatus] = useState({
20
+ started: isRaspStarted,
21
+ error: null
22
+ });
8
23
  useEffect(() => {
24
+ let isMounted = true;
9
25
  (async () => {
10
- await setThreatListeners(actions);
11
- raspExecutionStateActions && (await setRaspExecutionStateListener(raspExecutionStateActions));
12
- if (isRaspStarted) {
13
- return;
14
- }
15
26
  try {
16
- const response = await talsecStart(config);
17
- if (response !== 'freeRASP started') {
18
- onInvalidCallback();
27
+ await setThreatListeners(actions);
28
+ if (raspExecutionStateActions) {
29
+ await setRaspExecutionStateListener(raspExecutionStateActions);
30
+ }
31
+ if (!isRaspStarted) {
32
+ await talsecStart(config);
33
+ isRaspStarted = true;
34
+ }
35
+ if (isMounted) {
36
+ setStatus({
37
+ started: true,
38
+ error: null
39
+ });
19
40
  }
20
- isRaspStarted = true;
21
41
  } catch (e) {
22
- console.error(`${e.code}: ${e.message}`);
42
+ if (isMounted) {
43
+ setStatus({
44
+ started: isRaspStarted,
45
+ error: toTalsecError(e)
46
+ });
47
+ }
23
48
  }
24
49
  })();
25
50
  return () => {
51
+ isMounted = false;
26
52
  (async () => {
27
53
  await removeThreatListener();
28
54
  await removeRaspExecutionStateEventListener();
@@ -30,5 +56,6 @@ export const useFreeRasp = (config, actions, raspExecutionStateActions) => {
30
56
  };
31
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
32
58
  }, []);
59
+ return status;
33
60
  };
34
61
  //# sourceMappingURL=reactNative.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["talsecStart","useEffect","setRaspExecutionStateListener","removeRaspExecutionStateEventListener","setThreatListeners","removeThreatListener","onInvalidCallback","isRaspStarted","useFreeRasp","config","actions","raspExecutionStateActions","response","e","console","error","code","message"],"sourceRoot":"../../../../src","sources":["api/methods/reactNative.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,SAAS,QAAQ,OAAO;AACjC,SACEC,6BAA6B,EAC7BC,qCAAqC,QAChC,iCAAiC;AACxC,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,qBAAqB;AAM9E,SAASC,iBAAiB,QAAQ,UAAU;AAE5C,IAAIC,aAAa,GAAG,KAAK;AAEzB,OAAO,MAAMC,WAAW,GAAGA,CACzBC,MAAoB,EACpBC,OAA2B,EAC3BC,yBAA0D,KACvD;EACHV,SAAS,CAAC,MAAM;IACd,CAAC,YAAY;MACX,MAAMG,kBAAkB,CAACM,OAAO,CAAC;MACjCC,yBAAyB,KACtB,MAAMT,6BAA6B,CAACS,yBAAyB,CAAC,CAAC;MAElE,IAAIJ,aAAa,EAAE;QACjB;MACF;MAEA,IAAI;QACF,MAAMK,QAAQ,GAAG,MAAMZ,WAAW,CAACS,MAAM,CAAC;QAC1C,IAAIG,QAAQ,KAAK,kBAAkB,EAAE;UACnCN,iBAAiB,CAAC,CAAC;QACrB;QACAC,aAAa,GAAG,IAAI;MACtB,CAAC,CAAC,OAAOM,CAAM,EAAE;QACfC,OAAO,CAACC,KAAK,CAAE,GAAEF,CAAC,CAACG,IAAK,KAAIH,CAAC,CAACI,OAAQ,EAAC,CAAC;MAC1C;IACF,CAAC,EAAE,CAAC;IAEJ,OAAO,MAAM;MACX,CAAC,YAAY;QACX,MAAMZ,oBAAoB,CAAC,CAAC;QAC5B,MAAMF,qCAAqC,CAAC,CAAC;MAC/C,CAAC,EAAE,CAAC;IACN,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["talsecStart","useEffect","useState","setRaspExecutionStateListener","removeRaspExecutionStateEventListener","setThreatListeners","removeThreatListener","TalsecError","isRaspStarted","toTalsecError","e","Error","message","String","useFreeRasp","config","actions","raspExecutionStateActions","status","setStatus","started","error","isMounted"],"sourceRoot":"../../../../src","sources":["api/methods/reactNative.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,UAAU;AACtC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SACEC,6BAA6B,EAC7BC,qCAAqC,QAChC,iCAAiC;AACxC,SAASC,kBAAkB,EAAEC,oBAAoB,QAAQ,qBA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AAC;QAC5B,MAAMF,qCAAqC,CAAC,CAAC;MAC/C,CAAC,EAAE,CAAC;IACN,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOc,MAAM;AACf,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { getRaspExecutionStateCount, itemsHaveType } from '../utils/utils';
2
2
  import { FreeraspReactNative } from '../api/nativeModules';
3
- import { onInvalidCallback } from '../api/methods/native';
3
+ import { onInvalidCallback } from '../api/methods/internal';
4
4
  import { RaspExecutionState } from '../models/raspExecutionState';
5
5
  export const getRaspExecutionStateIdentifiers = async () => {
6
6
  const identifiers = await FreeraspReactNative.getRaspExecutionStateIdentifiers();
@@ -1 +1 @@
1
- {"version":3,"names":["getRaspExecutionStateCount","itemsHaveType","FreeraspReactNative","onInvalidCallback","RaspExecutionState","getRaspExecutionStateIdentifiers","identifiers","length","getRaspExecutionStateChannelData","dataLength","data","prepareRaspExecutionStateMapping","newValues","threats","getValues","map","threat","index","value"],"sourceRoot":"../../../src","sources":["channels/raspExecutionState.ts"],"mappings":"AAAA,SAASA,0BAA0B,EAAEC,aAAa,QAAQ,gBAAgB;AAC1E,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,kBAAkB,QAAQ,8BAA8B;AAEjE,OAAO,MAAMC,gCAAgC,GAAG,MAAAA,CAAA,KAA+B;EAC7E,MAAMC,WAAW,GACf,MAAMJ,mBAAmB,CAACG,gCAAgC,CAAC,CAAC;EAC9D,IACEC,WAAW,CAACC,MAAM,KAAKP,0BAA0B,CAAC,CAAC,IACnD,CAACC,aAAa,CAACK,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAH,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOG,WAAW;AACpB,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAG,MAAAA,CAAA,KAE3C;EACH,MAAMC,UAAU,GAAG,CAAC;EACpB,MAAMC,IAAI,GAAG,MAAMR,mBAAmB,CAACM,gCAAgC,CAAC,CAAC;EACzE,IAAIE,IAAI,CAACH,MAAM,KAAKE,UAAU,IAAI,CAACR,aAAa,CAACS,IAAI,EAAE,QAAQ,CAAC,EAAE;IAChEP,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOO,IAAI;AACb,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAG,MAAAA,CAAA,KAA2B;EACzE,MAAMC,SAAS,GAAG,MAAMP,gCAAgC,CAAC,CAAC;EAC1D,MAAMQ,OAAO,GAAGT,kBAAkB,CAACU,SAAS,CAAC,CAAC;EAC9CD,OAAO,CAACE,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC7BD,MAAM,CAACE,KAAK,GAAGN,SAAS,CAACK,KAAK,CAAE;EAClC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getRaspExecutionStateCount","itemsHaveType","FreeraspReactNative","onInvalidCallback","RaspExecutionState","getRaspExecutionStateIdentifiers","identifiers","length","getRaspExecutionStateChannelData","dataLength","data","prepareRaspExecutionStateMapping","newValues","threats","getValues","map","threat","index","value"],"sourceRoot":"../../../src","sources":["channels/raspExecutionState.ts"],"mappings":"AAAA,SAASA,0BAA0B,EAAEC,aAAa,QAAQ,gBAAgB;AAC1E,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,kBAAkB,QAAQ,8BAA8B;AAEjE,OAAO,MAAMC,gCAAgC,GAAG,MAAAA,CAAA,KAA+B;EAC7E,MAAMC,WAAW,GACf,MAAMJ,mBAAmB,CAACG,gCAAgC,CAAC,CAAC;EAC9D,IACEC,WAAW,CAACC,MAAM,KAAKP,0BAA0B,CAAC,CAAC,IACnD,CAACC,aAAa,CAACK,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAH,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOG,WAAW;AACpB,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAG,MAAAA,CAAA,KAE3C;EACH,MAAMC,UAAU,GAAG,CAAC;EACpB,MAAMC,IAAI,GAAG,MAAMR,mBAAmB,CAACM,gCAAgC,CAAC,CAAC;EACzE,IAAIE,IAAI,CAACH,MAAM,KAAKE,UAAU,IAAI,CAACR,aAAa,CAACS,IAAI,EAAE,QAAQ,CAAC,EAAE;IAChEP,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOO,IAAI;AACb,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAG,MAAAA,CAAA,KAA2B;EACzE,MAAMC,SAAS,GAAG,MAAMP,gCAAgC,CAAC,CAAC;EAC1D,MAAMQ,OAAO,GAAGT,kBAAkB,CAACU,SAAS,CAAC,CAAC;EAC9CD,OAAO,CAACE,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC7BD,MAAM,CAACE,KAAK,GAAGN,SAAS,CAACK,KAAK,CAAE;EAClC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { getThreatCount, itemsHaveType } from '../utils/utils';
2
2
  import { FreeraspReactNative } from '../api/nativeModules';
3
3
  import { Threat } from '../models/threat';
4
- import { onInvalidCallback } from '../api/methods/native';
4
+ import { onInvalidCallback } from '../api/methods/internal';
5
5
  export const getThreatIdentifiers = async () => {
6
6
  const identifiers = await FreeraspReactNative.getThreatIdentifiers();
7
7
  if (identifiers.length !== getThreatCount() || !itemsHaveType(identifiers, 'number')) {
@@ -11,7 +11,7 @@ export const getThreatIdentifiers = async () => {
11
11
  };
12
12
  export const getThreatChannelData = async () => {
13
13
  const data = await FreeraspReactNative.getThreatChannelData();
14
- if (data.length !== 3 || !itemsHaveType(data, 'string')) {
14
+ if (data.length !== 4 || !itemsHaveType(data, 'string')) {
15
15
  onInvalidCallback();
16
16
  }
17
17
  return data;
@@ -1 +1 @@
1
- {"version":3,"names":["getThreatCount","itemsHaveType","FreeraspReactNative","Threat","onInvalidCallback","getThreatIdentifiers","identifiers","length","getThreatChannelData","data","prepareThreatMapping","newValues","threats","getValues","map","threat","index","value"],"sourceRoot":"../../../src","sources":["channels/threat.ts"],"mappings":"AAAA,SAASA,cAAc,EAAEC,aAAa,QAAQ,gBAAgB;AAC9D,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,iBAAiB,QAAQ,uBAAuB;AAEzD,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAA,KAA+B;EACjE,MAAMC,WAAW,GAAG,MAAMJ,mBAAmB,CAACG,oBAAoB,CAAC,CAAC;EACpE,IACEC,WAAW,CAACC,MAAM,KAAKP,cAAc,CAAC,CAAC,IACvC,CAACC,aAAa,CAACK,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAF,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOE,WAAW;AACpB,CAAC;AAED,OAAO,MAAME,oBAAoB,GAAG,MAAAA,CAAA,KAE/B;EACH,MAAMC,IAAI,GAAG,MAAMP,mBAAmB,CAACM,oBAAoB,CAAC,CAAC;EAC7D,IAAIC,IAAI,CAACF,MAAM,KAAK,CAAC,IAAI,CAACN,aAAa,CAACQ,IAAI,EAAE,QAAQ,CAAC,EAAE;IACvDL,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOK,IAAI;AACb,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAA,KAA2B;EAC7D,MAAMC,SAAS,GAAG,MAAMN,oBAAoB,CAAC,CAAC;EAC9C,MAAMO,OAAO,GAAGT,MAAM,CAACU,SAAS,CAAC,CAAC;EAClCD,OAAO,CAACE,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC7BD,MAAM,CAACE,KAAK,GAAGN,SAAS,CAACK,KAAK,CAAE;EAClC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getThreatCount","itemsHaveType","FreeraspReactNative","Threat","onInvalidCallback","getThreatIdentifiers","identifiers","length","getThreatChannelData","data","prepareThreatMapping","newValues","threats","getValues","map","threat","index","value"],"sourceRoot":"../../../src","sources":["channels/threat.ts"],"mappings":"AAAA,SAASA,cAAc,EAAEC,aAAa,QAAQ,gBAAgB;AAC9D,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAA,KAA+B;EACjE,MAAMC,WAAW,GAAG,MAAMJ,mBAAmB,CAACG,oBAAoB,CAAC,CAAC;EACpE,IACEC,WAAW,CAACC,MAAM,KAAKP,cAAc,CAAC,CAAC,IACvC,CAACC,aAAa,CAACK,WAAW,EAAE,QAAQ,CAAC,EACrC;IACAF,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOE,WAAW;AACpB,CAAC;AAED,OAAO,MAAME,oBAAoB,GAAG,MAAAA,CAAA,KAE/B;EACH,MAAMC,IAAI,GAAG,MAAMP,mBAAmB,CAACM,oBAAoB,CAAC,CAAC;EAC7D,IAAIC,IAAI,CAACF,MAAM,KAAK,CAAC,IAAI,CAACN,aAAa,CAACQ,IAAI,EAAE,QAAQ,CAAC,EAAE;IACvDL,iBAAiB,CAAC,CAAC;EACrB;EACA,OAAOK,IAAI;AACb,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAG,MAAAA,CAAA,KAA2B;EAC7D,MAAMC,SAAS,GAAG,MAAMN,oBAAoB,CAAC,CAAC;EAC9C,MAAMO,OAAO,GAAGT,MAAM,CAACU,SAAS,CAAC,CAAC;EAClCD,OAAO,CAACE,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC7BD,MAAM,CAACE,KAAK,GAAGN,SAAS,CAACK,KAAK,CAAE;EAClC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1,6 +1,8 @@
1
1
  export * from './types/types';
2
+ export { TalsecError } from './types/errors';
2
3
  export * from './api/methods/native';
3
4
  export * from './api/methods/reactNative';
4
5
  export * from './api/listeners/threat';
5
6
  export * from './api/listeners/raspExecutionState';
7
+ export { onInvalidCallback as abortApp } from './api/methods/internal';
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,wBAAwB;AACtC,cAAc,oCAAoC","ignoreList":[]}
1
+ {"version":3,"names":["TalsecError","onInvalidCallback","abortApp"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,cAAc,eAAe;AAC7B,SAASA,WAAW,QAA8B,gBAAgB;AAClE,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,wBAAwB;AACtC,cAAc,oCAAoC;AAClD,SAASC,iBAAiB,IAAIC,QAAQ,QAAQ,wBAAwB","ignoreList":[]}
@@ -1,10 +1,13 @@
1
+ import { Platform } from 'react-native';
1
2
  export class RaspExecutionState {
2
- static AllChecksFinished = new RaspExecutionState(0);
3
+ static FastChecksFinished = new RaspExecutionState(0);
4
+ static CriticalChecksFinished = new RaspExecutionState(0);
5
+ static PostponedChecksFinished = new RaspExecutionState(0);
3
6
  constructor(value) {
4
7
  this.value = value;
5
8
  }
6
9
  static getValues() {
7
- return [this.AllChecksFinished];
10
+ return Platform.OS === 'android' ? [this.FastChecksFinished, this.CriticalChecksFinished, this.PostponedChecksFinished] : [this.FastChecksFinished];
8
11
  }
9
12
  }
10
13
  //# sourceMappingURL=raspExecutionState.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RaspExecutionState","AllChecksFinished","constructor","value","getValues"],"sourceRoot":"../../../src","sources":["models/raspExecutionState.ts"],"mappings":"AAAA,OAAO,MAAMA,kBAAkB,CAAC;EAG9B,OAAOC,iBAAiB,GAAG,IAAID,kBAAkB,CAAC,CAAC,CAAC;EAEpDE,WAAWA,CAACC,KAAa,EAAE;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEA,OAAOC,SAASA,CAAA,EAAyB;IACvC,OAAO,CAAC,IAAI,CAACH,iBAAiB,CAAC;EACjC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Platform","RaspExecutionState","FastChecksFinished","CriticalChecksFinished","PostponedChecksFinished","constructor","value","getValues","OS"],"sourceRoot":"../../../src","sources":["models/raspExecutionState.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,kBAAkB,CAAC;EAG9B,OAAOC,kBAAkB,GAAG,IAAID,kBAAkB,CAAC,CAAC,CAAC;EACrD,OAAOE,sBAAsB,GAAG,IAAIF,kBAAkB,CAAC,CAAC,CAAC;EACzD,OAAOG,uBAAuB,GAAG,IAAIH,kBAAkB,CAAC,CAAC,CAAC;EAE1DI,WAAWA,CAACC,KAAa,EAAE;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEA,OAAOC,SAASA,CAAA,EAAyB;IACvC,OAAOP,QAAQ,CAACQ,EAAE,KAAK,SAAS,GAC5B,CACE,IAAI,CAACN,kBAAkB,EACvB,IAAI,CAACC,sBAAsB,EAC3B,IAAI,CAACC,uBAAuB,CAC7B,GACD,CAAC,IAAI,CAACF,kBAAkB,CAAC;EAC/B;AACF","ignoreList":[]}
@@ -23,11 +23,12 @@ export class Threat {
23
23
  static UnsecureWifi = new Threat(0);
24
24
  static Automation = new Threat(0);
25
25
  static Bootloader = new Threat(0);
26
+ static OngoingCall = new Threat(0);
26
27
  constructor(value) {
27
28
  this.value = value;
28
29
  }
29
30
  static getValues() {
30
- return Platform.OS === 'android' ? [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.SystemVPN, this.DeviceBinding, this.UnofficialStore, this.ObfuscationIssues, this.DevMode, this.Malware, this.ADBEnabled, this.Screenshot, this.ScreenRecording, this.MultiInstance, this.TimeSpoofing, this.LocationSpoofing, this.UnsecureWifi, this.Automation, this.Bootloader] : [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.SystemVPN, this.DeviceBinding, this.DeviceID, this.UnofficialStore, this.Screenshot, this.ScreenRecording, this.TimeSpoofing];
31
+ return Platform.OS === 'android' ? [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.SystemVPN, this.DeviceBinding, this.UnofficialStore, this.ObfuscationIssues, this.DevMode, this.Malware, this.ADBEnabled, this.Screenshot, this.ScreenRecording, this.MultiInstance, this.TimeSpoofing, this.LocationSpoofing, this.UnsecureWifi, this.Automation, this.Bootloader, this.OngoingCall] : [this.AppIntegrity, this.PrivilegedAccess, this.Debug, this.Hooks, this.Passcode, this.Simulator, this.SecureHardwareNotAvailable, this.SystemVPN, this.DeviceBinding, this.DeviceID, this.UnofficialStore, this.Screenshot, this.ScreenRecording, this.TimeSpoofing];
31
32
  }
32
33
  }
33
34
  //# sourceMappingURL=threat.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","Threat","AppIntegrity","PrivilegedAccess","Debug","Hooks","Passcode","Simulator","SecureHardwareNotAvailable","SystemVPN","DeviceBinding","DeviceID","UnofficialStore","ObfuscationIssues","DevMode","Malware","ADBEnabled","Screenshot","ScreenRecording","MultiInstance","TimeSpoofing","LocationSpoofing","UnsecureWifi","Automation","Bootloader","constructor","value","getValues","OS"],"sourceRoot":"../../../src","sources":["models/threat.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,MAAM,CAAC;EAGlB,OAAOC,YAAY,GAAG,IAAID,MAAM,CAAC,CAAC,CAAC;EACnC,OAAOE,gBAAgB,GAAG,IAAIF,MAAM,CAAC,CAAC,CAAC;EACvC,OAAOG,KAAK,GAAG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E;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEA,OAAOC,SAASA,CAAA,EAAa;IAC3B,OAAO3B,QAAQ,CAAC4B,EAAE,KAAK,SAAS,GAC5B,CACE,IAAI,CAAC1B,YAAY,EACjB,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,0BAA0B,EAC/B,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,aAAa,EAClB,IAAI,CAACE,eAAe,EACpB,IAAI,CAACC,iBAAiB,EACtB,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,OAAO,EACZ,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,eAAe,EACpB,IAAI,CAACC,aAAa,EAClB,IAAI,CAACC,YAAY,EACjB,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,YAAY,EACjB,IAAI,CAACC,UAAU,EACf,IAAI,CAACC,UAAU,CAChB,GACD,CACE,IAAI,CAACtB,YAAY,EACjB,IAAI,CAACC,gBAAgB,EACrB,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,KAAK,EACV,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,0BAA0B,EAC/B,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,aAAa,EAClB,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,eAAe,EACpB,IAAI,CAACK,UAAU,EACf,IAAI,CAACC,eAAe,EACpB,IAAI,CAACE,YAAY,CAClB;EACP;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Platform","Threat","AppIntegrity","PrivilegedAccess","Debug","Hooks","Passcode","Simulator","SecureHardwareNotAvailable","SystemVPN","DeviceBinding","DeviceID","UnofficialStore","ObfuscationIssues","DevMode","Malware","ADBEnabled","Screenshot","ScreenRecording","MultiInstance","TimeSpoofing","LocationSpoofing","UnsecureWifi","Automation","Bootloader","OngoingCall","constructor","value","getValues","OS"],"sourceRoot":"../../../src","sources":["models/threat.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,MAAM,CAAC;EAGlB,OAAOC,YAAY,GAAG,IAAID,MAAM,CAAC,CAAC,CAAC;EACnC,OAAOE,gBAAgB,GAAG,IAAIF,MAAM,CAAC,CAAC,CAAC;EACvC,OAAOG,KAAK,GAAG,IAAIH,MAAM,CAAC,CAAC,CAAC;EAC5B,OAAOI,KAAK,GAAG,IAAIJ,MAAM,CAAC,CAAC,CAAC;EAC5B,OAAOK,QAAQ,GAAG,IAAIL,MAAM,CAAC,CAAC,CAAC;EAC/B,OAAOM,SAAS,GAAG,IAAIN,MAAM,CAAC,CAAC,CAAC;EAChC,OAAOO,0BAA0B,GAAG,IAAIP,MAAM,CAAC,CAAC,CAAC;EACjD,OAAOQ,SAAS,GAAG,IAAIR,MAAM,CAAC,CAAC,CAAC;EAChC,OAAOS,aAAa,GAAG,IAAIT,MAAM,CAAC,CAAC,CAAC;EACpC,OAAOU,QAAQ,GAAG,IAAIV,MAAM,CAAC,CAAC,CAAC;EAC/B,OAAOW,eAAe,GAAG,IAAIX,MAAM,CAAC,CAAC,CAAC;EACtC,OAAOY,iBAAiB,GAAG,IAAIZ,MAAM,CAAC,CAAC,CAAC;EACxC,OAAOa,OAAO,GAAG,IAAIb,MAAM,CAAC,CAAC,CAAC;EAC9B,OAAOc,OAAO,GAAG,IAAId,MAAM,CAAC,CAAC,CAAC;EAC9B,OAAOe,UAAU,GAAG,IAAIf,MAAM,CAAC,CAAC,CAAC;EACjC,OAAOgB,UAAU,GAAG,IAAIhB,MAAM,CAAC,CAAC,CAAC;EACjC,OAAOiB,eAAe,GAAG,IAAIjB,MAAM,CAAC,CAAC,CAAC;EACtC,OAAOkB,aAAa,GAAG,IAAIlB,MAAM,CAAC,CAAC,CAAC;EACpC,OAAOmB,YAAY,GA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EAC/B,IAAI,CAACC,SAAS,EACd,IAAI,CAACC,aAAa,EAClB,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,eAAe,EACpB,IAAI,CAACK,UAAU,EACf,IAAI,CAACC,eAAe,EACpB,IAAI,CAACE,YAAY,CAClB;EACP;AACF","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Stable error codes shared with the other freeRASP plugins.
3
+ *
4
+ * - `talsec-failure` - a native call failed
5
+ * - `unsupported-platform` - the feature is not available on this platform
6
+ * - `configuration-exception` - the configuration is invalid
7
+ * - `external-id-failure` - storing or removing the external ID failed
8
+ * - `malware-failure` - a malware-detection call failed
9
+ */
10
+
11
+ /**
12
+ * The only error freeRASP methods reject with.
13
+ */
14
+ export class TalsecError extends Error {
15
+ constructor(code, message) {
16
+ super(message);
17
+ this.name = 'TalsecError';
18
+ this.code = code;
19
+ Object.setPrototypeOf(this, TalsecError.prototype);
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Runs a native call and rethrows any failure as a {@link TalsecError}.
25
+ */
26
+ export const wrapNative = async (code, fn) => {
27
+ try {
28
+ return await fn();
29
+ } catch (e) {
30
+ if (e instanceof TalsecError) {
31
+ throw e;
32
+ }
33
+ throw new TalsecError(code, (e === null || e === void 0 ? void 0 : e.message) ?? String(e));
34
+ }
35
+ };
36
+
37
+ /**
38
+ * Rejects with an `unsupported-platform` error for Android-only features.
39
+ */
40
+ export const androidOnly = feature => Promise.reject(new TalsecError('unsupported-platform', `${feature} is not available on iOS`));
41
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TalsecError","Error","constructor","code","message","name","Object","setPrototypeOf","prototype","wrapNative","fn","e","String","androidOnly","feature","Promise","reject"],"sourceRoot":"../../../src","sources":["types/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,SAASC,KAAK,CAAC;EAGrCC,WAAWA,CAACC,IAAqB,EAAEC,OAAgB,EAAE;IACnD,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,aAAa;IACzB,IAAI,CAACF,IAAI,GAAGA,IAAI;IAChBG,MAAM,CAACC,cAAc,CAAC,IAAI,EAAEP,WAAW,CAACQ,SAAS,CAAC;EACpD;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAG,MAAAA,CACxBN,IAAqB,EACrBO,EAAoB,KACL;EACf,IAAI;IACF,OAAO,MAAMA,EAAE,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOC,CAAM,EAAE;IACf,IAAIA,CAAC,YAAYX,WAAW,EAAE;MAC5B,MAAMW,CAAC;IACT;IACA,MAAM,IAAIX,WAAW,CAACG,IAAI,EAAE,CAAAQ,CAAC,aAADA,CAAC,uBAADA,CAAC,CAAEP,OAAO,KAAIQ,MAAM,CAACD,CAAC,CAAC,CAAC;EACtD;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,WAAW,GAAIC,OAAe,IACzCC,OAAO,CAACC,MAAM,CACZ,IAAIhB,WAAW,CACb,sBAAsB,EACrB,GAAEc,OAAQ,0BACb,CACF,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
-
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1,5 +1,5 @@
1
1
  import { type ConfigPlugin } from '@expo/config-plugins';
2
2
  import { type PluginConfigType } from './pluginConfig';
3
- declare const _default: ConfigPlugin<PluginConfigType>;
3
+ declare const _default: ConfigPlugin<PluginConfigType | undefined>;
4
4
  export default _default;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;;AAiKvD,wBAA2E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;;AAoKvD,wBAA2E"}
@@ -1 +1 @@
1
- {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../../src/api/listeners/raspExecutionState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,8BAA8B,EAC/B,MAAM,mBAAmB,CAAC;AAe3B,eAAO,MAAM,6BAA6B,WAChC,8BAA8B,kBAqCvC,CAAC;AAEF,eAAO,MAAM,qCAAqC,QACtC,QAAQ,IAAI,CAOrB,CAAC"}
1
+ {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../../src/api/listeners/raspExecutionState.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,8BAA8B,EAC/B,MAAM,mBAAmB,CAAC;AAe3B,eAAO,MAAM,6BAA6B,WAChC,8BAA8B,kBA2CvC,CAAC;AAEF,eAAO,MAAM,qCAAqC,QACtC,QAAQ,IAAI,CAOrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../../src/api/listeners/threat.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAiBzE,eAAO,MAAM,kBAAkB,WAAkB,kBAAkB,kBAwGlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAAQ,IAAI,CAOzD,CAAC"}
1
+ {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../../src/api/listeners/threat.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAuB3B,eAAO,MAAM,kBAAkB,WAAkB,kBAAkB,kBAsHlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAAQ,IAAI,CAOzD,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Terminates the app. Called when the native side sends data that freeRASP
3
+ * never sends, which indicates tampering. Exported publicly as `abortApp`.
4
+ */
5
+ export declare const onInvalidCallback: () => void;
6
+ export declare const removeListenerForEvent: (channel: string) => Promise<string>;
7
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../src/api/methods/internal.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,IAEpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,KAAG,QAAQ,MAAM,CAEtE,CAAC"}
@@ -1,11 +1,60 @@
1
1
  import type { TalsecConfig } from '../../types/types';
2
- export declare const talsecStart: (options: TalsecConfig) => Promise<string>;
3
- export declare const addToWhitelist: (packageName: string) => Promise<boolean>;
4
- export declare const blockScreenCapture: (enable: boolean) => Promise<string>;
2
+ /**
3
+ * Starts freeRASP. Prefer the `useFreeRasp` hook, which also registers the
4
+ * listeners.
5
+ */
6
+ export declare const talsecStart: (options: TalsecConfig) => Promise<void>;
7
+ /**
8
+ * Android only. Adds an app to the malware whitelist so it is not reported.
9
+ */
10
+ export declare const addToWhitelist: (packageName: string) => Promise<void>;
11
+ /**
12
+ * Blocks or unblocks screenshots and screen recording of the app screen.
13
+ */
14
+ export declare const blockScreenCapture: (enable: boolean) => Promise<void>;
15
+ /**
16
+ * Returns whether screen capture is blocked for the current screen.
17
+ */
5
18
  export declare const isScreenCaptureBlocked: () => Promise<boolean>;
6
- export declare const storeExternalId: (data: string) => Promise<string>;
7
- export declare const removeExternalId: () => Promise<string>;
19
+ /**
20
+ * Android only. Prevents accessibility services from reading or controlling
21
+ * the app screen.
22
+ */
23
+ export declare const blockScreenControl: (enable: boolean) => Promise<void>;
24
+ /**
25
+ * Android only. Returns whether screen control is blocked.
26
+ */
27
+ export declare const isScreenControlBlocked: () => Promise<boolean>;
28
+ /**
29
+ * Android only. Hides overlay windows of other apps over the app screen.
30
+ * Requires Android 12+ and the `HIDE_OVERLAY_WINDOWS` permission.
31
+ *
32
+ * @returns whether the request was applied
33
+ */
34
+ export declare const blockOverlayWindows: (enable: boolean) => Promise<boolean>;
35
+ /**
36
+ * Android only. Returns whether overlay windows of other apps are hidden.
37
+ */
38
+ export declare const isOverlayWindowsBlocked: () => Promise<boolean>;
39
+ /**
40
+ * Android only. Starts the ongoing call (cellular and VoIP) detection.
41
+ * Call states are reported through the `ongoingCall` threat action.
42
+ */
43
+ export declare const startOngoingCallDetection: () => Promise<void>;
44
+ /**
45
+ * Android only. Stops the ongoing call detection.
46
+ */
47
+ export declare const stopOngoingCallDetection: () => Promise<void>;
48
+ /**
49
+ * Stores an external ID sent with freeRASP logs.
50
+ */
51
+ export declare const storeExternalId: (data: string) => Promise<void>;
52
+ /**
53
+ * Removes the stored external ID.
54
+ */
55
+ export declare const removeExternalId: () => Promise<void>;
56
+ /**
57
+ * Android only. Returns the icon of the given app as a base64-encoded PNG.
58
+ */
8
59
  export declare const getAppIcon: (packageName: string) => Promise<string>;
9
- export declare const onInvalidCallback: () => void;
10
- export declare const removeListenerForEvent: (channel: string) => Promise<string>;
11
60
  //# sourceMappingURL=native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../../../src/api/methods/native.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,eAAO,MAAM,WAAW,YAAmB,YAAY,KAAG,QAAQ,MAAM,CAEvE,CAAC;AAEF,eAAO,MAAM,cAAc,gBAAuB,MAAM,KAAG,QAAQ,OAAO,CAKzE,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,OAAO,KAAG,QAAQ,MAAM,CAElE,CAAC;AAEF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,MAAM,wBAAwB,QAAa,QAAQ,IAAI,CAO7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,SAAgB,MAAM,KAAG,QAAQ,IAAI,CAIhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAa,QAAQ,IAAI,CAIrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,gBAAiB,MAAM,KAAG,QAAQ,MAAM,CAO9D,CAAC"}
@@ -1,3 +1,12 @@
1
- import type { ThreatEventActions, TalsecConfig, RaspExecutionStateEventActions } from '../../types/types';
2
- export declare const useFreeRasp: (config: TalsecConfig, actions: ThreatEventActions, raspExecutionStateActions?: RaspExecutionStateEventActions) => void;
1
+ import type { ThreatEventActions, TalsecConfig, RaspExecutionStateEventActions, FreeRaspStatus } from '../../types/types';
2
+ /**
3
+ * Registers the threat and RASP execution state listeners and starts freeRASP.
4
+ *
5
+ * freeRASP is started only once per app run; later mounts only re-register
6
+ * the listeners.
7
+ *
8
+ * @returns `started` once freeRASP runs, or the `TalsecError` that prevented
9
+ * the listeners from being registered or freeRASP from starting.
10
+ */
11
+ export declare const useFreeRasp: (config: TalsecConfig, actions: ThreatEventActions, raspExecutionStateActions?: RaspExecutionStateEventActions) => FreeRaspStatus;
3
12
  //# sourceMappingURL=reactNative.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactNative.d.ts","sourceRoot":"","sources":["../../../../../src/api/methods/reactNative.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,8BAA8B,EAC/B,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,WAAW,WACd,YAAY,WACX,kBAAkB,8BACC,8BAA8B,SA+B3D,CAAC"}
1
+ {"version":3,"file":"reactNative.d.ts","sourceRoot":"","sources":["../../../../../src/api/methods/reactNative.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACZ,8BAA8B,EAC9B,cAAc,EACf,MAAM,mBAAmB,CAAC;AAa3B;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,WACd,YAAY,WACX,kBAAkB,8BACC,8BAA8B,KACzD,cA0CF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const getThreatIdentifiers: () => Promise<number[]>;
2
2
  export declare const getThreatChannelData: () => Promise<[
3
+ string,
3
4
  string,
4
5
  string,
5
6
  string
@@ -1 +1 @@
1
- {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/channels/threat.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,QAAa,QAAQ,MAAM,EAAE,CAS7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAC5C;IAAC,MAAM;IAAE,MAAM;IAAE,MAAM;CAAC,CAOzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAAQ,IAAI,CAMzD,CAAC"}
1
+ {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/channels/threat.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,QAAa,QAAQ,MAAM,EAAE,CAS7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAC5C;IAAC,MAAM;IAAE,MAAM;IAAE,MAAM;IAAE,MAAM;CAAC,CAOjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAa,QAAQ,IAAI,CAMzD,CAAC"}
@@ -1,6 +1,8 @@
1
1
  export * from './types/types';
2
+ export { TalsecError, type TalsecErrorCode } from './types/errors';
2
3
  export * from './api/methods/native';
3
4
  export * from './api/methods/reactNative';
4
5
  export * from './api/listeners/threat';
5
6
  export * from './api/listeners/raspExecutionState';
7
+ export { onInvalidCallback as abortApp } from './api/methods/internal';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAE,iBAAiB,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  export declare class RaspExecutionState {
2
2
  value: number;
3
- static AllChecksFinished: RaspExecutionState;
3
+ static FastChecksFinished: RaspExecutionState;
4
+ static CriticalChecksFinished: RaspExecutionState;
5
+ static PostponedChecksFinished: RaspExecutionState;
4
6
  constructor(value: number);
5
7
  static getValues(): RaspExecutionState[];
6
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../src/models/raspExecutionState.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IAC7B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,iBAAiB,qBAA6B;gBAEzC,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,kBAAkB,EAAE;CAGzC"}
1
+ {"version":3,"file":"raspExecutionState.d.ts","sourceRoot":"","sources":["../../../../src/models/raspExecutionState.ts"],"names":[],"mappings":"AAEA,qBAAa,kBAAkB;IAC7B,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,kBAAkB,qBAA6B;IACtD,MAAM,CAAC,sBAAsB,qBAA6B;IAC1D,MAAM,CAAC,uBAAuB,qBAA6B;gBAE/C,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,kBAAkB,EAAE;CASzC"}
@@ -23,6 +23,7 @@ export declare class Threat {
23
23
  static UnsecureWifi: Threat;
24
24
  static Automation: Threat;
25
25
  static Bootloader: Threat;
26
+ static OngoingCall: Threat;
26
27
  constructor(value: number);
27
28
  static getValues(): Threat[];
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/models/threat.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,0BAA0B,SAAiB;IAClD,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,iBAAiB,SAAiB;IACzC,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,UAAU,SAAiB;gBAEtB,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,MAAM,EAAE;CA2C7B"}
1
+ {"version":3,"file":"threat.d.ts","sourceRoot":"","sources":["../../../../src/models/threat.ts"],"names":[],"mappings":"AAEA,qBAAa,MAAM;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,KAAK,SAAiB;IAC7B,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,0BAA0B,SAAiB;IAClD,MAAM,CAAC,SAAS,SAAiB;IACjC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,QAAQ,SAAiB;IAChC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,iBAAiB,SAAiB;IACzC,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,OAAO,SAAiB;IAC/B,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,eAAe,SAAiB;IACvC,MAAM,CAAC,aAAa,SAAiB;IACrC,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,gBAAgB,SAAiB;IACxC,MAAM,CAAC,YAAY,SAAiB;IACpC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,UAAU,SAAiB;IAClC,MAAM,CAAC,WAAW,SAAiB;gBAEvB,KAAK,EAAE,MAAM;IAIzB,MAAM,CAAC,SAAS,IAAI,MAAM,EAAE;CA4C7B"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Stable error codes shared with the other freeRASP plugins.
3
+ *
4
+ * - `talsec-failure` - a native call failed
5
+ * - `unsupported-platform` - the feature is not available on this platform
6
+ * - `configuration-exception` - the configuration is invalid
7
+ * - `external-id-failure` - storing or removing the external ID failed
8
+ * - `malware-failure` - a malware-detection call failed
9
+ */
10
+ export type TalsecErrorCode = 'talsec-failure' | 'unsupported-platform' | 'configuration-exception' | 'external-id-failure' | 'malware-failure';
11
+ /**
12
+ * The only error freeRASP methods reject with.
13
+ */
14
+ export declare class TalsecError extends Error {
15
+ readonly code: TalsecErrorCode;
16
+ constructor(code: TalsecErrorCode, message?: string);
17
+ }
18
+ /**
19
+ * Runs a native call and rethrows any failure as a {@link TalsecError}.
20
+ */
21
+ export declare const wrapNative: <T>(code: TalsecErrorCode, fn: () => Promise<T>) => Promise<T>;
22
+ /**
23
+ * Rejects with an `unsupported-platform` error for Android-only features.
24
+ */
25
+ export declare const androidOnly: (feature: string) => Promise<never>;
26
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,sBAAsB,GACtB,yBAAyB,GACzB,qBAAqB,GACrB,iBAAiB,CAAC;AAEtB;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;gBAEnB,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM;CAMpD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,YACf,eAAe,MACjB,MAAM,QAAQ,CAAC,CAAC,KACnB,QAAQ,CAAC,CASX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,YAAa,MAAM,KAAG,QAAQ,KAAK,CAMxD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { TalsecError } from './errors';
1
2
  export type TalsecConfig = {
2
3
  androidConfig?: TalsecAndroidConfig;
3
4
  iosConfig?: TalsecIosConfig;
@@ -26,7 +27,7 @@ export type TalsecAndroidConfig = {
26
27
  suspiciousAppDetectionConfig?: SuspiciousAppDetectionConfig;
27
28
  };
28
29
  export type TalsecIosConfig = {
29
- appBundleId: string;
30
+ appBundleIds: string[];
30
31
  appTeamId: string;
31
32
  };
32
33
  export type SuspiciousAppInfo = {
@@ -41,35 +42,71 @@ export type PackageInfo = {
41
42
  appIcon?: string;
42
43
  installerStore?: string;
43
44
  };
45
+ /**
46
+ * State of an ongoing call reported by the ongoing call detection.
47
+ *
48
+ * - `STARTED` - a call started while the detection was running
49
+ * - `ONGOING` - a call was already in progress when the detection started
50
+ * - `STOPPED` - a previously reported call has ended
51
+ */
52
+ export type CallState = 'STARTED' | 'ONGOING' | 'STOPPED';
44
53
  export type ThreatEventActions = {
45
- privilegedAccess?: () => any;
46
- debug?: () => any;
47
- simulator?: () => any;
48
- appIntegrity?: () => any;
49
- unofficialStore?: () => any;
50
- hooks?: () => any;
51
- deviceBinding?: () => any;
52
- deviceID?: () => any;
53
- passcode?: () => any;
54
- secureHardwareNotAvailable?: () => any;
55
- obfuscationIssues?: () => any;
56
- devMode?: () => any;
57
- systemVPN?: () => any;
58
- malware?: (suspiciousApps: SuspiciousAppInfo[]) => any;
59
- adbEnabled?: () => any;
60
- screenshot?: () => any;
61
- screenRecording?: () => any;
62
- multiInstance?: () => any;
63
- timeSpoofing?: () => any;
64
- locationSpoofing?: () => any;
65
- unsecureWifi?: () => any;
66
- automation?: () => any;
67
- bootloader?: () => any;
54
+ privilegedAccess?: () => void;
55
+ debug?: () => void;
56
+ simulator?: () => void;
57
+ appIntegrity?: () => void;
58
+ unofficialStore?: () => void;
59
+ hooks?: () => void;
60
+ deviceBinding?: () => void;
61
+ deviceID?: () => void;
62
+ passcode?: () => void;
63
+ secureHardwareNotAvailable?: () => void;
64
+ obfuscationIssues?: () => void;
65
+ devMode?: () => void;
66
+ systemVPN?: () => void;
67
+ malware?: (suspiciousApps: SuspiciousAppInfo[]) => void;
68
+ adbEnabled?: () => void;
69
+ screenshot?: () => void;
70
+ screenRecording?: () => void;
71
+ multiInstance?: () => void;
72
+ timeSpoofing?: () => void;
73
+ locationSpoofing?: () => void;
74
+ unsecureWifi?: () => void;
75
+ automation?: () => void;
76
+ bootloader?: () => void;
77
+ /**
78
+ * Android only. Requires `startOngoingCallDetection()`.
79
+ */
80
+ ongoingCall?: (state: CallState) => void;
68
81
  };
69
82
  export type NativeEvent = {
70
- [key: string]: number | string[] | undefined;
83
+ [key: string]: number | string | string[] | undefined;
71
84
  };
72
85
  export type RaspExecutionStateEventActions = {
73
- allChecksFinished?: () => any;
86
+ /**
87
+ * The fast (standard) checks have been completed. On Android, the postponed
88
+ * checks may still run afterwards. On iOS, triggered when all checks have
89
+ * been completed.
90
+ */
91
+ fastChecksFinished?: () => void;
92
+ /**
93
+ * Android only. The critical checks have been completed, before the
94
+ * non-critical checks.
95
+ */
96
+ criticalChecksFinished?: () => void;
97
+ /**
98
+ * Android only. The postponed checks have been completed, which ends the
99
+ * initial evaluation.
100
+ */
101
+ postponedChecksFinished?: () => void;
102
+ };
103
+ /**
104
+ * State returned by `useFreeRasp`.
105
+ */
106
+ export type FreeRaspStatus = {
107
+ /** `true` once freeRASP has been started. */
108
+ started: boolean;
109
+ /** Error that prevented the listeners from being registered or freeRASP from starting. */
110
+ error: TalsecError | null;
74
111
  };
75
112
  //# sourceMappingURL=types.d.ts.map