@cap-kit/integrity 8.0.0-next.6

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 (59) hide show
  1. package/CapKitIntegrity.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +26 -0
  4. package/README.md +1104 -0
  5. package/android/build.gradle +104 -0
  6. package/android/src/main/AndroidManifest.xml +21 -0
  7. package/android/src/main/java/io/capkit/integrity/IntegrityCheckOptions.kt +37 -0
  8. package/android/src/main/java/io/capkit/integrity/IntegrityConfig.kt +59 -0
  9. package/android/src/main/java/io/capkit/integrity/IntegrityError.kt +40 -0
  10. package/android/src/main/java/io/capkit/integrity/IntegrityImpl.kt +319 -0
  11. package/android/src/main/java/io/capkit/integrity/IntegrityPlugin.kt +475 -0
  12. package/android/src/main/java/io/capkit/integrity/IntegrityReportBuilder.kt +130 -0
  13. package/android/src/main/java/io/capkit/integrity/IntegritySignalBuilder.kt +72 -0
  14. package/android/src/main/java/io/capkit/integrity/emulator/IntegrityEmulatorChecks.kt +38 -0
  15. package/android/src/main/java/io/capkit/integrity/filesystem/IntegrityFilesystemChecks.kt +51 -0
  16. package/android/src/main/java/io/capkit/integrity/hook/IntegrityHookChecks.kt +61 -0
  17. package/android/src/main/java/io/capkit/integrity/remote/IntegrityRemoteAttestor.kt +49 -0
  18. package/android/src/main/java/io/capkit/integrity/root/IntegrityRootDetector.kt +136 -0
  19. package/android/src/main/java/io/capkit/integrity/runtime/IntegrityRuntimeChecks.kt +87 -0
  20. package/android/src/main/java/io/capkit/integrity/ui/IntegrityBlockActivity.kt +173 -0
  21. package/android/src/main/java/io/capkit/integrity/ui/IntegrityUISignals.kt +57 -0
  22. package/android/src/main/java/io/capkit/integrity/utils/IntegrityLogger.kt +85 -0
  23. package/android/src/main/java/io/capkit/integrity/utils/IntegrityUtils.kt +105 -0
  24. package/android/src/main/res/.gitkeep +0 -0
  25. package/android/src/main/res/values/styles.xml +5 -0
  26. package/dist/docs.json +598 -0
  27. package/dist/esm/definitions.d.ts +554 -0
  28. package/dist/esm/definitions.js +56 -0
  29. package/dist/esm/definitions.js.map +1 -0
  30. package/dist/esm/index.d.ts +15 -0
  31. package/dist/esm/index.js +16 -0
  32. package/dist/esm/index.js.map +1 -0
  33. package/dist/esm/web.d.ts +32 -0
  34. package/dist/esm/web.js +51 -0
  35. package/dist/esm/web.js.map +1 -0
  36. package/dist/plugin.cjs.js +130 -0
  37. package/dist/plugin.cjs.js.map +1 -0
  38. package/dist/plugin.js +133 -0
  39. package/dist/plugin.js.map +1 -0
  40. package/ios/Sources/IntegrityPlugin/IntegrityCheckOptions.swift +41 -0
  41. package/ios/Sources/IntegrityPlugin/IntegrityConfig.swift +135 -0
  42. package/ios/Sources/IntegrityPlugin/IntegrityEntitlementChecks.swift +58 -0
  43. package/ios/Sources/IntegrityPlugin/IntegrityError.swift +49 -0
  44. package/ios/Sources/IntegrityPlugin/IntegrityImpl.swift +397 -0
  45. package/ios/Sources/IntegrityPlugin/IntegrityPlugin.swift +345 -0
  46. package/ios/Sources/IntegrityPlugin/IntegrityReportBuilder.swift +184 -0
  47. package/ios/Sources/IntegrityPlugin/Utils/IntegrityLogger.swift +69 -0
  48. package/ios/Sources/IntegrityPlugin/Utils/IntegrityUtils.swift +144 -0
  49. package/ios/Sources/IntegrityPlugin/Version.swift +16 -0
  50. package/ios/Sources/IntegrityPlugin/filesystem/IntegrityFilesystemChecks.swift +86 -0
  51. package/ios/Sources/IntegrityPlugin/hook/IntegrityHookChecks.swift +85 -0
  52. package/ios/Sources/IntegrityPlugin/jailbreak/IntegrityJailbreakDetector.swift +74 -0
  53. package/ios/Sources/IntegrityPlugin/jailbreak/IntegrityJailbreakUrlSchemeDetector.swift +42 -0
  54. package/ios/Sources/IntegrityPlugin/remote/IntegrityRemoteAttestor.swift +40 -0
  55. package/ios/Sources/IntegrityPlugin/runtime/IntegrityRuntimeChecks.swift +63 -0
  56. package/ios/Sources/IntegrityPlugin/simulator/IntegritySimulatorChecks.swift +20 -0
  57. package/ios/Sources/IntegrityPlugin/ui/IntegrityBlockViewController.swift +143 -0
  58. package/ios/Tests/IntegrityPluginTests/IntegrityPluginTests.swift +10 -0
  59. package/package.json +106 -0
@@ -0,0 +1,105 @@
1
+ package io.capkit.integrity.utils
2
+
3
+ import com.getcapacitor.JSArray
4
+ import com.getcapacitor.JSObject
5
+
6
+ /**
7
+ * Utility helpers for the Integrity plugin.
8
+ *
9
+ * PURPOSE:
10
+ * - Convert Kotlin data structures into Capacitor-compatible JSObject / JSArray.
11
+ *
12
+ * SCOPE:
13
+ * - This utility is intended ONLY for JSON-like data structures composed of:
14
+ * - Map
15
+ * - List
16
+ * - String / Boolean / Number / null
17
+ *
18
+ * WARNING:
19
+ * - Passing non JSON-safe types (e.g. custom objects, enums, exceptions)
20
+ * will result in a string fallback via `toString()`.
21
+ * - Cyclic data structures are NOT supported and will cause a StackOverflowError.
22
+ */
23
+ object IntegrityUtils {
24
+ /**
25
+ * Recursively converts a Kotlin Map into a Capacitor JSObject.
26
+ *
27
+ * CONTRACT:
28
+ * - Keys are converted to String using `toString()`.
29
+ * - Supported value types:
30
+ * - Map<*, *>
31
+ * - List<*>
32
+ * - String / Boolean / Number / null
33
+ *
34
+ * - Any unsupported value type is converted using `toString()`
35
+ * to avoid runtime crashes.
36
+ *
37
+ * NOTE:
38
+ * - This method assumes acyclic data structures.
39
+ * - Designed for deterministic, inspection-safe payloads.
40
+ */
41
+ fun toJSObject(map: Map<*, *>): JSObject {
42
+ val js = JSObject()
43
+
44
+ map.forEach { (key, value) ->
45
+ val k = key?.toString() ?: "null"
46
+
47
+ when (value) {
48
+ null -> js.put(k, null)
49
+
50
+ is Map<*, *> -> js.put(k, toJSObject(value))
51
+
52
+ is List<*> -> js.put(k, toJSArray(value))
53
+
54
+ is String,
55
+ is Boolean,
56
+ is Number,
57
+ -> js.put(k, value)
58
+
59
+ else -> {
60
+ // Fallback for non JSON-safe types
61
+ js.put(k, value.toString())
62
+ }
63
+ }
64
+ }
65
+
66
+ return js
67
+ }
68
+
69
+ /**
70
+ * Recursively converts a Kotlin List into a Capacitor JSArray.
71
+ *
72
+ * CONTRACT:
73
+ * - Supported element types:
74
+ * - Map<*, *>
75
+ * - List<*>
76
+ * - String / Boolean / Number / null
77
+ *
78
+ * - Unsupported element types are converted using `toString()`.
79
+ */
80
+ private fun toJSArray(list: List<*>): JSArray {
81
+ val array = JSArray()
82
+
83
+ list.forEach { item ->
84
+ when (item) {
85
+ null -> array.put(null)
86
+
87
+ is Map<*, *> -> array.put(toJSObject(item))
88
+
89
+ is List<*> -> array.put(toJSArray(item))
90
+
91
+ is String,
92
+ is Boolean,
93
+ is Number,
94
+ -> array.put(item)
95
+
96
+ else -> {
97
+ // Fallback for non JSON-safe types
98
+ array.put(item.toString())
99
+ }
100
+ }
101
+ }
102
+
103
+ return array
104
+ }
105
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ <resources>
2
+ <style name="IntegrityBlockTheme" parent="Theme.AppCompat.NoActionBar">
3
+ <item name="android:windowFullscreen">true</item>
4
+ </style>
5
+ </resources>