react-native-privacy-guard-kit 0.1.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.
- package/LICENSE +20 -0
- package/PrivacyGuardKit.podspec +27 -0
- package/README.md +320 -0
- package/android/CMakeLists.txt +47 -0
- package/android/build.gradle +64 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/privacyguardkit/PrivacyGuardKitPackage.kt +17 -0
- package/android/src/main/java/com/privacyguardkit/Privacyguardkitmodule .kt +208 -0
- package/android/src/main/java/com/privacyguardkit/Screenshotobserver.kt +66 -0
- package/android/src/main/java/com/privacyguardkit/Secureview.kt +104 -0
- package/android/src/main/java/com/privacyguardkit/Secureviewmanager.kt +27 -0
- package/android/src/main/jni/react/renderer/components/PrivacyGuardKitViewSpec/RNSecureViewComponentDescriptor.h +25 -0
- package/ios/PrivacyGuardKit-Umbrella.h +14 -0
- package/ios/PrivacyGuardKit.m +38 -0
- package/ios/PrivacyGuardKit.swift +221 -0
- package/ios/RNSecureViewComponentView.h +16 -0
- package/ios/RNSecureViewComponentView.mm +84 -0
- package/ios/RNSecureViewManager.mm +48 -0
- package/lib/module/Hooks.js +119 -0
- package/lib/module/Hooks.js.map +1 -0
- package/lib/module/NativePrivacyGuardKit.js +12 -0
- package/lib/module/NativePrivacyGuardKit.js.map +1 -0
- package/lib/module/PrivacyGuardProvider.js +99 -0
- package/lib/module/PrivacyGuardProvider.js.map +1 -0
- package/lib/module/PrivacyGuardkitApi.js +104 -0
- package/lib/module/PrivacyGuardkitApi.js.map +1 -0
- package/lib/module/SecureView.js +24 -0
- package/lib/module/SecureView.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/specs/RNSecureViewNativeComponent.ts +19 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Hooks.d.ts +29 -0
- package/lib/typescript/src/Hooks.d.ts.map +1 -0
- package/lib/typescript/src/NativePrivacyGuardKit.d.ts +4 -0
- package/lib/typescript/src/NativePrivacyGuardKit.d.ts.map +1 -0
- package/lib/typescript/src/PrivacyGuardProvider.d.ts +30 -0
- package/lib/typescript/src/PrivacyGuardProvider.d.ts.map +1 -0
- package/lib/typescript/src/PrivacyGuardkitApi.d.ts +45 -0
- package/lib/typescript/src/PrivacyGuardkitApi.d.ts.map +1 -0
- package/lib/typescript/src/SecureView.d.ts +10 -0
- package/lib/typescript/src/SecureView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/RNSecureViewNativeComponent.d.ts +11 -0
- package/lib/typescript/src/specs/RNSecureViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +29 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +174 -0
- package/src/Hooks.ts +138 -0
- package/src/NativePrivacyGuardKit.ts +13 -0
- package/src/PrivacyGuardProvider.tsx +134 -0
- package/src/PrivacyGuardkitApi.ts +123 -0
- package/src/SecureView.tsx +29 -0
- package/src/index.tsx +37 -0
- package/src/specs/RNSecureViewNativeComponent.ts +19 -0
- package/src/types.ts +34 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativePrivacyGuardKit, PrivacyGuardKitEmitter } from "./NativePrivacyGuardKit.js";
|
|
4
|
+
// ─────────────────────────────────────────────────────────────
|
|
5
|
+
// Screen Capture
|
|
6
|
+
// ─────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Prevents screenshots and blurs screen-recording output.
|
|
10
|
+
* On Android uses FLAG_SECURE; on iOS uses a secure UITextField overlay.
|
|
11
|
+
*/
|
|
12
|
+
export async function disableScreenCapture() {
|
|
13
|
+
await NativePrivacyGuardKit.disableScreenCapture();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Re-enables screenshots and screen-recording. */
|
|
17
|
+
export async function enableScreenCapture() {
|
|
18
|
+
await NativePrivacyGuardKit.enableScreenCapture();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Returns true if screen capture is currently disabled. */
|
|
22
|
+
export async function isScreenCaptureDisabled() {
|
|
23
|
+
return NativePrivacyGuardKit.isScreenCaptureDisabled();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ─────────────────────────────────────────────────────────────
|
|
27
|
+
// Screen Recording Detection
|
|
28
|
+
// ─────────────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
/** Returns true if the screen is currently being recorded/mirrored. */
|
|
31
|
+
export async function isScreenBeingRecorded() {
|
|
32
|
+
return NativePrivacyGuardKit.isScreenBeingRecorded();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ─────────────────────────────────────────────────────────────
|
|
36
|
+
// App Switcher Protection
|
|
37
|
+
// ─────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Covers the app preview shown in the OS task switcher with a
|
|
41
|
+
* blank overlay, preventing sensitive content from being visible.
|
|
42
|
+
*/
|
|
43
|
+
export async function enableAppSwitcherProtection() {
|
|
44
|
+
await NativePrivacyGuardKit.enableAppSwitcherProtection();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Removes the app switcher overlay. */
|
|
48
|
+
export async function disableAppSwitcherProtection() {
|
|
49
|
+
await NativePrivacyGuardKit.disableAppSwitcherProtection();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ─────────────────────────────────────────────────────────────
|
|
53
|
+
// Clipboard
|
|
54
|
+
// ─────────────────────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
/** Clears the system clipboard immediately. */
|
|
57
|
+
export async function clearClipboard() {
|
|
58
|
+
await NativePrivacyGuardKit.clearClipboard();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ─────────────────────────────────────────────────────────────
|
|
62
|
+
// Event Listeners
|
|
63
|
+
// ─────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
// NativeEventEmitter expects (...args: readonly Object[]) => unknown
|
|
66
|
+
// We wrap the typed callback to satisfy that constraint safely.
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Starts the native screenshot observer and registers your callback.
|
|
70
|
+
* Returns a cleanup function — call it to unsubscribe.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const remove = onScreenshotTaken(() => Alert.alert('Screenshot detected!'));
|
|
74
|
+
* // later:
|
|
75
|
+
* remove();
|
|
76
|
+
*/
|
|
77
|
+
export function onScreenshotTaken(callback) {
|
|
78
|
+
NativePrivacyGuardKit.startScreenshotListener();
|
|
79
|
+
const sub = PrivacyGuardKitEmitter.addListener('onScreenshotTaken', callback);
|
|
80
|
+
return () => {
|
|
81
|
+
sub.remove();
|
|
82
|
+
NativePrivacyGuardKit.stopScreenshotListener();
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Fires when screen recording begins.
|
|
88
|
+
* Returns a cleanup function.
|
|
89
|
+
*/
|
|
90
|
+
export function onScreenRecordingStarted(callback) {
|
|
91
|
+
NativePrivacyGuardKit.startScreenshotListener(); // same listener start
|
|
92
|
+
const sub = PrivacyGuardKitEmitter.addListener('onScreenRecordingStarted', callback);
|
|
93
|
+
return () => sub.remove();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Fires when screen recording stops.
|
|
98
|
+
* Returns a cleanup function.
|
|
99
|
+
*/
|
|
100
|
+
export function onScreenRecordingStopped(callback) {
|
|
101
|
+
const sub = PrivacyGuardKitEmitter.addListener('onScreenRecordingStopped', callback);
|
|
102
|
+
return () => sub.remove();
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=PrivacyGuardkitApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativePrivacyGuardKit","PrivacyGuardKitEmitter","disableScreenCapture","enableScreenCapture","isScreenCaptureDisabled","isScreenBeingRecorded","enableAppSwitcherProtection","disableAppSwitcherProtection","clearClipboard","onScreenshotTaken","callback","startScreenshotListener","sub","addListener","remove","stopScreenshotListener","onScreenRecordingStarted","onScreenRecordingStopped"],"sourceRoot":"../../src","sources":["PrivacyGuardkitApi.ts"],"mappings":";;AAAA,SACEA,qBAAqB,EACrBC,sBAAsB,QACjB,4BAAyB;AAGhC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeC,oBAAoBA,CAAA,EAAkB;EAC1D,MAAMF,qBAAqB,CAACE,oBAAoB,CAAC,CAAC;AACpD;;AAEA;AACA,OAAO,eAAeC,mBAAmBA,CAAA,EAAkB;EACzD,MAAMH,qBAAqB,CAACG,mBAAmB,CAAC,CAAC;AACnD;;AAEA;AACA,OAAO,eAAeC,uBAAuBA,CAAA,EAAqB;EAChE,OAAOJ,qBAAqB,CAACI,uBAAuB,CAAC,CAAC;AACxD;;AAEA;AACA;AACA;;AAEA;AACA,OAAO,eAAeC,qBAAqBA,CAAA,EAAqB;EAC9D,OAAOL,qBAAqB,CAACK,qBAAqB,CAAC,CAAC;AACtD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,eAAeC,2BAA2BA,CAAA,EAAkB;EACjE,MAAMN,qBAAqB,CAACM,2BAA2B,CAAC,CAAC;AAC3D;;AAEA;AACA,OAAO,eAAeC,4BAA4BA,CAAA,EAAkB;EAClE,MAAMP,qBAAqB,CAACO,4BAA4B,CAAC,CAAC;AAC5D;;AAEA;AACA;AACA;;AAEA;AACA,OAAO,eAAeC,cAAcA,CAAA,EAAkB;EACpD,MAAMR,qBAAqB,CAACQ,cAAc,CAAC,CAAC;AAC9C;;AAEA;AACA;AACA;;AAKA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,QAA4B,EAAc;EAC1EV,qBAAqB,CAACW,uBAAuB,CAAC,CAAC;EAC/C,MAAMC,GAAG,GAAGX,sBAAsB,CAACY,WAAW,CAC5C,mBAAmB,EACnBH,QACF,CAAC;EACD,OAAO,MAAM;IACXE,GAAG,CAACE,MAAM,CAAC,CAAC;IACZd,qBAAqB,CAACe,sBAAsB,CAAC,CAAC;EAChD,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CACtCN,QAA2B,EACf;EACZV,qBAAqB,CAACW,uBAAuB,CAAC,CAAC,CAAC,CAAC;EACjD,MAAMC,GAAG,GAAGX,sBAAsB,CAACY,WAAW,CAC5C,0BAA0B,EAC1BH,QACF,CAAC;EACD,OAAO,MAAME,GAAG,CAACE,MAAM,CAAC,CAAC;AAC3B;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASG,wBAAwBA,CACtCP,QAA2B,EACf;EACZ,MAAME,GAAG,GAAGX,sBAAsB,CAACY,WAAW,CAC5C,0BAA0B,EAC1BH,QACF,CAAC;EACD,OAAO,MAAME,GAAG,CAACE,MAAM,CAAC,CAAC;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// SecureView.tsx
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from 'react-native';
|
|
6
|
+
import RNSecureViewSpec from './specs/RNSecureViewNativeComponent';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function SecureView({
|
|
9
|
+
disableCopyPaste = true,
|
|
10
|
+
style,
|
|
11
|
+
children
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/_jsx(RNSecureViewSpec, {
|
|
14
|
+
isCopyPasteDisabled: disableCopyPaste,
|
|
15
|
+
style: [styles.container, style],
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
flex: 1
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=SecureView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","RNSecureViewSpec","jsx","_jsx","SecureView","disableCopyPaste","style","children","isCopyPasteDisabled","styles","container","create","flex"],"sourceRoot":"../../src","sources":["SecureView.tsx"],"mappings":";;AAAA;;AAEA,SAASA,UAAU,QAAwC,cAAc;AACzE,OAAOC,gBAAgB,MAAM,qCAAqC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQnE,OAAO,SAASC,UAAUA,CAAC;EACzBC,gBAAgB,GAAG,IAAI;EACvBC,KAAK;EACLC;AACe,CAAC,EAAE;EAClB,oBACEJ,IAAA,CAACF,gBAAgB;IACfO,mBAAmB,EAAEH,gBAAiB;IACtCC,KAAK,EAAE,CAACG,MAAM,CAACC,SAAS,EAAEJ,KAAK,CAAE;IAAAC,QAAA,EAEhCA;EAAQ,CACO,CAAC;AAEvB;AAEA,MAAME,MAAM,GAAGT,UAAU,CAACW,MAAM,CAAC;EAC/BD,SAAS,EAAE;IAAEE,IAAI,EAAE;EAAE;AACvB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// API
|
|
4
|
+
export { disableScreenCapture, enableScreenCapture, isScreenCaptureDisabled, isScreenBeingRecorded, enableAppSwitcherProtection, disableAppSwitcherProtection, clearClipboard, onScreenshotTaken, onScreenRecordingStarted, onScreenRecordingStopped } from "./PrivacyGuardkitApi.js";
|
|
5
|
+
|
|
6
|
+
// Hooks
|
|
7
|
+
export { usePrivacyGuard, useScreenshotListener, useScreenRecording } from "./Hooks.js";
|
|
8
|
+
|
|
9
|
+
// Provider + context hook
|
|
10
|
+
export { PrivacyGuardProvider, usePrivacyGuardContext } from "./PrivacyGuardProvider.js";
|
|
11
|
+
|
|
12
|
+
// Components
|
|
13
|
+
export { SecureView } from "./SecureView.js";
|
|
14
|
+
|
|
15
|
+
// Types
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["disableScreenCapture","enableScreenCapture","isScreenCaptureDisabled","isScreenBeingRecorded","enableAppSwitcherProtection","disableAppSwitcherProtection","clearClipboard","onScreenshotTaken","onScreenRecordingStarted","onScreenRecordingStopped","usePrivacyGuard","useScreenshotListener","useScreenRecording","PrivacyGuardProvider","usePrivacyGuardContext","SecureView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,SACEA,oBAAoB,EACpBC,mBAAmB,EACnBC,uBAAuB,EACvBC,qBAAqB,EACrBC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,cAAc,EACdC,iBAAiB,EACjBC,wBAAwB,EACxBC,wBAAwB,QACnB,yBAAsB;;AAE7B;AACA,SACEC,eAAe,EACfC,qBAAqB,EACrBC,kBAAkB,QACb,YAAS;;AAEhB;AACA,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,2BAAwB;;AAE/B;AACA,SAASC,UAAU,QAAQ,iBAAc;;AAEzC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// RN 0.73+ exports codegenNativeComponent from the top-level package.
|
|
6
|
+
// Deep imports like 'react-native/Libraries/Utilities/codegenNativeComponent'
|
|
7
|
+
// are deprecated and broken in RN 0.83. Use the top-level export instead.
|
|
8
|
+
|
|
9
|
+
import type { ViewProps } from 'react-native';
|
|
10
|
+
import { codegenNativeComponent } from 'react-native';
|
|
11
|
+
import type { HostComponent } from 'react-native';
|
|
12
|
+
|
|
13
|
+
export interface NativeProps extends ViewProps {
|
|
14
|
+
isCopyPasteDisabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default codegenNativeComponent<NativeProps>(
|
|
18
|
+
'RNSecureView'
|
|
19
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { UsePrivacyGuardReturn, PrivacyGuardKitConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* One-stop hook that wires up all privacy guard features declaratively.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const { isRecording, disableScreenCapture } = usePrivacyGuard({
|
|
7
|
+
* disableScreenCapture: true,
|
|
8
|
+
* enableAppSwitcherProtection: true,
|
|
9
|
+
* });
|
|
10
|
+
*/
|
|
11
|
+
export declare function usePrivacyGuard(config?: PrivacyGuardKitConfig): UsePrivacyGuardReturn;
|
|
12
|
+
/**
|
|
13
|
+
* Calls `onTaken` every time the user takes a screenshot.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* useScreenshotListener(() => {
|
|
17
|
+
* console.log('Screenshot detected!');
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export declare function useScreenshotListener(onTaken: () => void): void;
|
|
21
|
+
/**
|
|
22
|
+
* Reactive boolean — true while screen is being recorded.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const isRecording = useScreenRecording();
|
|
26
|
+
* if (isRecording) return <BlurredScreen />;
|
|
27
|
+
*/
|
|
28
|
+
export declare function useScreenRecording(): boolean;
|
|
29
|
+
//# sourceMappingURL=Hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../../../src/Hooks.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAM5E;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,GAAE,qBAA0B,GACjC,qBAAqB,CAwDvB;AAMD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAK/D;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAoB5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativePrivacyGuardKit.d.ts","sourceRoot":"","sources":["../../../src/NativePrivacyGuardKit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAWjE,eAAO,MAAM,qBAAqB,KAAkB,CAAC;AACrD,eAAO,MAAM,sBAAsB,iEAA0C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PrivacyGuardKitConfig, UsePrivacyGuardReturn } from './types';
|
|
3
|
+
interface PrivacyGuardProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
config?: PrivacyGuardKitConfig;
|
|
6
|
+
/** Called every time a screenshot is detected */
|
|
7
|
+
onScreenshot?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wrap your root (or any sensitive screen) with this provider.
|
|
11
|
+
* All children can call `usePrivacyGuardContext()` to access the API.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <PrivacyGuardProvider
|
|
15
|
+
* config={{ disableScreenCapture: true, enableAppSwitcherProtection: true }}
|
|
16
|
+
* onScreenshot={() => Alert.alert('Screenshot blocked!')}
|
|
17
|
+
* >
|
|
18
|
+
* <App />
|
|
19
|
+
* </PrivacyGuardProvider>
|
|
20
|
+
*/
|
|
21
|
+
export declare function PrivacyGuardProvider({ children, config, onScreenshot, }: PrivacyGuardProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Access the PrivacyGuard API from any component inside the provider.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const { isRecording } = usePrivacyGuardContext();
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePrivacyGuardContext(): UsePrivacyGuardReturn;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=PrivacyGuardProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrivacyGuardProvider.d.ts","sourceRoot":"","sources":["../../../src/PrivacyGuardProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAa5E,UAAU,yBAAyB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,MAAW,EACX,YAAY,GACb,EAAE,yBAAyB,2CA0D3B;AAMD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,qBAAqB,CAQ9D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ScreenRecordingEventPayload } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Prevents screenshots and blurs screen-recording output.
|
|
4
|
+
* On Android uses FLAG_SECURE; on iOS uses a secure UITextField overlay.
|
|
5
|
+
*/
|
|
6
|
+
export declare function disableScreenCapture(): Promise<void>;
|
|
7
|
+
/** Re-enables screenshots and screen-recording. */
|
|
8
|
+
export declare function enableScreenCapture(): Promise<void>;
|
|
9
|
+
/** Returns true if screen capture is currently disabled. */
|
|
10
|
+
export declare function isScreenCaptureDisabled(): Promise<boolean>;
|
|
11
|
+
/** Returns true if the screen is currently being recorded/mirrored. */
|
|
12
|
+
export declare function isScreenBeingRecorded(): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Covers the app preview shown in the OS task switcher with a
|
|
15
|
+
* blank overlay, preventing sensitive content from being visible.
|
|
16
|
+
*/
|
|
17
|
+
export declare function enableAppSwitcherProtection(): Promise<void>;
|
|
18
|
+
/** Removes the app switcher overlay. */
|
|
19
|
+
export declare function disableAppSwitcherProtection(): Promise<void>;
|
|
20
|
+
/** Clears the system clipboard immediately. */
|
|
21
|
+
export declare function clearClipboard(): Promise<void>;
|
|
22
|
+
type ScreenshotListener = () => void;
|
|
23
|
+
type RecordingListener = (payload: ScreenRecordingEventPayload) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Starts the native screenshot observer and registers your callback.
|
|
26
|
+
* Returns a cleanup function — call it to unsubscribe.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const remove = onScreenshotTaken(() => Alert.alert('Screenshot detected!'));
|
|
30
|
+
* // later:
|
|
31
|
+
* remove();
|
|
32
|
+
*/
|
|
33
|
+
export declare function onScreenshotTaken(callback: ScreenshotListener): () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Fires when screen recording begins.
|
|
36
|
+
* Returns a cleanup function.
|
|
37
|
+
*/
|
|
38
|
+
export declare function onScreenRecordingStarted(callback: RecordingListener): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Fires when screen recording stops.
|
|
41
|
+
* Returns a cleanup function.
|
|
42
|
+
*/
|
|
43
|
+
export declare function onScreenRecordingStopped(callback: RecordingListener): () => void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=PrivacyGuardkitApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrivacyGuardkitApi.d.ts","sourceRoot":"","sources":["../../../src/PrivacyGuardkitApi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAM3D;;;GAGG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED,mDAAmD;AACnD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEzD;AAED,4DAA4D;AAC5D,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEhE;AAMD,uEAAuE;AACvE,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAE9D;AAMD;;;GAGG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAEjE;AAED,wCAAwC;AACxC,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAElE;AAMD,+CAA+C;AAC/C,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD;AAMD,KAAK,kBAAkB,GAAG,MAAM,IAAI,CAAC;AACrC,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;AAMxE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAU1E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,iBAAiB,GAC1B,MAAM,IAAI,CAOZ;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,iBAAiB,GAC1B,MAAM,IAAI,CAMZ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ViewStyle, type StyleProp } from 'react-native';
|
|
3
|
+
type SecureViewProps = {
|
|
4
|
+
disableCopyPaste?: boolean;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare function SecureView({ disableCopyPaste, style, children, }: SecureViewProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=SecureView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecureView.d.ts","sourceRoot":"","sources":["../../../src/SecureView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG1E,KAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,gBAAuB,EACvB,KAAK,EACL,QAAQ,GACT,EAAE,eAAe,2CASjB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { disableScreenCapture, enableScreenCapture, isScreenCaptureDisabled, isScreenBeingRecorded, enableAppSwitcherProtection, disableAppSwitcherProtection, clearClipboard, onScreenshotTaken, onScreenRecordingStarted, onScreenRecordingStopped, } from './PrivacyGuardkitApi';
|
|
2
|
+
export { usePrivacyGuard, useScreenshotListener, useScreenRecording, } from './Hooks';
|
|
3
|
+
export { PrivacyGuardProvider, usePrivacyGuardContext, } from './PrivacyGuardProvider';
|
|
4
|
+
export { SecureView } from './SecureView';
|
|
5
|
+
export type { PrivacyGuardEvent, PrivacyGuardKitConfig, UsePrivacyGuardReturn, ScreenRecordingEventPayload, } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @format
|
|
3
|
+
*/
|
|
4
|
+
import type { ViewProps } from 'react-native';
|
|
5
|
+
import type { HostComponent } from 'react-native';
|
|
6
|
+
export interface NativeProps extends ViewProps {
|
|
7
|
+
isCopyPasteDisabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: HostComponent<NativeProps>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=RNSecureViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RNSecureViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/RNSecureViewNativeComponent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type PrivacyGuardEvent = 'onScreenshotTaken' | 'onScreenRecordingStarted' | 'onScreenRecordingStopped';
|
|
2
|
+
export interface ScreenRecordingEventPayload {
|
|
3
|
+
isRecording: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface PrivacyGuardKitConfig {
|
|
6
|
+
/** Disable screen capture (screenshot + screen recording blur) */
|
|
7
|
+
disableScreenCapture?: boolean;
|
|
8
|
+
/** Show a blank overlay in the app switcher */
|
|
9
|
+
enableAppSwitcherProtection?: boolean;
|
|
10
|
+
/** Prevent copy/paste within SecureView children */
|
|
11
|
+
disableCopyPaste?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UsePrivacyGuardReturn {
|
|
14
|
+
/** Whether screen capture is currently disabled */
|
|
15
|
+
isScreenCaptureDisabled: boolean;
|
|
16
|
+
/** Whether the screen is actively being recorded */
|
|
17
|
+
isRecording: boolean;
|
|
18
|
+
/** Disable screenshots and screen-recording preview */
|
|
19
|
+
disableScreenCapture: () => Promise<void>;
|
|
20
|
+
/** Re-enable screenshots */
|
|
21
|
+
enableScreenCapture: () => Promise<void>;
|
|
22
|
+
/** Enable app switcher blur overlay */
|
|
23
|
+
enableAppSwitcherProtection: () => Promise<void>;
|
|
24
|
+
/** Disable app switcher blur overlay */
|
|
25
|
+
disableAppSwitcherProtection: () => Promise<void>;
|
|
26
|
+
/** Clears the system clipboard */
|
|
27
|
+
clearClipboard: () => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,+CAA+C;IAC/C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,oDAAoD;IACpD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,uBAAuB,EAAE,OAAO,CAAC;IACjC,oDAAoD;IACpD,WAAW,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,4BAA4B;IAC5B,mBAAmB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,uCAAuC;IACvC,2BAA2B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,wCAAwC;IACxC,4BAA4B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,kCAAkC;IAClC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-privacy-guard-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A production-ready React Native library to protect sensitive app content — disable screenshots, detect screen recording, guard the app switcher, block copy/paste, and listen to capture events. Fully typed, hook & provider support, New Architecture ready, and Google 16KB page size compatible.",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-privacy-guard-kit-example",
|
|
36
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/rushikeshpandit/react-native-privacy-guard-kit.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "Rushikesh Pandit <rushikesh.d.pandit@gmail.com> (https://www.github.com/rushikeshpandit)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/rushikeshpandit/react-native-privacy-guard-kit/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/rushikeshpandit/react-native-privacy-guard-kit#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
+
"@eslint/compat": "^1.3.2",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
+
"@eslint/js": "^9.35.0",
|
|
66
|
+
"@react-native/babel-preset": "0.83.0",
|
|
67
|
+
"@react-native/eslint-config": "0.83.0",
|
|
68
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
69
|
+
"@types/jest": "^29.5.14",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"commitlint": "^19.8.1",
|
|
72
|
+
"del-cli": "^6.0.0",
|
|
73
|
+
"eslint": "^9.35.0",
|
|
74
|
+
"eslint-config-prettier": "^10.1.8",
|
|
75
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"lefthook": "^2.0.3",
|
|
78
|
+
"prettier": "^2.8.8",
|
|
79
|
+
"react": "19.2.0",
|
|
80
|
+
"react-native": "0.83.0",
|
|
81
|
+
"react-native-builder-bob": "^0.40.13",
|
|
82
|
+
"release-it": "^19.0.4",
|
|
83
|
+
"turbo": "^2.5.6",
|
|
84
|
+
"typescript": "^5.9.2"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": "*",
|
|
88
|
+
"react-native": "*"
|
|
89
|
+
},
|
|
90
|
+
"workspaces": [
|
|
91
|
+
"example"
|
|
92
|
+
],
|
|
93
|
+
"packageManager": "yarn@4.11.0",
|
|
94
|
+
"react-native-builder-bob": {
|
|
95
|
+
"source": "src",
|
|
96
|
+
"output": "lib",
|
|
97
|
+
"targets": [
|
|
98
|
+
[
|
|
99
|
+
"module",
|
|
100
|
+
{
|
|
101
|
+
"esm": true
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"typescript",
|
|
106
|
+
{
|
|
107
|
+
"project": "tsconfig.build.json"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"codegenConfig": {
|
|
113
|
+
"name": "PrivacyGuardKitViewSpec",
|
|
114
|
+
"type": "components",
|
|
115
|
+
"jsSrcsDir": "src/specs",
|
|
116
|
+
"android": {
|
|
117
|
+
"javaPackageName": "com.privacyguardkit"
|
|
118
|
+
},
|
|
119
|
+
"ios": {
|
|
120
|
+
"componentProvider": {
|
|
121
|
+
"RNSecureView": "RNSecureViewComponentView"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"prettier": {
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
},
|
|
132
|
+
"jest": {
|
|
133
|
+
"preset": "react-native",
|
|
134
|
+
"modulePathIgnorePatterns": [
|
|
135
|
+
"<rootDir>/example/node_modules",
|
|
136
|
+
"<rootDir>/lib/"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"commitlint": {
|
|
140
|
+
"extends": [
|
|
141
|
+
"@commitlint/config-conventional"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"release-it": {
|
|
145
|
+
"git": {
|
|
146
|
+
"commitMessage": "chore: release ${version}",
|
|
147
|
+
"tagName": "v${version}"
|
|
148
|
+
},
|
|
149
|
+
"npm": {
|
|
150
|
+
"publish": true
|
|
151
|
+
},
|
|
152
|
+
"github": {
|
|
153
|
+
"release": true
|
|
154
|
+
},
|
|
155
|
+
"plugins": {
|
|
156
|
+
"@release-it/conventional-changelog": {
|
|
157
|
+
"preset": {
|
|
158
|
+
"name": "angular"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"create-react-native-library": {
|
|
164
|
+
"type": "fabric-view",
|
|
165
|
+
"languages": "kotlin-objc",
|
|
166
|
+
"tools": [
|
|
167
|
+
"eslint",
|
|
168
|
+
"jest",
|
|
169
|
+
"lefthook",
|
|
170
|
+
"release-it"
|
|
171
|
+
],
|
|
172
|
+
"version": "0.57.2"
|
|
173
|
+
}
|
|
174
|
+
}
|