import { BodyParams , Controller , Post } from "@tsed/common" ; import { IvDetectionService } from '../../services/IvDetectionService' ; export interface IResponse { data : string ; flag : string ; } @ Controller ( "/aes/cbc/iv-detection" ) export class IvDetectionController { @ Post ( "/send" ) public send ( @ BodyParams ( "data" ) data ) { return { } ; } @ Post ( "/encrypt" ) public encrypt ( @ BodyParams ( "data" ) data ) { const f = data === IvDetectionService . IV ? IvDetectionService . getFlag ( ) : "" ; return { data : IvDetectionService . encryptData ( data ) , flag : f } ; } @ Post ( "/decrypt" ) public decrypt ( @ BodyParams ( "data" ) data ) { return { data : IvDetectionService . decryptData ( data ) , flag : "" } ; } }