From 0b5f3ca85b11591744d71c7d3108149e79597984 Mon Sep 17 00:00:00 2001 From: uzlopak Date: Thu, 12 Jan 2023 19:54:40 +0100 Subject: [PATCH 1/6] remove semver --- lib/asymmetricKeyDetailsSupported.js | 5 +++-- lib/psSupported.js | 5 +++-- lib/rsaPssKeyDetailsSupported.js | 5 +++-- package.json | 3 +-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/asymmetricKeyDetailsSupported.js b/lib/asymmetricKeyDetailsSupported.js index a6ede56e..abc88e3e 100644 --- a/lib/asymmetricKeyDetailsSupported.js +++ b/lib/asymmetricKeyDetailsSupported.js @@ -1,3 +1,4 @@ -const semver = require('semver'); +const [major, minor] = process.version.slice(1).split('.').map(parseInt) -module.exports = semver.satisfies(process.version, '>=15.7.0'); +// >=15.7.0 +module.exports = major > 15 || (major === 15 && minor >= 7) diff --git a/lib/psSupported.js b/lib/psSupported.js index 8c04144a..92850b35 100644 --- a/lib/psSupported.js +++ b/lib/psSupported.js @@ -1,3 +1,4 @@ -var semver = require('semver'); +const [major, minor] = process.version.slice(1).split('.').map(parseInt) -module.exports = semver.satisfies(process.version, '^6.12.0 || >=8.0.0'); +// ^6.12.0 || >=8.0.0 +module.exports = (major === 6 && minor >= 12) || major > 8 diff --git a/lib/rsaPssKeyDetailsSupported.js b/lib/rsaPssKeyDetailsSupported.js index 7fcf3684..502ae50c 100644 --- a/lib/rsaPssKeyDetailsSupported.js +++ b/lib/rsaPssKeyDetailsSupported.js @@ -1,3 +1,4 @@ -const semver = require('semver'); +const [major, minor] = process.version.slice(1).split('.').map(parseInt) -module.exports = semver.satisfies(process.version, '>=16.9.0'); +// >=16.9.0 +module.exports = major > 16 || (major === 16 && minor >= 9); diff --git a/package.json b/package.json index 4f1e4e91..f1f1e136 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,7 @@ "dependencies": { "jws": "^3.2.2", "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" + "ms": "^2.1.1" }, "devDependencies": { "atob": "^2.1.2", From 02e43141e22a3679b6e1da7af81d4a286698aa2d Mon Sep 17 00:00:00 2001 From: uzlopak Date: Thu, 12 Jan 2023 19:56:58 +0100 Subject: [PATCH 2/6] reduce branch coverage --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1f1e136..e57037a6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "lines": 95, "statements": 95, "functions": 100, - "branches": 95, + "branches": 94, "exclude": [ "./test/**" ], From 0226e832520c6cda5bfbfcb4edefceba993c3540 Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Sun, 12 Feb 2023 14:39:34 +0100 Subject: [PATCH 3/6] Update lib/asymmetricKeyDetailsSupported.js --- lib/asymmetricKeyDetailsSupported.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asymmetricKeyDetailsSupported.js b/lib/asymmetricKeyDetailsSupported.js index abc88e3e..0c11fb6b 100644 --- a/lib/asymmetricKeyDetailsSupported.js +++ b/lib/asymmetricKeyDetailsSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(parseInt) +const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) // >=15.7.0 module.exports = major > 15 || (major === 15 && minor >= 7) From bde4aa4257dbb2d4711575f654c19707e603faeb Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Sun, 12 Feb 2023 14:40:30 +0100 Subject: [PATCH 4/6] Update lib/psSupported.js --- lib/psSupported.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/psSupported.js b/lib/psSupported.js index 92850b35..7d1372d3 100644 --- a/lib/psSupported.js +++ b/lib/psSupported.js @@ -1,4 +1,4 @@ const [major, minor] = process.version.slice(1).split('.').map(parseInt) // ^6.12.0 || >=8.0.0 -module.exports = (major === 6 && minor >= 12) || major > 8 +module.exports = (major === 6 && minor >= 12) || major >= 8 From 84dfbf0c18d8e1f09a22dd930cc62e9547a80f17 Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Sun, 12 Feb 2023 14:42:54 +0100 Subject: [PATCH 5/6] Apply suggestions from code review --- lib/psSupported.js | 2 +- lib/rsaPssKeyDetailsSupported.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/psSupported.js b/lib/psSupported.js index 7d1372d3..9f7c67fa 100644 --- a/lib/psSupported.js +++ b/lib/psSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(parseInt) +const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) // ^6.12.0 || >=8.0.0 module.exports = (major === 6 && minor >= 12) || major >= 8 diff --git a/lib/rsaPssKeyDetailsSupported.js b/lib/rsaPssKeyDetailsSupported.js index 502ae50c..bba5c88c 100644 --- a/lib/rsaPssKeyDetailsSupported.js +++ b/lib/rsaPssKeyDetailsSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(parseInt) +const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) // >=16.9.0 module.exports = major > 16 || (major === 16 && minor >= 9); From 525a89bdf7283fd699ac8b53dac7c3c204529be3 Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Mon, 13 Feb 2023 11:32:12 +0100 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Filip Skokan --- lib/asymmetricKeyDetailsSupported.js | 2 +- lib/psSupported.js | 2 +- lib/rsaPssKeyDetailsSupported.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/asymmetricKeyDetailsSupported.js b/lib/asymmetricKeyDetailsSupported.js index 0c11fb6b..b28a9ed6 100644 --- a/lib/asymmetricKeyDetailsSupported.js +++ b/lib/asymmetricKeyDetailsSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) +const [major, minor] = process.versions.node.split('.').map((v) => parseInt(v, 10)) // >=15.7.0 module.exports = major > 15 || (major === 15 && minor >= 7) diff --git a/lib/psSupported.js b/lib/psSupported.js index 9f7c67fa..79130f58 100644 --- a/lib/psSupported.js +++ b/lib/psSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) +const [major, minor] = process.versions.node.split('.').map((v) => parseInt(v, 10)) // ^6.12.0 || >=8.0.0 module.exports = (major === 6 && minor >= 12) || major >= 8 diff --git a/lib/rsaPssKeyDetailsSupported.js b/lib/rsaPssKeyDetailsSupported.js index bba5c88c..57acf662 100644 --- a/lib/rsaPssKeyDetailsSupported.js +++ b/lib/rsaPssKeyDetailsSupported.js @@ -1,4 +1,4 @@ -const [major, minor] = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10) }) +const [major, minor] = process.versions.node.split('.').map((v) => parseInt(v, 10)) // >=16.9.0 module.exports = major > 16 || (major === 16 && minor >= 9);