From 314b257b45f82db642170bdfa060b83111703044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 7 Jun 2019 13:31:28 +0200 Subject: [PATCH] Replace dependency `ms` completely I have seen this PR here: https://github.com/Human-Connection/Human-Connection/pull/774 and I thought: Never saw that one before, where is it used and what is the purpose? I could find this line only and thought this is not a justification for having the package installed. --- backend/package.json | 1 - backend/src/jwt/encode.js | 3 +-- backend/yarn.lock | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/package.json b/backend/package.json index b87ce61e9..1950c5561 100644 --- a/backend/package.json +++ b/backend/package.json @@ -69,7 +69,6 @@ "linkifyjs": "~2.1.8", "lodash": "~4.17.11", "merge-graphql-schemas": "^1.5.8", - "ms": "~2.1.1", "neo4j-driver": "~1.7.4", "neo4j-graphql-js": "git+https://github.com/Human-Connection/neo4j-graphql-js.git#temporary_fixes", "node-fetch": "~2.6.0", diff --git a/backend/src/jwt/encode.js b/backend/src/jwt/encode.js index 97c6dcd66..1552804cc 100644 --- a/backend/src/jwt/encode.js +++ b/backend/src/jwt/encode.js @@ -1,11 +1,10 @@ import jwt from 'jsonwebtoken' -import ms from 'ms' import CONFIG from './../config' // Generate an Access Token for the given User ID export default function encode(user) { const token = jwt.sign(user, CONFIG.JWT_SECRET, { - expiresIn: ms('1d'), + expiresIn: 24 * 60 * 60 * 1000, // one day issuer: CONFIG.GRAPHQL_URI, audience: CONFIG.CLIENT_URI, subject: user.id.toString(), diff --git a/backend/yarn.lock b/backend/yarn.lock index 7c4115391..57f582469 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -5593,7 +5593,7 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@2.1.1, ms@^2.1.1, ms@~2.1.1: +ms@2.1.1, ms@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==