Initial commit: DashCaddy v1.0
Full codebase including API server (32 modules + routes), dashboard frontend, DashCA certificate distribution, installer script, and deployment skills.
This commit is contained in:
23
dashcaddy-api/routes/credentials.js
Normal file
23
dashcaddy-api/routes/credentials.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const express = require('express');
|
||||
|
||||
module.exports = function(ctx) {
|
||||
const router = express.Router();
|
||||
|
||||
// List all stored credentials (keys only, no values)
|
||||
router.get('/credentials/list', ctx.asyncHandler(async (req, res) => {
|
||||
const keys = await ctx.credentialManager.list();
|
||||
res.json({ success: true, credentials: keys, count: keys.length });
|
||||
}, 'credentials-list'));
|
||||
|
||||
// Rotate encryption key — re-encrypts all stored credentials
|
||||
router.post('/credentials/rotate-key', ctx.asyncHandler(async (req, res) => {
|
||||
const success = await ctx.credentialManager.rotateEncryptionKey();
|
||||
if (success) {
|
||||
res.json({ success: true, message: 'Encryption key rotated, all credentials re-encrypted' });
|
||||
} else {
|
||||
ctx.errorResponse(res, 500, 'Key rotation failed');
|
||||
}
|
||||
}, 'credentials-rotate'));
|
||||
|
||||
return router;
|
||||
};
|
||||
Reference in New Issue
Block a user