Skip to main content

Function: Encrypted()

Encrypted(options?): PropertyDecorator

Defined in: src/decorators/EncryptedDecorator.ts:20

Property decorator marking a class property for transparent AES-256-GCM field-level encryption. Automatically encrypts plaintext values before database persistence (INSERT / UPDATE) and decrypts values upon entity hydration during queries.

Parameters​

ParameterTypeDescription
options?EncryptionOptionsEncryption options (custom key, algorithm).

Returns​

PropertyDecorator

Example​

@Encrypted()
ssn!: string;

@Encrypted()
creditCardNumber!: string;