From d00038aeea643607b4110b358c109c2a0adf36ea Mon Sep 17 00:00:00 2001 From: Cecilia Avila <44245136+ceciliaavila@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:27:38 -0300 Subject: [PATCH] Replace nanoid with crypto (#4769) --- testing/botbuilder-test-utils/package.json | 3 +-- testing/botbuilder-test-utils/src/jwt.ts | 6 +++--- yarn.lock | 5 ----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/testing/botbuilder-test-utils/package.json b/testing/botbuilder-test-utils/package.json index 7dc9e6231..a916d59af 100644 --- a/testing/botbuilder-test-utils/package.json +++ b/testing/botbuilder-test-utils/package.json @@ -19,8 +19,7 @@ "@types/node-forge": "^1.3.11" }, "dependencies": { - "eslint-plugin-only-warn": "^1.1.0", - "nanoid": "^3.3.7", + "eslint-plugin-only-warn": "^1.1.0", "node-forge": "^1.3.1", "zod": "^3.23.8" } diff --git a/testing/botbuilder-test-utils/src/jwt.ts b/testing/botbuilder-test-utils/src/jwt.ts index 5a64b2253..9f05a8201 100644 --- a/testing/botbuilder-test-utils/src/jwt.ts +++ b/testing/botbuilder-test-utils/src/jwt.ts @@ -6,8 +6,8 @@ import forge from 'node-forge'; import jwt, { Algorithm } from 'jsonwebtoken'; // eslint-disable-line import/no-extraneous-dependencies import nock from 'nock'; // eslint-disable-line import/no-extraneous-dependencies import url from 'url'; -import { nanoid } from 'nanoid'; import { ok } from 'assert'; +import { randomUUID } from 'crypto'; /** * Registers mocha hooks for proper usage @@ -62,10 +62,10 @@ export function stub(options: Partial = {}): Result { algorithm = 'RS256', bits = 2048, expiresIn = 1000 * 60 * 5, - host = `https://${nanoid()}.jwt.localhost`, + host = `https://${randomUUID()}.jwt.localhost`, issuer = 'iss', jwks = { path: '/v1/.well-known/jwks' }, - keyId = nanoid(), + keyId = randomUUID(), metadata = { path: '/v1/.well-known/openid' }, } = options; diff --git a/yarn.lock b/yarn.lock index d664d68cc..65133ea60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12010,11 +12010,6 @@ nanoid@^3.3.6: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== -nanoid@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" - integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== - napi-build-utils@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"