New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.23 to 0.0.2-beta.25

dist/verify-4bd1dcd2.d.ts

4

dist/node.d.ts

@@ -1,3 +0,3 @@

import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-e358995c.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-e358995c.js';
import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-4bd1dcd2.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-4bd1dcd2.js';

@@ -4,0 +4,0 @@ /**

@@ -79,5 +79,4 @@ "use strict";

Web: "Ed25519",
Node18: "Ed25519",
Node16: "Ed25519",
Node16_Old: {
NewNode: "Ed25519",
OldNode: {
name: "NODE-ED25519",

@@ -97,3 +96,3 @@ namedCurve: "NODE-ED25519",

};
async function isValidRequest(request, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.Node18) {
async function isValidRequest(request, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.NewNode) {
const clone = request.clone();

@@ -105,3 +104,3 @@ const timestamp = clone.headers.get("X-Signature-Timestamp");

}
async function verify(rawBody, signature, timestamp, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.Node18) {
async function verify(rawBody, signature, timestamp, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.NewNode) {
if (timestamp == null || signature == null || rawBody == null) {

@@ -126,17 +125,17 @@ return false;

if (minor < 4) {
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}
return PlatformAlgorithm.Node18;
return PlatformAlgorithm.NewNode;
}
case 17: {
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}
case 16: {
if (minor >= 17) {
return PlatformAlgorithm.Node16;
return PlatformAlgorithm.NewNode;
}
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}
default: {
return PlatformAlgorithm.Node18;
return PlatformAlgorithm.NewNode;
}

@@ -143,0 +142,0 @@ }

@@ -1,3 +0,3 @@

import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-e358995c.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-e358995c.js';
import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-4bd1dcd2.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-4bd1dcd2.js';

@@ -4,0 +4,0 @@ /**

@@ -69,5 +69,4 @@ "use strict";

Web: "Ed25519",
Node18: "Ed25519",
Node16: "Ed25519",
Node16_Old: {
NewNode: "Ed25519",
OldNode: {
name: "NODE-ED25519",

@@ -87,3 +86,3 @@ namedCurve: "NODE-ED25519",

};
async function isValidRequest(request, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.Node18) {
async function isValidRequest(request, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.NewNode) {
const clone = request.clone();

@@ -95,3 +94,3 @@ const timestamp = clone.headers.get("X-Signature-Timestamp");

}
async function verify(rawBody, signature, timestamp, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.Node18) {
async function verify(rawBody, signature, timestamp, publicKey, subtleCrypto, algorithm = PlatformAlgorithm.NewNode) {
if (timestamp == null || signature == null || rawBody == null) {

@@ -98,0 +97,0 @@ return false;

{
"name": "discord-verify",
"version": "0.0.2-beta.23",
"version": "0.0.2-beta.25",
"author": "Ian Mitchell",

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

@@ -64,3 +64,3 @@ # discord-verify

#### Node 17 and Older
#### Node 18.3 and Older (Excluding Node 16.17.0 or newer v16 versions)

@@ -94,3 +94,3 @@ If you are using Node 17 or lower, you need to make some changes:

+ webcrypto.subtle,
+ PlatformAlgorithms.Node16
+ PlatformAlgorithms.OldNode
);

@@ -104,2 +104,4 @@

If you see a runtime DOMException about the the name, applying these changes should fix it.
### Options

@@ -106,0 +108,0 @@

@@ -74,11 +74,14 @@ import type {

Web: "Ed25519",
Node18: "Ed25519",
/**
* Version 16.17.0+
* Node v18.4.0+
* Node v16.17.0+
* For Node v17, use OldNode
*/
Node16: "Ed25519",
NewNode: "Ed25519",
/**
* Versions older than 16.17.0
* Node v18.3.0 and below
* Node v17.0.0+
* Node v16.16.0 and below
*/
Node16_Old: {
OldNode: {
name: "NODE-ED25519",

@@ -112,3 +115,3 @@ namedCurve: "NODE-ED25519",

subtleCrypto: SubtleCrypto,
algorithm: SubtleCryptoImportKeyAlgorithm | string = PlatformAlgorithm.Node18
algorithm: SubtleCryptoImportKeyAlgorithm | string = PlatformAlgorithm.NewNode
) {

@@ -139,3 +142,3 @@ const clone = request.clone();

subtleCrypto: SubtleCrypto,
algorithm: SubtleCryptoImportKeyAlgorithm | string = PlatformAlgorithm.Node18
algorithm: SubtleCryptoImportKeyAlgorithm | string = PlatformAlgorithm.NewNode
) {

@@ -142,0 +145,0 @@ if (timestamp == null || signature == null || rawBody == null) {

@@ -24,10 +24,10 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error

if (minor < 4) {
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}
return PlatformAlgorithm.Node18;
return PlatformAlgorithm.NewNode;
}
case 17: {
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}

@@ -37,10 +37,10 @@

if (minor >= 17) {
return PlatformAlgorithm.Node16;
return PlatformAlgorithm.NewNode;
}
return PlatformAlgorithm.Node16_Old;
return PlatformAlgorithm.OldNode;
}
default: {
return PlatformAlgorithm.Node18;
return PlatformAlgorithm.NewNode;
}

@@ -47,0 +47,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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