update upload validation to use shared AES-GCM size constants on the backend.

This commit is contained in:
2026-10-19 02:59:52 +02:00
parent 7b9b8ec107
commit f2987da2fe
5 changed files with 8 additions and 4 deletions
@@ -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()