js_lis 3.0.0 → 3.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/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # js_lis
2
+
3
+ **js_lis** is a JavaScript on-screen keyboard utility designed to reduce the risk of keystroke interception by avoiding direct hardware keyboard input in sensitive workflows.
4
+
5
+ NPM package: [https://www.npmjs.com/package/js_lis](https://www.npmjs.com/package/js_lis)
6
+
7
+ Web test Login + SOSK: [https://sosk-login-js-six.vercel.app](https://sosk-login-js-six.vercel.app).
8
+
9
+ ---
10
+
11
+ ## English
12
+
13
+ ### Overview
14
+
15
+ `js_lis` provides a virtual keyboard interface that can be integrated into web pages or web-based interfaces.
16
+ It is intended for high-risk input scenarios where users want an additional defense layer against keylogging.
17
+
18
+ ### Security Note (Keylogger and Bettercap)
19
+
20
+ - `js_lis` can help reduce exposure to **traditional keyloggers** that rely on physical keystroke capture.
21
+ - It is also intended to reduce risk from interception workflows commonly demonstrated with network attack tools such as **bettercap** (for example, injected key-capture scripts in compromised environments).
22
+ - No client-side tool can guarantee complete protection. Security still depends on HTTPS, trusted networks, endpoint hygiene, and browser integrity.
23
+
24
+ ### Key Security Features
25
+
26
+ - **AES-GCM Memory Encryption**: All keystrokes are buffered and encrypted in-memory using the Web Crypto API (AES-256-GCM). The actual DOM elements never store the plaintext values.
27
+ - **Shadow DOM Isolation**: The keyboard UI is rendered inside a `closed` Shadow DOM to prevent malicious external CSS/JS from sniffing or tampering with the keys.
28
+ - **Anti-Clipboard Sniffing**: Blocks unauthorized `copy`, `cut`, and `execCommand("copy"/"cut")` actions to prevent clipboard hijacking.
29
+ - **IME Reconciliation**: Safely handles Input Method Editors (like Thai or Chinese typing) natively without exposing the secure buffer.
30
+ - **Dynamic Scrambling**: Provides an optional dynamic key scramble to thwart clickjacking or screen coordinate tracking.
31
+
32
+ ### Installation
33
+
34
+ ```bash
35
+ npm install js_lis
36
+ ```
37
+
38
+ ### Basic Usage
39
+
40
+ ```javascript
41
+ // Example import style (adjust to your project setup)
42
+ import js_lis from "js_lis";
43
+
44
+ // Initialize according to your app's integration pattern
45
+ // (see your local implementation files for exact wiring)
46
+ ```
47
+
48
+ ### How It Works + ID-based Integration
49
+
50
+ `js_lis` expects specific DOM IDs:
51
+
52
+ - `keyboard-container`: container where the virtual keyboard is rendered
53
+ - `toggle`: optional button for show/hide keyboard
54
+
55
+ When the page loads, create `VirtualKeyboard`.
56
+ Then the library listens to `INPUT` and `TEXTAREA` focus/click events, tracks the active field, and injects typed characters via the virtual keys.
57
+
58
+ ```html
59
+ <input id="secure-input" type="password" placeholder="Enter password" />
60
+ <button id="toggle" type="button">Toggle Keyboard</button>
61
+ <div id="keyboard-container"></div>
62
+ ```
63
+
64
+ ```javascript
65
+ import { VirtualKeyboard } from "./VirtualKeyboard.js";
66
+
67
+ window.addEventListener("DOMContentLoaded", () => {
68
+ const keyboard = new VirtualKeyboard();
69
+
70
+ // Example of ID-based element access in JS
71
+ const secureInput = document.getElementById("secure-input");
72
+ if (secureInput) secureInput.focus();
73
+ });
74
+ ```
75
+
76
+ ### Recommended Deployment Practices
77
+
78
+ - Serve over HTTPS only.
79
+ - Use a strict Content Security Policy (CSP).
80
+ - Avoid running on untrusted or MITM-prone networks.
81
+ - Keep browser and OS security patches up to date.
82
+ - Pair with endpoint protection and monitoring.
83
+
84
+ ---
85
+
86
+ ## ภาษาไทย (ทางการ)
87
+
88
+ ### ภาพรวม
89
+
90
+ `js_lis` เป็นเครื่องมือคีย์บอร์ดเสมือน (Virtual Keyboard) สำหรับ JavaScript ที่ออกแบบมาเพื่อลดความเสี่ยงจากการดักจับการพิมพ์ โดยหลีกเลี่ยงการป้อนข้อมูลผ่านคีย์บอร์ดฮาร์ดแวร์โดยตรงในขั้นตอนที่มีความอ่อนไหวด้านความปลอดภัย
91
+
92
+ อ้างอิงแพ็กเกจบน npm: [https://www.npmjs.com/package/js_lis](https://www.npmjs.com/package/js_lis)
93
+
94
+ ตัวอย่างหน้า Login + SOSK: [https://sosk-login-js-six.vercel.app](https://sosk-login-js-six.vercel.app).
95
+
96
+ ### หมายเหตุด้านความปลอดภัย (Keylogger และ Bettercap)
97
+
98
+ - `js_lis` สามารถช่วยลดความเสี่ยงจาก **keylogger แบบดั้งเดิม** ที่มุ่งดักข้อมูลจากการกดแป้นพิมพ์จริง
99
+ - รวมถึงสามารถช่วยลดความเสี่ยงจากรูปแบบการโจมตีที่มักสาธิตผ่านเครื่องมือเครือข่ายอย่าง **bettercap** (เช่น การแทรกสคริปต์เพื่อดักรับข้อมูลการป้อนในสภาพแวดล้อมที่ถูกบุกรุก)
100
+ - อย่างไรก็ตาม เครื่องมือฝั่งผู้ใช้เพียงอย่างเดียวไม่สามารถรับประกันการป้องกันได้สมบูรณ์ จำเป็นต้องใช้ร่วมกับ HTTPS, เครือข่ายที่เชื่อถือได้, ความปลอดภัยของเครื่องผู้ใช้ และความน่าเชื่อถือของเบราว์เซอร์
101
+
102
+ ### ฟีเจอร์ด้านความปลอดภัยที่สำคัญ
103
+
104
+ - **การเข้ารหัสหน่วยความจำด้วย AES-GCM**: ทุกการกดแป้นพิมพ์จะถูกบัฟเฟอร์และเข้ารหัสในหน่วยความจำชั่วคราวด้วย Web Crypto API (AES-256-GCM) ข้อความต้นฉบับจะไม่ถูกเก็บเป็น plaintext ใน DOM elements
105
+ - **การแยกส่วนด้วย Shadow DOM**: หน้าคีย์บอร์ดจะถูกเรนเดอร์อยู่ภายใน `closed` Shadow DOM เพื่อป้องกันไม่ให้ CSS/JS จากภายนอกแอบอ่านหรือแก้ไขปุ่มคีย์บอร์ด
106
+ - **ป้องกันการแอบอ่านคลิปบอร์ด (Anti-Clipboard Sniffing)**: บล็อกการดักจับคำสั่ง `copy`, `cut`, และ `execCommand` ที่ไม่ได้รับอนุญาตเพื่อป้องกันการขโมยข้อมูลจากคลิปบอร์ด
107
+ - **รองรับ IME อย่างปลอดภัย**: จัดการกับการพิมพ์ผ่าน Input Method Editors (เช่น ภาษาไทย) ได้อย่างถูกต้องโดยที่ยังคงแยกบักเฟอร์ข้อมูลอย่างปลอดภัย
108
+ - **การสลับตำแหน่งปุ่ม (Dynamic Scrambling)**: มีฟังก์ชันสลับตำแหน่งปุ่มแบบสุ่มเพื่อป้องกันการติดตามพิกัดการคลิกบนหน้าจอหรือ clickjacking
109
+
110
+ ### การติดตั้ง
111
+
112
+ ```bash
113
+ npm install js_lis
114
+ ```
115
+
116
+ ### การใช้งานเบื้องต้น
117
+
118
+ ```javascript
119
+ // ตัวอย่างการนำเข้า (ปรับตามโครงสร้างโปรเจกต์ของท่าน)
120
+ import js_lis from "js_lis";
121
+
122
+ // เรียกใช้งานตามรูปแบบการเชื่อมต่อของแอปพลิเคชัน
123
+ ```
124
+
125
+ ### หลักการทำงาน + การเรียกใช้ผ่าน ID ใน JavaScript
126
+
127
+ `js_lis` ต้องอาศัย DOM `id` หลักดังนี้
128
+
129
+ - `keyboard-container`: พื้นที่สำหรับ render คีย์บอร์ดเสมือน
130
+ - `toggle`: ปุ่มสำหรับสลับแสดง/ซ่อนคีย์บอร์ด (ถ้ามี)
131
+
132
+ เมื่อหน้าเว็บโหลดเสร็จ ให้สร้าง `VirtualKeyboard` จากนั้นระบบจะดักเหตุการณ์ focus/click ของ `INPUT` และ `TEXTAREA` เพื่อระบุช่องที่กำลังใช้งาน และป้อนค่าผ่านปุ่มบนคีย์บอร์ดเสมือน
133
+
134
+ ```html
135
+ <input id="secure-input" type="password" placeholder="กรอกรหัสผ่าน" />
136
+ <button id="toggle" type="button">แสดง/ซ่อนคีย์บอร์ด</button>
137
+ <div id="keyboard-container"></div>
138
+ ```
139
+
140
+ ```javascript
141
+ import { VirtualKeyboard } from "./VirtualKeyboard.js";
142
+
143
+ window.addEventListener("DOMContentLoaded", () => {
144
+ const keyboard = new VirtualKeyboard();
145
+
146
+ // ตัวอย่างการเรียกใช้งาน element ผ่าน id
147
+ const secureInput = document.getElementById("secure-input");
148
+ if (secureInput) secureInput.focus();
149
+ });
150
+ ```
151
+
152
+ ### แนวทางการใช้งานที่แนะนำ
153
+
154
+ - ให้บริการผ่าน HTTPS เท่านั้น
155
+ - กำหนดนโยบาย Content Security Policy (CSP) อย่างเข้มงวด
156
+ - หลีกเลี่ยงการใช้งานบนเครือข่ายที่ไม่เชื่อถือได้หรือมีความเสี่ยง MITM
157
+ - อัปเดตแพตช์ความปลอดภัยของระบบปฏิบัติการและเบราว์เซอร์อย่างสม่ำเสมอ
158
+ - ใช้งานร่วมกับระบบป้องกันและเฝ้าระวังความปลอดภัยของอุปกรณ์ปลายทาง
159
+
160
+ ---
161
+
162
+ ## License
163
+
164
+ ISC