From e415c3fdd5b628ef6bb4ffb88bae6ac0fb524749 Mon Sep 17 00:00:00 2001 From: Markus Tacker Date: Thu, 26 Aug 2021 00:43:06 +0200 Subject: [PATCH] fix: use uuid to generate usernames --- package.json | 1 - src/tests/authentication.test.ts | 7 ++----- yarn.lock | 22 +--------------------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 5e2fd4586..239712a5c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "license": "(ISC OR GPL-3.0)", "dependencies": { "@graphql-tools/utils": "8.1.1", - "@nordicsemiconductor/random-words": "^5.0.0", "@sinclair/typebox": "^0.20.0", "@types/graphql-depth-limit": "^1.1.2", "@types/lodash": "^4.14.170", diff --git a/src/tests/authentication.test.ts b/src/tests/authentication.test.ts index b261fb772..db93913ae 100644 --- a/src/tests/authentication.test.ts +++ b/src/tests/authentication.test.ts @@ -1,5 +1,4 @@ // tslint:disable:ordered-imports -import { randomWords } from '@nordicsemiconductor/random-words' import express, { Express } from 'express' import { createServer, Server } from 'http' import passport from 'passport' @@ -12,6 +11,7 @@ import { json } from 'body-parser' import registerUser from '../routes/register' import login from '../routes/login' import renewCookie from '../routes/me/cookie' +import { v4 } from 'uuid' jest.setTimeout(15 * 1000) @@ -20,9 +20,6 @@ passport.use(cookieAuthStrategy) const tokenCookieRx = new RegExp(`${authCookieName}=([^;]+);`, 'i') -const generateUsername = async () => - (await randomWords({ numWords: 3 })).join('-') - describe('User account API', () => { let app: Express let httpServer: Server @@ -31,7 +28,7 @@ describe('User account API', () => { let password: string let authCookie: string beforeAll(async () => { - username = await generateUsername() + username = v4() password = 'y{uugBmw"9,?=L_' app = express() app.use(cookieParser(process.env.COOKIE_SECRET ?? 'cookie-secret')) diff --git a/yarn.lock b/yarn.lock index 311e82f0c..d85faa122 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1421,13 +1421,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@nordicsemiconductor/random-words@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@nordicsemiconductor/random-words/-/random-words-5.0.0.tgz#9cb2a30f98408ef7edbfd85eaec6b8516727d9ac" - integrity sha512-io/F9llmFligKtNgQFiGHW+S1wBIjaINKZ1Nb+q68tTokkFga2axwYHhZ0eO1G1K9+stJLasGIgJN+scvNvkig== - dependencies: - random-number-csprng "^1.0.2" - "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" @@ -2426,7 +2419,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bluebird@^3.3.3, bluebird@^3.7.2: +bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -3047,11 +3040,6 @@ cosmiconfig@7.0.0, cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" -create-error@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/create-error/-/create-error-0.3.1.tgz#69810245a629e654432bf04377360003a5351a23" - integrity sha1-aYECRaYp5lRDK/BDdzYAA6U1GiM= - create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -6728,14 +6716,6 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -random-number-csprng@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/random-number-csprng/-/random-number-csprng-1.0.2.tgz#fcd120e62dffc2c07674c7c3fe01e16b25f73a26" - integrity sha1-/NEg5i3/wsB2dMfD/gHhayX3OiY= - dependencies: - bluebird "^3.3.3" - create-error "^0.3.1" - range-parser@~1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"