@onekeyfe/react-native-capture-protection 3.0.179-alpha.2026101503 → 3.0.179-alpha.302

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 (2) hide show
  1. package/README.md +57 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  Permission-minimal capture protection for OneKey iOS and Android.
4
4
 
5
+ ## Installation
6
+
7
+ ```sh
8
+ yarn add @onekeyfe/react-native-capture-protection react-native-nitro-modules@0.37.0
9
+ ```
10
+
11
+ Install iOS pods and rebuild the native application. Web and desktop callers
12
+ use their existing platform integration; this package has no implementation for
13
+ those runtimes. Import is lazy, while a missing native registration throws when
14
+ protection or a listener is requested.
15
+
16
+ ## Usage and cleanup
17
+
5
18
  ```ts
6
19
  import {
7
20
  CaptureProtection,
@@ -24,3 +37,47 @@ Android screenshot notifications require Android 14; older Android versions stil
24
37
  block capture with FLAG_SECURE. iOS secure-layer behavior requires device testing.
25
38
 
26
39
  See [SPEC](docs/SPEC.md) and [Acknowledgements](ACKNOWLEDGEMENTS.md).
40
+
41
+ ## API and ownership
42
+
43
+ | Method | Contract |
44
+ | --- | --- |
45
+ | `prevent()` | `Promise<void>`; request screenshot, recording and app-switcher protection together. |
46
+ | `allow()` | `Promise<void>`; release only the calling native object's protection. |
47
+ | `addListener(callback)` | Return a subscription with an idempotent `remove()` method. |
48
+
49
+ Repeated `prevent()` calls by the same object are idempotent. Protection is owned
50
+ by a native object rather than by each screen or each call: applications sharing
51
+ one JS object across sensitive screens must coordinate their prevent/allow
52
+ lifecycle. A separate runtime/object cannot release another object's protection.
53
+
54
+ Remove subscriptions when their owner unmounts. Removing the final JS subscriber
55
+ releases its native callback; it does not call `allow()`. There are at most 128
56
+ JS subscribers per runtime and 32 native owner/subscriber identities. Excess
57
+ registration throws. No providers, React hooks, custom-overlay API or upstream
58
+ permission-request API is exported.
59
+
60
+ ## Events and platform limits
61
+
62
+ `CaptureEventType` exports `NONE`, `RECORDING`, `END_RECORDING`, `CAPTURED`,
63
+ `APP_SWITCHING`, `UNKNOWN`, `ALLOW`, `PREVENT_SCREEN_CAPTURE`,
64
+ `PREVENT_SCREEN_RECORDING` and `PREVENT_SCREEN_APP_SWITCHING`. They represent
65
+ native event values; the module never reads screenshot contents.
66
+
67
+ Android declares `DETECT_SCREEN_CAPTURE`, a normal permission used for Android
68
+ 14+ screenshot callbacks. Its recording events use a virtual-display heuristic,
69
+ which can also reflect casting or external displays. It is not proof that a
70
+ recording was made. iOS uses notifications, an upstream secure-text-field layer
71
+ technique and opaque overlays; this is not a documented system-wide prevention
72
+ API. Missing activity/window or an unavailable secure layer rejects protection.
73
+
74
+ Check nested navigation, recording, app-switcher snapshots, activity recreation
75
+ and cleanup on each target device. The [contract](docs/SPEC.md) lists required
76
+ runtime acceptance; source and unit checks do not establish physical capture
77
+ prevention.
78
+
79
+ ## License and attribution
80
+
81
+ MIT; [LICENSE](LICENSE) covers this package and [LICENSE.upstream](LICENSE.upstream)
82
+ preserves the adapted upstream notice. [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md)
83
+ identifies the upstream subset and source provenance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-capture-protection",
3
- "version": "3.0.179-alpha.2026101503",
3
+ "version": "3.0.179-alpha.302",
4
4
  "description": "Permission-minimal screenshot, recording and app-switcher protection",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",