Skip to content

Commit

Permalink
Update README.md with JSONEncryptionTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
generalpiston authored May 27, 2022
1 parent 11f715d commit 84842c1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,34 @@ class User {

```

For JSON fields you can use `JSONEncryptionTransformer`.


```typescript
import { Entity, Column } from "typeorm";
import { EncryptionTransformer } from "typeorm-encrypted";

@Entity()
class User {
...

@Column({
type: "json",
nullable: false,
transformer: new JSONEncryptionTransformer({
key: 'e41c966f21f9e1577802463f8924e6a3fe3e9751f201304213b2f845d8841d61',
algorithm: 'aes-256-cbc',
ivLength: 16,
iv: 'ff5ac19190424b1d88f9419ef949ae56'
})
})
secret: object;

...
}

```

More information about transformers is available in the [typeorm docs](https://typeorm.io/#/entities/column-options).

### Subscribers
Expand Down

0 comments on commit 84842c1

Please sign in to comment.