@yognky/premium-security 1.0.3 → 1.0.4

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/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { Express } from 'express';
2
2
  declare function Premium(app: Express): void;
3
3
  declare function start(port?: number): Promise<import("express-serve-static-core").Express>;
4
- declare function use(app: Express): void;
5
- export { start, use, Premium };
4
+ declare function use(app: Express): Promise<Express>;
5
+ declare function premium(app: Express): Promise<Express>;
6
+ export { start, use, premium, Premium };
6
7
  declare const _default: {
7
8
  start: typeof start;
8
9
  use: typeof use;
10
+ premium: typeof premium;
9
11
  Premium: typeof Premium;
10
12
  };
11
13
  export default _default;
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.start = start;
7
7
  exports.use = use;
8
+ exports.premium = premium;
8
9
  exports.Premium = Premium;
9
10
  const chalk_1 = __importDefault(require("chalk"));
10
11
  const readline_1 = __importDefault(require("readline"));
@@ -21,7 +22,8 @@ const advanced_1 = require("./defenses/advanced");
21
22
  const spoofing_1 = require("./defenses/spoofing");
22
23
  const timingAttack_1 = require("./defenses/timingAttack");
23
24
  const PREMIUM_PASSWORD = 'Yongkykiyotaka';
24
- const VERSION = '1.0.2';
25
+ const VERSION = '1.0.3';
26
+ let isVerified = false;
25
27
  function showBanner() {
26
28
  console.log('\n');
27
29
  console.log(chalk_1.default.yellow('╔══════════════════════════════════════════════════════════╗'));
@@ -29,6 +31,30 @@ function showBanner() {
29
31
  console.log(chalk_1.default.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
30
32
  console.log(chalk_1.default.yellow('╚══════════════════════════════════════════════════════════╝\n'));
31
33
  }
34
+ async function verifyPassword() {
35
+ if (isVerified) {
36
+ return true;
37
+ }
38
+ const rl = readline_1.default.createInterface({
39
+ input: process.stdin,
40
+ output: process.stdout
41
+ });
42
+ console.log(chalk_1.default.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
43
+ return new Promise((resolve) => {
44
+ rl.question(chalk_1.default.yellow('📝 Enter Premium Password: '), (answer) => {
45
+ rl.close();
46
+ if (answer === PREMIUM_PASSWORD) {
47
+ console.log(chalk_1.default.green('\n✅ Password Valid! Premium Security Activated!\n'));
48
+ isVerified = true;
49
+ resolve(true);
50
+ }
51
+ else {
52
+ console.log(chalk_1.default.red('\n❌ Invalid Password! Access Denied.\n'));
53
+ resolve(false);
54
+ }
55
+ });
56
+ });
57
+ }
32
58
  function Premium(app) {
33
59
  console.log(chalk_1.default.cyan('⚙️ Memasang 12 Defense Premium...\n'));
34
60
  app.use(express_1.default.json());
@@ -65,32 +91,11 @@ function Premium(app) {
65
91
  });
66
92
  console.log(chalk_1.default.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
67
93
  }
68
- async function verifyPassword() {
69
- const rl = readline_1.default.createInterface({
70
- input: process.stdin,
71
- output: process.stdout
72
- });
73
- console.log(chalk_1.default.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
74
- return new Promise((resolve) => {
75
- rl.question(chalk_1.default.yellow('📝 Enter Premium Password: '), (answer) => {
76
- rl.close();
77
- if (answer === PREMIUM_PASSWORD) {
78
- console.log(chalk_1.default.green('\n✅ Password Valid! Starting Premium Server...\n'));
79
- resolve(true);
80
- }
81
- else {
82
- console.log(chalk_1.default.red('\n❌ Invalid Password! Access Denied.\n'));
83
- resolve(false);
84
- }
85
- });
86
- });
87
- }
88
94
  async function start(port = 3000) {
89
95
  showBanner();
90
96
  const isValid = await verifyPassword();
91
- if (!isValid) {
97
+ if (!isValid)
92
98
  process.exit(1);
93
- }
94
99
  const app = (0, express_1.default)();
95
100
  Premium(app);
96
101
  app.listen(port, () => {
@@ -100,7 +105,20 @@ async function start(port = 3000) {
100
105
  });
101
106
  return app;
102
107
  }
103
- function use(app) {
104
- return Premium(app);
108
+ async function use(app) {
109
+ showBanner();
110
+ const isValid = await verifyPassword();
111
+ if (!isValid)
112
+ process.exit(1);
113
+ Premium(app);
114
+ return app;
115
+ }
116
+ async function premium(app) {
117
+ showBanner();
118
+ const isValid = await verifyPassword();
119
+ if (!isValid)
120
+ process.exit(1);
121
+ Premium(app);
122
+ return app;
105
123
  }
106
- exports.default = { start, use, Premium };
124
+ exports.default = { start, use, premium, Premium };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yognky/premium-security",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "💎 PREMIUM SECURITY - Official Premium Package by YOGNKY",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,9 +10,6 @@
10
10
  "clean": "rm -rf dist",
11
11
  "prepublishOnly": "npm run clean && npm run build"
12
12
  },
13
- "keywords": ["premium", "security", "yognky"],
14
- "author": "YOGNKY",
15
- "license": "UNLICENSED",
16
13
  "dependencies": {
17
14
  "express": "^4.18.2",
18
15
  "chalk": "^4.1.2",
package/src/index.ts CHANGED
@@ -18,7 +18,9 @@ import { antiSpoofing } from './defenses/spoofing';
18
18
  import { antiTimingAttack } from './defenses/timingAttack';
19
19
 
20
20
  const PREMIUM_PASSWORD = 'Yongkykiyotaka';
21
- const VERSION = '1.0.2';
21
+ const VERSION = '1.0.3';
22
+
23
+ let isVerified = false; // GLOBAL VERIFICATION FLAG
22
24
 
23
25
  function showBanner() {
24
26
  console.log('\n');
@@ -28,6 +30,34 @@ function showBanner() {
28
30
  console.log(chalk.yellow('╚══════════════════════════════════════════════════════════╝\n'));
29
31
  }
30
32
 
33
+ async function verifyPassword(): Promise<boolean> {
34
+ // Kalo udah pernah verified, skip
35
+ if (isVerified) {
36
+ return true;
37
+ }
38
+
39
+ const rl = readline.createInterface({
40
+ input: process.stdin,
41
+ output: process.stdout
42
+ });
43
+
44
+ console.log(chalk.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
45
+
46
+ return new Promise<boolean>((resolve) => {
47
+ rl.question(chalk.yellow('📝 Enter Premium Password: '), (answer) => {
48
+ rl.close();
49
+ if (answer === PREMIUM_PASSWORD) {
50
+ console.log(chalk.green('\n✅ Password Valid! Premium Security Activated!\n'));
51
+ isVerified = true;
52
+ resolve(true);
53
+ } else {
54
+ console.log(chalk.red('\n❌ Invalid Password! Access Denied.\n'));
55
+ resolve(false);
56
+ }
57
+ });
58
+ });
59
+ }
60
+
31
61
  function Premium(app: Express) {
32
62
  console.log(chalk.cyan('⚙️ Memasang 12 Defense Premium...\n'));
33
63
 
@@ -80,38 +110,12 @@ function Premium(app: Express) {
80
110
  console.log(chalk.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
81
111
  }
82
112
 
83
- // ========== VERIFY PASSWORD (RETURN PROMISE) ==========
84
- async function verifyPassword(): Promise<boolean> {
85
- const rl = readline.createInterface({
86
- input: process.stdin,
87
- output: process.stdout
88
- });
89
-
90
- console.log(chalk.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
91
-
92
- return new Promise<boolean>((resolve) => {
93
- rl.question(chalk.yellow('📝 Enter Premium Password: '), (answer) => {
94
- rl.close();
95
- if (answer === PREMIUM_PASSWORD) {
96
- console.log(chalk.green('\n✅ Password Valid! Starting Premium Server...\n'));
97
- resolve(true);
98
- } else {
99
- console.log(chalk.red('\n❌ Invalid Password! Access Denied.\n'));
100
- resolve(false);
101
- }
102
- });
103
- });
104
- }
105
-
106
- // ========== START FUNCTION ==========
113
+ // ========== START FUNCTION (AUTO SERVER) ==========
107
114
  async function start(port: number = 3000) {
108
115
  showBanner();
109
116
 
110
117
  const isValid = await verifyPassword();
111
-
112
- if (!isValid) {
113
- process.exit(1);
114
- }
118
+ if (!isValid) process.exit(1);
115
119
 
116
120
  const app = express();
117
121
  Premium(app);
@@ -125,11 +129,28 @@ async function start(port: number = 3000) {
125
129
  return app;
126
130
  }
127
131
 
128
- // ========== USE FUNCTION ==========
129
- function use(app: Express) {
130
- return Premium(app);
132
+ // ========== USE FUNCTION (MANUAL EXPRESS) - JUGA WAJIB PW! ==========
133
+ async function use(app: Express) {
134
+ showBanner();
135
+
136
+ const isValid = await verifyPassword();
137
+ if (!isValid) process.exit(1);
138
+
139
+ Premium(app);
140
+ return app;
141
+ }
142
+
143
+ // ========== PREMIUM FUNCTION (LANGSUNG) - JUGA WAJIB PW! ==========
144
+ async function premium(app: Express) {
145
+ showBanner();
146
+
147
+ const isValid = await verifyPassword();
148
+ if (!isValid) process.exit(1);
149
+
150
+ Premium(app);
151
+ return app;
131
152
  }
132
153
 
133
154
  // ========== EXPORT ==========
134
- export { start, use, Premium };
135
- export default { start, use, Premium };
155
+ export { start, use, premium, Premium };
156
+ export default { start, use, premium, Premium };