discord-verify
Advanced tools
Comparing version 0.0.2-beta.22 to 0.0.2-beta.23
@@ -120,6 +120,22 @@ "use strict"; | ||
function getAlgo(major, minor) { | ||
if (major > 16 || major === 16 && minor >= 17) { | ||
return PlatformAlgorithm.Node18; | ||
switch (major) { | ||
case 18: { | ||
if (minor < 4) { | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
return PlatformAlgorithm.Node18; | ||
} | ||
case 17: { | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
case 16: { | ||
if (minor >= 17) { | ||
return PlatformAlgorithm.Node16; | ||
} | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
default: { | ||
return PlatformAlgorithm.Node18; | ||
} | ||
} | ||
return PlatformAlgorithm.Node16; | ||
} | ||
@@ -126,0 +142,0 @@ async function isValidRequest2(request, publicKey, algorithm) { |
{ | ||
"name": "discord-verify", | ||
"version": "0.0.2-beta.22", | ||
"version": "0.0.2-beta.23", | ||
"author": "Ian Mitchell", | ||
@@ -57,3 +57,6 @@ "description": "A library for verifying the authenticity of requests coming from the Discord Interactions API", | ||
"node": ">=16" | ||
}, | ||
"volta": { | ||
"node": "17.9.1" | ||
} | ||
} |
@@ -21,7 +21,27 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error | ||
function getAlgo(major: number, minor: number) { | ||
if (major > 16 || (major === 16 && minor >= 17)) { | ||
return PlatformAlgorithm.Node18; | ||
switch (major) { | ||
case 18: { | ||
if (minor < 4) { | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
return PlatformAlgorithm.Node18; | ||
} | ||
case 17: { | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
case 16: { | ||
if (minor >= 17) { | ||
return PlatformAlgorithm.Node16; | ||
} | ||
return PlatformAlgorithm.Node16_Old; | ||
} | ||
default: { | ||
return PlatformAlgorithm.Node18; | ||
} | ||
} | ||
return PlatformAlgorithm.Node16; | ||
} | ||
@@ -28,0 +48,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42258
731