Skip to content

Commit

Permalink
Use webcrypto randomUUID in SecretsManager
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed Jul 29, 2024
1 parent 1f8d63e commit d696e2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/internal/secrets-manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSONArray, JSONObject } from 'k6'
import http, { RefinedResponse, ResponseType } from 'k6/http'
import { crypto } from 'k6/experimental/webcrypto'

import { v4 as uuidv4 } from 'uuid'
import { AWSClient } from './client'
import { AWSConfig } from './config'
import { AMZ_TARGET_HEADER } from './constants'
Expand Down Expand Up @@ -133,7 +133,7 @@ export class SecretsManagerClient extends AWSClient {
versionID?: string,
tags?: Array<object>
): Promise<Secret> {
versionID = versionID || uuidv4()
versionID = versionID ?? crypto.randomUUID()

const signedRequest = this.signature.sign(
{
Expand Down Expand Up @@ -179,7 +179,7 @@ export class SecretsManagerClient extends AWSClient {
* @throws {InvalidSignatureError}
*/
async putSecretValue(id: string, secret: string, versionID?: string): Promise<Secret> {
versionID = versionID || uuidv4()
versionID = versionID ?? crypto.randomUUID()

const signedRequest = this.signature.sign(
{
Expand Down

0 comments on commit d696e2c

Please sign in to comment.