/** * Handlers for certificate authority (installRootCA). * Context: certificateAuthority */ const rateLimit = require('../rate-limit.js'); function register(deps) { const { certificateAuthority } = deps; return [ { type: 'installRootCA', handle: async (payload, reply) => { const rl = rateLimit.check('installRootCA'); if (!rl.allowed) { reply({ ok: false, error: rl.error }); return; } certificateAuthority.installRootCA((err) => { if (err) reply({ ok: false, error: err.message }); else reply({ ok: true }); }); } } ]; } module.exports = { register };