update upload validation to use shared AES-GCM size constants on the backend.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { IsBoolean, IsNotEmpty, ValidateIf } from 'class-validator';
|
||||
import { AES_GCM_IV_BYTE_LENGTH } from '../../../consts/crypto/aesGcmIvByteLength';
|
||||
import { IsBase64 } from '../../../validation/decorators/isBase64';
|
||||
import { UploadCiphertextOptionsDto } from './UploadCiphertextOptionsDto';
|
||||
|
||||
@@ -14,7 +15,7 @@ export class CreateZkUploadDto extends UploadCiphertextOptionsDto {
|
||||
|
||||
@ValidateIf((dto: CreateZkUploadDto) => dto.passwordProtected === true)
|
||||
@IsNotEmpty()
|
||||
@IsBase64({ byteLength: 12 })
|
||||
@IsBase64({ byteLength: AES_GCM_IV_BYTE_LENGTH })
|
||||
wrapIv?: string;
|
||||
|
||||
@ValidateIf((dto: CreateZkUploadDto) => dto.passwordProtected === true)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { IsNotEmpty } from 'class-validator';
|
||||
import { AES_GCM_IV_BYTE_LENGTH } from '../../../consts/crypto/aesGcmIvByteLength';
|
||||
import { getAppConfig } from '../../../config';
|
||||
import { IsBase64 } from '../../../validation/decorators/isBase64';
|
||||
import { UploadOptionsDto } from './UploadOptionsDto';
|
||||
@@ -11,7 +12,7 @@ const {
|
||||
|
||||
export class UploadCiphertextOptionsDto extends UploadOptionsDto {
|
||||
@IsNotEmpty()
|
||||
@IsBase64({ byteLength: 12 })
|
||||
@IsBase64({ byteLength: AES_GCM_IV_BYTE_LENGTH })
|
||||
iv: string;
|
||||
|
||||
@IsNotEmpty()
|
||||
|
||||
Reference in New Issue
Block a user