Skip to content

Commit b3b41d1

Browse files
authored
Merge pull request #91 from RoutinelyOrganization/develop
update homoogation
2 parents f7f89d0 + 2171a75 commit b3b41d1

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/pull_request_template.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
> - Crie PRs pequenos;
66
> - Forneça testes para as alterações;
77
> - Use o padrão de commit convencional;
8-
> - tualize todas as documentações necessárias;
8+
> - Atualize todas as documentações necessárias;
99
-->
1010

1111
## Tipo de PR
@@ -20,18 +20,23 @@ Marque todos os necessários
2020
- [ ] Tests unit <!-- Comportamento dos métodos -->
2121

2222
## 🎯 Objetivo
23+
2324
<!-- Descreva o objetivo das alterações. -->
2425

2526
## Alterações
27+
2628
<!-- Liste todas as mudanças feitas. -->
2729

2830
## Requisitos de aceite
31+
2932
<!-- Quais os pontos de validação do que foi feito? -->
3033

3134
## Testes
35+
3236
<!-- Adicionou testes e2e/unitários? -->
3337

3438
## Tarefas pós-implantação
39+
3540
<!-- Algo precisa ser feito após implanter a branch? -->
3641

3742
## 🛃 Para controle

src/modules/Account/account.service.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@ export class AccountService {
3131
private tokenService: PasswordTokenService,
3232
private mailingService: MailingService
3333
) {}
34-
3534
private async hashPassword(password: string): Promise<string> {
3635
return await hash(password, Number(process.env.SALT_ROUNDS));
3736
}
3837
private encrypt(text: string) {
39-
const cipher = crypto.createCipheriv(
40-
'aes-256-cbc',
41-
process.env.SECRET_KEY_CRYPTO,
42-
process.env.IV
43-
);
38+
const key = Buffer.from(process.env.SECRET_KEY_CRYPTO, 'hex');
39+
const iv = Buffer.from(process.env.IV, 'hex');
40+
41+
const cipher = crypto.createCipheriv('aes-256-cbc', key as any, iv as any);
4442
let encrypted = cipher.update(text, 'utf8', 'hex');
4543
encrypted += cipher.final('hex');
4644
return encrypted;
4745
}
4846

4947
private decrypt(text: string) {
48+
const key = Buffer.from(process.env.SECRET_KEY_CRYPTO, 'hex');
49+
const iv = Buffer.from(process.env.IV, 'hex');
5050
const decipher = crypto.createDecipheriv(
5151
'aes-256-cbc',
52-
process.env.SECRET_KEY_CRYPTO,
53-
process.env.IV
52+
key as any,
53+
iv as any
5454
);
5555
let decrypted = decipher.update(text, 'hex', 'utf8');
5656
decrypted += decipher.final('utf8');

0 commit comments

Comments
 (0)