From 046dc338a6fd29911d3fee39fa18bb18de4767b4 Mon Sep 17 00:00:00 2001 From: Santiago Olayo Date: Sun, 23 Jun 2024 04:13:51 -0500 Subject: [PATCH] feat: add jwt rsa auth --- src/secrets-manager/secrets-manager.service.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/secrets-manager/secrets-manager.service.ts b/src/secrets-manager/secrets-manager.service.ts index 6e45d8f..2e22990 100644 --- a/src/secrets-manager/secrets-manager.service.ts +++ b/src/secrets-manager/secrets-manager.service.ts @@ -11,17 +11,23 @@ export class SecretsManagerService { constructor() { this.region = 'us-east-2'; - this.client = new SecretsManagerClient({ region: this.region }); + this.client = new SecretsManagerClient({ + region: this.region, + credentials: { + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, + }, + }); } async getSecretValue(secretName: string): Promise { try { - const secretKey = `${process.env.NODE_ENV}/${process.env.MICROSERVICE_NAME}/${secretName}` + const secretKey = `${process.env.NODE_ENV}/${process.env.MICROSERVICE_NAME}/${secretName}`; const command = new GetSecretValueCommand({ SecretId: secretKey }); const data = await this.client.send(command); - + if (!data.SecretString) { throw new Error('El secreto no es una cadena'); }