Socket
Book a DemoInstallSign in
Socket

@trap_stevo/devlock

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trap_stevo/devlock

Protect modern web applications from inspection, tampering, and unauthorized access through real-time detection, checksum enforcement, and customizable response strategies. Monitor developer tools, block key combinations, freeze console output, and enforc

0.0.8
latest
npmnpm
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

🛡️ DevLock

The Guardian of Frontend Integrity

A powerful real-time defense system that detects devtools, locks down source visibility, and executes fully customizable countermeasures against inspection and tampering.

🚀 Features

  • Real-time detection of Developer Tools (DevTools)
  • Runtime checksum verification (fixed or dynamic)
  • Custom violation response methods:
    • Overlay lockout
    • Console freezing
    • Redirects or replacement
    • DOM blanking
    • Session and localStorage lockdown
  • Full customization with callbacks and overlays
  • Dev mode toggle for safe development
  • Lightweight and framework-agnostic

📦 Installation

npm install @trap_stevo/devlock

🔧 Usage

import { DevLock } from "@trap_stevo/devlock";

const devLock = new DevLock({
     freezeConsole : true,
     verifyChecksum : true,
     checksumMode : "dynamic",
     redirectURL : "/unauthorized",
     violationMethod : "overlay,external",
     overlayMessage : "⚠️ Unauthorized action detected.",
     onDevToolsOpen : () => console.warn("DevTools access blocked."),
     onViolation : (status) => console.log("Violation triggered:", status)
});

devLock.start();

🧠 Violation Methods

MethodDescription
redirectNavigate to a specified URL
replaceReplace the page with about:blank
blankWipe the DOM contents
closeAttempt to close the window
overlayShow a full-screen warning overlay
externalRedirect to browser homepage or URL
lockStorageBlock access to localStorage/sessionStorage

Multiple methods may be combined: "overlay,external"

🧪 Checksum Modes

  • fixed — compare script hashes against provided list
  • dynamic — remember initial hashes per session and alert on changes
expectedChecksums : {
     "https://yourdomain.com/js/app.js" : "abc123..."
}

✨ Overlay Customization

overlayMessage : "Access denied. Contact administrator.",
overlayConfigurationSettings : {
     background : "#1A1A1A",
     color : "#FF4444",
     fontSize : "28px"
},
overlayNode : "<div style='...'>Custom HTML content</div>"

📘 API Specification

Public Methods

MethodDescription
start()Activates detection and begins monitoring for violations.
stop()Deactivates monitoring and restores modified behaviors.
status()Returns an object containing the current lock status.
checkNow()Forces an immediate check for DevTools.
runViolationMethods(string)Manually runs one or more violation actions (e.g., "overlay,blank").

Configuration Options

OptionTypeDescription
devModebooleanEnables or disables detection during development.
redirectURLstringTarget URL for redirection.
violationMethodstringComma-separated list of response methods.
freezeConsolebooleanDisables console output methods.
verifyChecksumbooleanEnables runtime checksum verification.
checksumMode"fixed" | "dynamic"Determines if static or dynamic checksums are enforced.
expectedChecksumsobjectMap of script URLs to expected hashes.
overlayMessagestringMessage shown in the default overlay.
overlayConfigurationSettingsobjectCSS styles for the overlay.
overlayNodeHTMLElement | stringCustom node or markup to override default overlay.
onDevToolsOpenfunctionCallback triggered when DevTools opens.
onDevToolsClosedfunctionCallback triggered when DevTools closes.
onViolationfunctionCallback triggered before violation methods execute.
onRightClickfunctionCallback for right-click blocking.
onBlockedShortcutfunctionCallback for blocked key combinations.
onBeforePrintfunctionCallback for beforeprint interception.
onDragStartfunctionCallback for drag start prevention.

✨ License

See License in LICENSE.md

Keywords

Legendary

FAQs

Package last updated on 02 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.