8bb5cf208d
- cert-manager.module.ts: OnModuleInit + seedCertManagerModule (CERT-06)
- cert-manager.seed.ts: slug='cert-manager', category='security-tools', isSystem=true
- cert-manager.service.ts: detectFormat, toForgeBuffer, getFingerprint, parsePemChain;
operation stubs parseCert/splitCerts/mergeCerts/convertCert throw NotImplementedException
- cert-manager.controller.ts: 4 POST routes with FileInterceptor/FilesInterceptor
(5 MB limit each), @UseModule('cert-manager') guard, BadRequestException on missing input
- dto/: ParseCertDto, MergeCertsDto, ConvertCertDto
- app.module.ts: CertManagerModule added to imports array
- All 11 Vitest tests pass; type-check clean
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { Logger, Module, OnModuleInit } from '@nestjs/common';
|
|
import { ModuleRegistryModule } from '../module-registry/module-registry.module';
|
|
import { ModuleRegistryService } from '../module-registry/module-registry.service';
|
|
import { CertManagerController } from './cert-manager.controller';
|
|
import { seedCertManagerModule } from './cert-manager.seed';
|
|
import { CertManagerService } from './cert-manager.service';
|
|
|
|
/**
|
|
* NestJS module for the Cert Manager feature.
|
|
*
|
|
* Provides server-side certificate inspection, splitting, merging,
|
|
* and format conversion using node-forge (pure JS, no native bindings).
|
|
*
|
|
* Seeds itself into the module registry on application startup via
|
|
* OnModuleInit lifecycle hook (CERT-06).
|
|
*
|
|
* After seeding: an admin must activate the module per-tenant via the
|
|
* Marketplace UI before endpoints become accessible (ModuleGuard checks
|
|
* TenantModuleActivation, not isSystem flag — RESEARCH.md Pitfall 2).
|
|
*/
|
|
@Module({
|
|
imports: [ModuleRegistryModule],
|
|
controllers: [CertManagerController],
|
|
providers: [CertManagerService],
|
|
})
|
|
export class CertManagerModule implements OnModuleInit {
|
|
private readonly logger = new Logger(CertManagerModule.name);
|
|
|
|
constructor(
|
|
private readonly moduleRegistryService: ModuleRegistryService,
|
|
) {}
|
|
|
|
async onModuleInit(): Promise<void> {
|
|
try {
|
|
await seedCertManagerModule(this.moduleRegistryService);
|
|
this.logger.log('Cert-Manager module seeded in registry');
|
|
} catch (error) {
|
|
this.logger.error('Failed to seed cert-manager module', error);
|
|
}
|
|
}
|
|
}
|