{"_id":"@asmitgh/proctoring-detector","name":"@asmitgh/proctoring-detector","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@asmitgh/proctoring-detector","version":"1.0.0","description":"Lightweight browser proctoring detector. Monitors tab switches, fullscreen exits, copy/paste, devtools shortcuts, and network status. Zero ML, zero dependencies.","author":{"name":"Asmit Ghosh","email":"asmitgh@gmail.com","url":"https://github.com/asmitgh"},"license":"MIT","keywords":["proctoring","browser","exam","monitoring","tab-switch","devtools","assessment"],"repository":{"type":"git","url":"git+https://github.com/asmitgh/proctoring-detector.git"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --dts --watch","prepublishOnly":"npm run build"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"gitHead":"682775e89ae0cec11fcb1aa5bfec85861bf6354d","_id":"@asmitgh/proctoring-detector@1.0.0","bugs":{"url":"https://github.com/asmitgh/proctoring-detector/issues"},"homepage":"https://github.com/asmitgh/proctoring-detector#readme","_nodeVersion":"22.17.1","_npmVersion":"11.12.1","dist":{"integrity":"sha512-Oeu7cbgl5XSggSTrVLAr04UNp3MwkqMXSFAGEeGBF1yaehrOZk/KSDLx8AKHthGvTylSN4S29SedrOzKwi9+kA==","shasum":"88f463d9491694211fc8f78509d246b4dca1633d","tarball":"https://registry.npmjs.org/@asmitgh/proctoring-detector/-/proctoring-detector-1.0.0.tgz","fileCount":7,"unpackedSize":26337,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICVaYLSpgYt+B0NqPwHEVfuHDxmyAvv/uV+67HmVAE19AiEAjfDrk2cspUMacJ19BsTJleGYvRqlGPjgPbWe83YZBGw="}]},"_npmUser":{"name":"asmitgh","email":"asmit@operonn.com"},"directories":{},"maintainers":[{"name":"asmitgh","email":"asmit@operonn.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/proctoring-detector_1.0.0_1776690897255_0.4716519708370386"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T13:14:57.144Z","1.0.0":"2026-04-20T13:14:57.378Z","modified":"2026-04-20T13:14:57.524Z"},"maintainers":[{"name":"asmitgh","email":"asmit@operonn.com"}],"description":"Lightweight browser proctoring detector. Monitors tab switches, fullscreen exits, copy/paste, devtools shortcuts, and network status. Zero ML, zero dependencies.","homepage":"https://github.com/asmitgh/proctoring-detector#readme","keywords":["proctoring","browser","exam","monitoring","tab-switch","devtools","assessment"],"repository":{"type":"git","url":"git+https://github.com/asmitgh/proctoring-detector.git"},"author":{"name":"Asmit Ghosh","email":"asmitgh@gmail.com","url":"https://github.com/asmitgh"},"bugs":{"url":"https://github.com/asmitgh/proctoring-detector/issues"},"license":"MIT","readme":"# @asmitgh/proctoring-detector\n\nLightweight browser proctoring detector. Zero ML, zero dependencies — pure DOM event monitoring.\n\nDetects and optionally blocks:\n- Tab switches / window blur\n- Fullscreen exits\n- Copy / paste / cut\n- Right-click / context menu\n- DevTools shortcuts (F12, Ctrl+Shift+I/J/C, Ctrl+U/S)\n- Screenshot keys (PrintScreen, macOS Cmd+Shift+3/4/5)\n- Network going offline\n\n## Installation\n\n```bash\nnpm install @asmitgh/proctoring-detector\n```\n\n## Quick Start\n\n```ts\nimport { getProctoringDetector } from \"@asmitgh/proctoring-detector\";\n\nconst detector = getProctoringDetector();\n\ndetector.start((violation) => {\n  console.log(violation.type, violation.severity, violation.description);\n  // Send to your API, update UI, etc.\n});\n\n// Later — cleanup\ndetector.stop();\n```\n\n## Usage with React\n\n```tsx\nimport { useEffect } from \"react\";\nimport { getProctoringDetector, ProctoringViolation } from \"@asmitgh/proctoring-detector\";\n\nexport function ExamPage() {\n  useEffect(() => {\n    const detector = getProctoringDetector();\n\n    detector.start((violation: ProctoringViolation) => {\n      fetch(\"/api/proctoring/event\", {\n        method: \"POST\",\n        body: JSON.stringify(violation),\n      });\n    });\n\n    return () => detector.stop();\n  }, []);\n\n  return <div>Exam content</div>;\n}\n```\n\n## API\n\n### `getProctoringDetector(): ProctoringDetector`\n\nReturns the singleton detector instance.\n\n### `new ProctoringDetector()`\n\nCreate a fresh instance (useful for testing).\n\n### `detector.start(onViolation: ViolationCallback): void`\n\nStart monitoring. Attaches all event listeners.\n\n### `detector.stop(): void`\n\nStop monitoring. Removes all event listeners.\n\n### `detector.getViolationCounts()`\n\n```ts\n{\n  tabSwitches: number;\n  keyPresses: number;\n  rightClicks: number;\n  copyPastes: number;\n}\n```\n\n## Types\n\n```ts\ntype ViolationType =\n  | \"TAB_SWITCH\"\n  | \"WINDOW_BLUR\"\n  | \"FULLSCREEN_EXIT\"\n  | \"RIGHT_CLICK\"\n  | \"PROHIBITED_KEY\"\n  | \"COPY_PASTE\"\n  | \"NETWORK_OFFLINE\";\n\ninterface ProctoringViolation {\n  type: ViolationType;\n  description: string;\n  timestamp: number;\n  severity?: \"LOW\" | \"MEDIUM\" | \"HIGH\";\n}\n\ntype ViolationCallback = (violation: ProctoringViolation) => void;\n```\n\n## Severity Levels\n\n| Severity | Examples |\n|----------|---------|\n| `HIGH` | Tab switch, window blur, fullscreen exit, copy/paste, devtools shortcuts |\n| `MEDIUM` | Right click |\n| `LOW` | Screenshot keys |\n\n## License\n\nMIT © [Asmit Ghosh](https://github.com/asmitgh)\n","readmeFilename":"README.md","_rev":"1-d0b58f0c90faf63cd8b022fac6c3660d"}