Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-verify

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-verify - npm Package Compare versions

Comparing version 0.0.2-beta.20 to 0.0.2-beta.21

2

package.json
{
"name": "discord-verify",
"version": "0.0.2-beta.20",
"version": "0.0.2-beta.21",
"author": "Ian Mitchell",

@@ -5,0 +5,0 @@ "description": "A library for verifying the authenticity of requests coming from the Discord Interactions API",

@@ -75,3 +75,10 @@ import type {

Node18: "Ed25519",
Node16: {
/**
* Version 16.17.0+
*/
Node16: "Ed25519",
/**
* Versions older than 16.17.0
*/
Node16_Old: {
name: "NODE-ED25519",

@@ -78,0 +85,0 @@ namedCurve: "NODE-ED25519",

@@ -18,2 +18,12 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error

// v16.17.0+ use standardized naming:
// https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md#2022-08-16-version-16170-gallium-lts-targos
function getAlgo(major: number, minor: number) {
if (major > 16 || (major === 16 && minor >= 17)) {
return PlatformAlgorithm.Node18;
}
return PlatformAlgorithm.Node16;
}
/**

@@ -31,5 +41,7 @@ * Validates a request from Discord

) {
const [majorVersion] = process.versions.node.split(".");
const algo =
majorVersion >= 18 ? PlatformAlgorithm.Node18 : PlatformAlgorithm.Node16;
const [major, minor] = process.versions.node.split(".");
const majorVersion = Number(major);
const minorVersion = Number(minor);
const algo = algorithm ?? getAlgo(majorVersion, minorVersion);
const subtleCrypto =

@@ -40,3 +52,3 @@ majorVersion >= 18

return verifyRequest(request, publicKey, subtleCrypto, algorithm ?? algo);
return verifyRequest(request, publicKey, subtleCrypto, algo);
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc