import { IsString, Length, Matches } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class RedeemMqttChallengeDto {
  @ApiProperty({ description: 'The nonce returned by POST .../mqtt-session/challenge' })
  @IsString()
  @Length(64, 64)
  @Matches(/^[0-9a-f]{64}$/)
  nonce: string;

  @ApiProperty({ description: 'Base64-encoded RSA-SHA256 signature over the challenge payload' })
  @IsString()
  @Length(1, 2048)
  signature: string;
}
