better-auth-studio 1.0.49-beta.3 → 1.0.49-beta.5
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/routes.d.ts.map +1 -1
- package/dist/routes.js +26 -6
- package/dist/routes.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/main-DMsUh9lG.css +1 -0
- package/public/assets/main-zoObNNfj.js +1090 -0
- package/public/index.html +2 -2
- package/public/assets/main-BiNtR8zv.css +0 -1
- package/public/assets/main-C_z_GxVR.js +0 -1090
package/dist/routes.d.ts.map
CHANGED
|
@@ -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,
|
|
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,CA63JR"}
|
package/dist/routes.js
CHANGED
|
@@ -4302,22 +4302,17 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
|
|
|
4302
4302
|
let filename;
|
|
4303
4303
|
let contentType;
|
|
4304
4304
|
if (exportFormat === 'csv') {
|
|
4305
|
-
// Convert to CSV
|
|
4306
4305
|
const csvRows = [];
|
|
4307
4306
|
for (const [tableName, rows] of Object.entries(exportData)) {
|
|
4308
4307
|
if (rows.length === 0)
|
|
4309
4308
|
continue;
|
|
4310
|
-
// Add table header
|
|
4311
4309
|
csvRows.push(`\n=== ${tableName.toUpperCase()} ===\n`);
|
|
4312
|
-
// Get all unique keys from all rows
|
|
4313
4310
|
const allKeys = new Set();
|
|
4314
4311
|
rows.forEach((row) => {
|
|
4315
4312
|
Object.keys(row).forEach((key) => allKeys.add(key));
|
|
4316
4313
|
});
|
|
4317
4314
|
const headers = Array.from(allKeys);
|
|
4318
|
-
// Write CSV header
|
|
4319
4315
|
csvRows.push(headers.map((h) => `"${h}"`).join(','));
|
|
4320
|
-
// Write CSV rows
|
|
4321
4316
|
rows.forEach((row) => {
|
|
4322
4317
|
const values = headers.map((header) => {
|
|
4323
4318
|
const value = row[header];
|
|
@@ -4335,7 +4330,6 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
|
|
|
4335
4330
|
contentType = 'text/csv';
|
|
4336
4331
|
}
|
|
4337
4332
|
else {
|
|
4338
|
-
// JSON format
|
|
4339
4333
|
output = JSON.stringify(exportData, null, 2);
|
|
4340
4334
|
filename = `better-auth-export-${new Date().toISOString().split('T')[0]}.json`;
|
|
4341
4335
|
contentType = 'application/json';
|
|
@@ -4598,6 +4592,32 @@ export function createRoutes(authConfig, configPath, geoDbPath) {
|
|
|
4598
4592
|
});
|
|
4599
4593
|
}
|
|
4600
4594
|
});
|
|
4595
|
+
router.post('/api/tools/generate-secret', async (_req, res) => {
|
|
4596
|
+
try {
|
|
4597
|
+
const { length = 32, format = 'hex' } = _req.body || {};
|
|
4598
|
+
const secretLength = typeof length === 'number' && length >= 16 && length <= 128 ? length : 32;
|
|
4599
|
+
const secretFormat = format === 'base64' ? 'base64' : 'hex';
|
|
4600
|
+
const secretBytes = randomBytes(secretLength);
|
|
4601
|
+
const secret = secretFormat === 'hex'
|
|
4602
|
+
? secretBytes.toString('hex')
|
|
4603
|
+
: secretBytes.toString('base64');
|
|
4604
|
+
const entropy = secretLength * 8; // bits of entropy
|
|
4605
|
+
res.json({
|
|
4606
|
+
success: true,
|
|
4607
|
+
secret,
|
|
4608
|
+
format: secretFormat,
|
|
4609
|
+
length: secretLength,
|
|
4610
|
+
entropy,
|
|
4611
|
+
envFormat: `BETTER_AUTH_SECRET=${secret}`,
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
catch (error) {
|
|
4615
|
+
res.status(500).json({
|
|
4616
|
+
success: false,
|
|
4617
|
+
message: error instanceof Error ? error.message : 'Failed to generate secret',
|
|
4618
|
+
});
|
|
4619
|
+
}
|
|
4620
|
+
});
|
|
4601
4621
|
return router;
|
|
4602
4622
|
}
|
|
4603
4623
|
//# sourceMappingURL=routes.js.map
|