/** * Federation Controller * * API endpoints for instance identity and federation management. */ import { Controller, Get, Post, UseGuards, Logger } from "@nestjs/common"; import { FederationService } from "./federation.service"; import { AuthGuard } from "../auth/guards/auth.guard"; import { PublicInstanceIdentity, InstanceIdentity } from "./types/instance.types"; @Controller("api/v1/federation") export class FederationController { private readonly logger = new Logger(FederationController.name); constructor(private readonly federationService: FederationService) {} /** * Get this instance's public identity * No authentication required - this is public information for federation */ @Get("instance") async getInstance(): Promise { this.logger.debug("GET /api/v1/federation/instance"); return this.federationService.getPublicIdentity(); } /** * Regenerate instance keypair * Requires authentication - this is an admin operation */ @Post("instance/regenerate-keys") @UseGuards(AuthGuard) async regenerateKeys(): Promise { this.logger.log("POST /api/v1/federation/instance/regenerate-keys"); return this.federationService.regenerateKeypair(); } }