From 6eb4b6b153419bc1c093b15c9be0c5b085552d12 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 15 Dec 2025 09:36:03 -0800 Subject: [PATCH] =?UTF-8?q?fix(mpc-service):=20=E6=B7=BB=E5=8A=A0=20DTO=20?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=A3=85=E9=A5=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 class-validator 装饰器到 CreateKeygenDto 和 CreateSigningDto, 修复 NestJS ValidationPipe 的 forbidNonWhitelisted 验证错误。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../src/api/controllers/mpc.controller.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/services/mpc-service/src/api/controllers/mpc.controller.ts b/backend/services/mpc-service/src/api/controllers/mpc.controller.ts index 3afb2edc..8cda0488 100644 --- a/backend/services/mpc-service/src/api/controllers/mpc.controller.ts +++ b/backend/services/mpc-service/src/api/controllers/mpc.controller.ts @@ -28,6 +28,7 @@ import { ApiResponse, ApiParam, } from '@nestjs/swagger'; +import { IsString, IsNumber, IsBoolean, IsOptional } from 'class-validator'; import { Public } from '../../shared/decorators/public.decorator'; import { MPCCoordinatorService } from '../../application/services/mpc-coordinator.service'; @@ -36,15 +37,28 @@ import { MPCCoordinatorService } from '../../application/services/mpc-coordinato // ============================================ export class CreateKeygenDto { + @IsString() username: string; + + @IsNumber() thresholdN: number; + + @IsNumber() thresholdT: number; + + @IsBoolean() requireDelegate: boolean; } export class CreateSigningDto { + @IsString() username: string; + + @IsString() messageHash: string; + + @IsString() + @IsOptional() userShare?: string; }