Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typeorm encryption nopt working in case of unique true column #68

Open
Akaim07 opened this issue Feb 18, 2024 · 3 comments
Open

typeorm encryption nopt working in case of unique true column #68

Akaim07 opened this issue Feb 18, 2024 · 3 comments

Comments

@Akaim07
Copy link

Akaim07 commented Feb 18, 2024

@entity()
export class UserEntity extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@column()
name: string;
@column()
age: string;
@column({
type: "varchar",
nullable: false,
unique: true,
transformer: new EncryptionTransformer({
key: 'e41c966f21f9e1577802463f8924e6a3fe3e9751f201304213b2f845d8841d61',
algorithm: 'aes-256-gcm',
ivLength: 16
})
})
email: string;
} in this case it always generate new cyper even if the email is same expected it need to throw error of duplicate please take a look at this issue

@jvdutrag
Copy link

Just came across through this.

This library is not working anymore because it's outdated. Newer TypeORM versions introduced a subscriber for beforeQuery event, that can be used to decrypt/encrypt parameters directly into the query, this way all cases are covered. So you have to implement this yourself manually as of this date there is no another option when using TypeORM.

@generalpiston
Copy link
Owner

Good to know @jvdutrag . I've been too busy lately to keep up with this. If there are other people open to help maintaining it, I'd be happy to include them as a maintainer.

@jvdutrag
Copy link

I'm gonna try it and if it works will request a PR @generalpiston

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants