@adaptivestone/framework 5.0.0-alpha.16 → 5.0.0-alpha.18
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
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
### 5.0.0-alpha.18
|
|
2
|
+
|
|
3
|
+
[BREAKING] default aut responce changed to be unified. {token, user} = > {data:{token, user}}
|
|
4
|
+
[UPDATE] RateLimiter updae key generation
|
|
5
|
+
|
|
6
|
+
### 5.0.0-alpha.17
|
|
7
|
+
|
|
8
|
+
[NEW] generateRandomBytes command
|
|
9
|
+
[UPDATE] update deps
|
|
10
|
+
|
|
1
11
|
### 5.0.0-alpha.16
|
|
2
12
|
|
|
3
13
|
[UPDATE] no warning of direct usage body and query
|
|
@@ -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
|
};
|
package/controllers/Auth.js
CHANGED
|
@@ -83,7 +83,7 @@ class Auth extends AbstractController {
|
|
|
83
83
|
}
|
|
84
84
|
const token = await user.generateToken();
|
|
85
85
|
|
|
86
|
-
return res.status(200).json({ token, user: user.getPublic() });
|
|
86
|
+
return res.status(200).json({ data: { token, user: user.getPublic() } });
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
async postRegister(req, res) {
|
package/package.json
CHANGED