better-auth-studio 1.0.49-beta.2 → 1.0.49-beta.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.
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAOA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA8I/E;AAwBD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAq2JR"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAOA,OAAO,EAA+B,MAAM,EAAE,MAAM,SAAS,CAAC;AAS9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8D9C,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CA8I/E;AAwBD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAm4JR"}
package/dist/routes.js CHANGED
@@ -4598,6 +4598,32 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
4598
4598
  });
4599
4599
  }
4600
4600
  });
4601
+ router.post('/api/tools/generate-secret', async (_req, res) => {
4602
+ try {
4603
+ const { length = 32, format = 'hex' } = _req.body || {};
4604
+ const secretLength = typeof length === 'number' && length >= 16 && length <= 128 ? length : 32;
4605
+ const secretFormat = format === 'base64' ? 'base64' : 'hex';
4606
+ const secretBytes = randomBytes(secretLength);
4607
+ const secret = secretFormat === 'hex'
4608
+ ? secretBytes.toString('hex')
4609
+ : secretBytes.toString('base64');
4610
+ const entropy = secretLength * 8; // bits of entropy
4611
+ res.json({
4612
+ success: true,
4613
+ secret,
4614
+ format: secretFormat,
4615
+ length: secretLength,
4616
+ entropy,
4617
+ envFormat: `AUTH_SECRET=${secret}`,
4618
+ });
4619
+ }
4620
+ catch (error) {
4621
+ res.status(500).json({
4622
+ success: false,
4623
+ message: error instanceof Error ? error.message : 'Failed to generate secret',
4624
+ });
4625
+ }
4626
+ });
4601
4627
  return router;
4602
4628
  }
4603
4629
  //# sourceMappingURL=routes.js.map