Skip to content

Commit

Permalink
fix: check for null value
Browse files Browse the repository at this point in the history
  • Loading branch information
theo committed Dec 7, 2021
1 parent 7eff2ac commit 033ce85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export class JSONEncryptionTransformer implements ValueTransformer {
constructor(private options: EncryptionOptions) {}

public from(value?: null | any): any | undefined {
if (!value) {
if (!value || !value.encrypted) {
return;
}

const decrypted = decryptData(
Buffer.from(value.encrypted ?? '' as string, 'base64'),
Buffer.from(value.encrypted as string, 'base64'),
this.options
).toString('utf8');

Expand Down

0 comments on commit 033ce85

Please sign in to comment.