npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bonhomie/react-security

v1.0.0

Published

A frontend security layer for React: devtools detection, screenshot blocking, anti-iframe, tamper detection, watermarking, and more.

Readme

@bonhomie/react-security


🚀 Install

npm install @bonhomie/react-security

✨ Feature Matrix

| Feature | Low | Medium | High | | -------------------------- | -------- | -------- | -------- | | DevTools Detection | ✔ | ✔ | ✔ | | Screenshot Block | ✖ | ✔ | ✔ | | Copy/Paste Block | ✖ | ✔ | ✔ | | Right–Click Block | ✖ | ✔ | ✔ | | Route Tamper Detection | ✔ | ✔ | ✔ | | Anti-Iframe Lock | ✔ | ✔ | ✔ | | Lock Screen | ✖ | ✔ | ✔ | | Noise Overlay | ✖ | ✖ | ✔ | | Watermark | Optional | Optional | ✔ | | Auto-Logout | ✖ | Optional | Optional | | AI Screenshot Detection | Optional | Optional | ✔ | | VPN Detection | Optional | Optional | ✔ | | Keystroke Tamper Detection | Optional | Optional | ✔ |


🧩 Basic Usage (Recommended)

import {
  ReactSecurityProvider,
  SecurePage,
  AntiIframe,
  BlockInspect
} from "@bonhomie/react-security";

export default function App() {
  return (
    <ReactSecurityProvider level="high">
      <AntiIframe>
        <BlockInspect>
          <SecurePage>
            <Dashboard />
          </SecurePage>
        </BlockInspect>
      </AntiIframe>
    </ReactSecurityProvider>
  );
}

🎛 Security Levels (Presets)

LOW

{
  blockDevTools: true,
  blockScreenshot: false,
  blockCopy: false,
  lockOnSuspicious: false,
  autoLogout: false,
  noiseOverlay: false
}

MEDIUM (recommended for SaaS)

{
  blockDevTools: true,
  blockScreenshot: true,
  blockCopy: true,
  lockOnSuspicious: true,
  showLockOverlay: true
}

HIGH (fintech, exam apps, dashboards)

{
  blockDevTools: true,
  blockScreenshot: true,
  blockCopy: true,
  noiseOverlay: true,
  lockOnSuspicious: true,
  showLockOverlay: true,
  enableWatermark: true
}

⚙️ Provider Configuration (Advanced)

<ReactSecurityProvider
  level="medium"
  config={{
    blockScreenshot: true,
    blockDevTools: true,
    blockCopy: true,

    lockOnSuspicious: true,
    autoLogout: true,
    noiseOverlay: true,
    enableWatermark: true,
    watermarkText: "Protected by Bonhomie Security",

    showUnlockButton: true,

    onDetect: (type) => console.log("Suspicious:", type),
    onLogout: () => logoutUser()
  }}
>
  <App />
</ReactSecurityProvider>

🛡 Components

🔒 <SecurePage />

Protects a page with:

  • Blur on suspicious activity
  • Lock screen overlay
  • Noise overlay
  • AI / screenshot watermark
  • Event-based warnings
<SecurePage blurAmount="6px">
  <Dashboard />
</SecurePage>

🧱 <BlockInspect />

Blocks:

  • F12
  • Ctrl+Shift+I
  • Ctrl+Shift+J
  • Ctrl+U
  • Right-click
  • Mobile long-press
  • Mobile zoom inspect
<BlockInspect>
  <ProtectedContent />
</BlockInspect>

🛑 <AntiIframe />

Prevents your app from loading inside an iframe.

<AntiIframe>
  <App />
</AntiIframe>

🪝 Hooks Reference

useDevtoolsDetect

useDevtoolsDetect({
  enabled: true,
  onDetect: () => console.log("DevTools opened")
});

useScreenshotBlock

useScreenshotBlock({
  blockPrintScreen: true,
  onScreenshotAttempt: () => alert("Screenshot blocked")
});

useClipboardLock

useClipboardLock({
  blockCopy: true,
  blockPaste: true,
  onBlock: (type) => console.log("Blocked:", type),
});

useRouteTamperGuard

useRouteTamperGuard({
  allowedRoutes: ["/dashboard"],
  redirectTo: "/warning"
});

useGhostingDetect

Detects synthetic key events / bot keystrokes.

useGhostingDetect({
  onGhost: () => console.warn("Ghost keystroke detected!")
});

useKeystrokeTamper

Detects tampering with keydown/keyup sequences.

useKeystrokeTamper({
  onTamper: () => alert("Keystroke tampering detected!")
});

🧠 Utilities

All available under:

import { detectVPN, aiScreenshotDetect } from "@bonhomie/react-security";
  • detectVPN() – lightweight VPN/proxy detector
  • aiScreenshotDetect() – detects suspicious brightness/frame dips
  • watermark.generateDynamic() – dynamic rotating watermark
  • events.emitSecurityEvent() – provider-level triggers

🧱 Recommended Patterns

1️⃣ Wrap entire app

<ReactSecurityProvider level="high">
  <AntiIframe>
    <BlockInspect>
      <SecurePage>
        <App />
      </SecurePage>
    </BlockInspect>
  </AntiIframe>
</ReactSecurityProvider>

2️⃣ Use <SecurePage> only where necessary

Avoid wrapping public pages for performance.

3️⃣ Combine route tamper guard + lock UI

Makes cheating very hard.

4️⃣ Set autoLogout: true in high-risk environments (fintech/exams)


🏢 Enterprise Integration

This package is ideal for:

  • Fintech dashboards
  • KYC/AML platforms
  • Exam/testing portals
  • Internal admin dashboards
  • SaaS with proprietary content
  • AI model preview tools
  • Video/streaming with DRM-lite protection

Recommended settings:

<ReactSecurityProvider
  level="high"
  config={{
    autoLogout: true,
    enableWatermark: true,
    noiseOverlay: true,
    lockOnSuspicious: true,
    aiScreenshot: true,
    vpnCheck: true
  }}
>

🌐 SSR Notes (Next.js / Remix)

This library is client-only.

For SSR:

"use client";

import { ReactSecurityProvider } from "@bonhomie/react-security";

Avoid running hooks during SSR — provider handles this already.


🛠 Troubleshooting

❌ Screenshot still works?

  • Windows Snipping Tool bypasses DOM APIs sometimes
  • Enable noiseOverlay + enableWatermark
  • Consider backend watermarking for images

❌ DevTools not detected?

Chrome DevTools detection is browser-dependent; mix with:

  • zoom detection
  • route tamper
  • key combos
  • screenshot watermark

❌ Locked screen won’t unlock?

Ensure provider includes:

showUnlockButton: true

❌ Running inside iframe?

Ensure domain isn’t embedding itself (like preview tools).


📄 License

MIT — free for personal & commercial use.


👨‍💻 Author

Made with care by Bonhomie Full-stack Web & Mobile Developer