UNPKG

protect-scr

Version:

Comprehensive client-side security protection for React applications against screenshots, printing, and unauthorized access

131 lines 4.1 kB
export const securityPresets = { basic: { disableRightClick: true, disableTextSelection: true, disableKeyboardShortcuts: false, preventScreenshots: false, preventPrinting: true, preventPDFGeneration: false, preventDevTools: false, blurOnFocusLoss: false, showWarningOnProtectedAction: true, devToolsDetectionSensitivity: 'low', watermark: { enabled: false } }, standard: { disableRightClick: true, disableTextSelection: true, disableKeyboardShortcuts: true, preventScreenshots: true, preventPrinting: true, preventPDFGeneration: true, preventDevTools: true, blurOnFocusLoss: true, showWarningOnProtectedAction: true, devToolsDetectionSensitivity: 'medium', watermark: { enabled: true, text: 'CONFIDENTIAL', opacity: 0.05, fontSize: 32, color: '#666666', rotation: -30 } }, maximum: { disableRightClick: true, disableTextSelection: true, disableKeyboardShortcuts: true, preventScreenshots: true, preventPrinting: true, preventPDFGeneration: true, preventDevTools: true, blurOnFocusLoss: true, showWarningOnProtectedAction: true, redirectOnDevToolsDetection: 'about:blank', devToolsDetectionSensitivity: 'high', watermark: { enabled: true, text: 'HIGHLY CONFIDENTIAL', opacity: 0.15, fontSize: 48, color: '#ff0000', rotation: -45 } }, kiosk: { disableRightClick: true, disableTextSelection: true, disableKeyboardShortcuts: true, preventScreenshots: true, preventPrinting: true, preventPDFGeneration: true, preventDevTools: true, blurOnFocusLoss: false, // Don't blur in kiosk mode showWarningOnProtectedAction: false, // No alerts in kiosk mode redirectOnDevToolsDetection: window.location.href, // Redirect to same page devToolsDetectionSensitivity: 'high', watermark: { enabled: true, text: 'KIOSK MODE', opacity: 0.03, fontSize: 24, color: '#000000', rotation: 0 } }, presentation: { disableRightClick: true, disableTextSelection: false, // Allow text selection for notes disableKeyboardShortcuts: true, preventScreenshots: true, preventPrinting: false, // Allow printing for handouts preventPDFGeneration: false, preventDevTools: true, blurOnFocusLoss: true, showWarningOnProtectedAction: true, devToolsDetectionSensitivity: 'medium', watermark: { enabled: true, text: 'PRESENTATION MATERIAL', opacity: 0.08, fontSize: 28, color: '#333333', rotation: -20 } }, exam: { disableRightClick: true, disableTextSelection: true, disableKeyboardShortcuts: true, preventScreenshots: true, preventPrinting: true, preventPDFGeneration: true, preventDevTools: true, blurOnFocusLoss: true, showWarningOnProtectedAction: false, // Silent mode to avoid disruption redirectOnDevToolsDetection: '/exam-violation', devToolsDetectionSensitivity: 'high', watermark: { enabled: true, text: 'EXAMINATION IN PROGRESS', opacity: 0.1, fontSize: 36, color: '#cc0000', rotation: -35 } } }; export function getPresetConfig(preset) { const config = securityPresets[preset]; if (!config) { throw new Error(`Unknown security preset: ${preset}`); } return { ...config }; } export function listAvailablePresets() { return Object.keys(securityPresets); } //# sourceMappingURL=index.js.map