@adaptivestone/framework 5.0.0-alpha.15 → 5.0.0-alpha.17
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/CHANGELOG.md +10 -0
- package/commands/GenerateRandomBytes.js +15 -0
- package/config/auth.js +4 -1
- package/modules/AbstractController.js +16 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import AbstractCommand from '../modules/AbstractCommand.js';
|
|
3
|
+
|
|
4
|
+
class GenerateRandomBytes extends AbstractCommand {
|
|
5
|
+
async run() {
|
|
6
|
+
const sizes = [16, 32, 64, 128, 256];
|
|
7
|
+
for (const size of sizes) {
|
|
8
|
+
const bytes = randomBytes(size).toString('hex');
|
|
9
|
+
this.logger.info(`${size} bytes: ${bytes}`);
|
|
10
|
+
}
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default GenerateRandomBytes;
|
package/config/auth.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
hashRounds: 64,
|
|
3
3
|
saltSecret:
|
|
4
|
-
process.env.AUTH_SALT ||
|
|
4
|
+
process.env.AUTH_SALT ||
|
|
5
|
+
console.error(
|
|
6
|
+
'AUTH_SALT is not defined. You can "npm run cli generateRandomBytes" and use it',
|
|
7
|
+
),
|
|
5
8
|
isAuthWithVefificationFlow: true,
|
|
6
9
|
};
|
|
@@ -196,22 +196,22 @@ class AbstractController extends Base {
|
|
|
196
196
|
errors: err.message,
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
req.body = new Proxy(req.body, {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
});
|
|
207
|
-
req.query = new Proxy(req.query, {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
});
|
|
199
|
+
// req.body = new Proxy(req.body, {
|
|
200
|
+
// get: (target, prop) => {
|
|
201
|
+
// this.logger.warn(
|
|
202
|
+
// 'Please not use "req.body" directly. Implement "request" and use "req.appInfo.request" ',
|
|
203
|
+
// );
|
|
204
|
+
// return target[prop];
|
|
205
|
+
// },
|
|
206
|
+
// });
|
|
207
|
+
// req.query = new Proxy(req.query, {
|
|
208
|
+
// get: (target, prop) => {
|
|
209
|
+
// this.logger.warn(
|
|
210
|
+
// 'Please not use "req.query" directly. Implement "query" and use "req.appInfo.query" ',
|
|
211
|
+
// );
|
|
212
|
+
// return target[prop];
|
|
213
|
+
// },
|
|
214
|
+
// });
|
|
215
215
|
|
|
216
216
|
if (!routeObject.handler) {
|
|
217
217
|
this.logger.error(`Route object have no handler defined`);
|