@mars-stack/cli 8.0.4 → 8.0.7

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.js CHANGED
@@ -6729,8 +6729,15 @@ export type AppConfig = typeof appConfig;
6729
6729
 
6730
6730
  // src/generators/env.ts
6731
6731
  import crypto2 from "crypto";
6732
- function generateSecret() {
6733
- return crypto2.randomBytes(32).toString("hex");
6732
+ function generateJwtSecret() {
6733
+ const maxAttempts = 100;
6734
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
6735
+ const candidate = crypto2.randomBytes(32).toString("hex");
6736
+ if (new Set(candidate).size >= 16) {
6737
+ return candidate;
6738
+ }
6739
+ }
6740
+ return crypto2.randomBytes(32).toString("base64url");
6734
6741
  }
6735
6742
  function generateEnvFile(config) {
6736
6743
  const lines = [
@@ -6744,7 +6751,7 @@ function generateEnvFile(config) {
6744
6751
  `# DATABASE_URL="postgresql://user:password@host:5432/${config.name}_dev"`,
6745
6752
  "",
6746
6753
  "# === Auth ===",
6747
- `JWT_SECRET="${generateSecret()}"`,
6754
+ `JWT_SECRET="${generateJwtSecret()}"`,
6748
6755
  ""
6749
6756
  ];
6750
6757
  if (config.features.googleOAuth) {