Skip to content

Commit

Permalink
feat: add jwt rsa auth
Browse files Browse the repository at this point in the history
Santiago Olayo committed Jun 23, 2024
1 parent 76d8a82 commit 046dc33
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/secrets-manager/secrets-manager.service.ts
Original file line number Diff line number Diff line change
@@ -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<object> {
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');
}

0 comments on commit 046dc33

Please sign in to comment.