Skip to content

Commit

Permalink
add some tracking to frequency of fetches.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed May 21, 2023
1 parent fde8220 commit c7e2bad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/secretsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const shortUuid = require('short-uuid');
const crypto = require('crypto');

const secretsManager = require('./secretsManager');
const logger = require('./logger');

class SecretsController {
async createSecret(request) {
logger.log({ title: 'Secret Created', level: 'TRACK' });
const randomBytes = base64url.encode(crypto.randomBytes(64));
const secretId = `${shortUuid('abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ346789').generate()}-${randomBytes}`;

Expand Down Expand Up @@ -52,6 +54,7 @@ class SecretsController {
}

async getSecret(request) {
logger.log({ title: 'Secret Fetched', level: 'TRACK' });
const secretData = await secretsManager.fetchAndDeleteSecret(request.pathParameters.secretId);
if (!secretData) {
return {
Expand Down

0 comments on commit c7e2bad

Please sign in to comment.