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 1.0.0 to 1.0.2

dist/shared/discord-verify.59ff0ac4.cjs

4

dist/node.d.ts

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

import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-83c4cc43.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-83c4cc43.js';
import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-a44bae14.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-a44bae14.js';

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

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

import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-83c4cc43.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-83c4cc43.js';
import { R as Request, S as SubtleCryptoImportKeyAlgorithm } from './verify-a44bae14.js';
export { P as PlatformAlgorithm, h as hexStringToBinary, v as verify } from './verify-a44bae14.js';

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

{
"name": "discord-verify",
"version": "1.0.0",
"version": "1.0.2",
"author": "Ian Mitchell",

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

"node": ">=16"
},
"dependencies": {
"@types/express": "^4.17.14"
}
}

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

```diff
+ import { verify, PlatformAlgorithms } from "discord-verify/node";
+ import { verify, PlatformAlgorithm } from "discord-verify/node";

@@ -100,3 +100,3 @@ async function handleRequest(

crypto.webcrypto.subtle,
+ PlatformAlgorithms.OldNode
+ PlatformAlgorithm.OldNode
);

@@ -103,0 +103,0 @@

@@ -36,7 +36,7 @@ import type {

* Helper method that takes in a hex string and converts it to its binary representation.
* @param key Hex string to convert to binary
* @param key - Hex string to convert to binary
* @returns The binary form of a hex string
*/
export function hexStringToBinary(key: string | null) {
if (key == null) {
if (key == null || key.length % 2 !== 0) {
return new Uint8Array(0).buffer;

@@ -97,4 +97,4 @@ }

/**
* Despite being documented as { name: "eddsa", namedCurve: "ed25519"} or
* { name: "ecdsa", namedCurve: "ed25519" }, Vercel uses the same format as
* Despite being documented as `{ name: "eddsa", namedCurve: "ed25519"}` or
* `{ name: "ecdsa", namedCurve: "ed25519" }`, Vercel uses the same format as
* Cloudflare in Production (despite Dev using documented formats)

@@ -117,6 +117,6 @@ */

* to calling this function.
* @param request Request to verify. This should not have been consumed yet.
* @param publicKey The application's public key
* @param subtleCrypto The crypto engine to use
* @param algorithm The name of the crypto algorithm to use
* @param request - Request to verify. This should not have been consumed yet.
* @param publicKey - The application's public key
* @param subtleCrypto - The crypto engine to use
* @param algorithm - The name of the crypto algorithm to use
* @returns Whether the request is valid or not

@@ -140,8 +140,8 @@ */

* Determines if a request is valid or not based on provided values
* @param rawBody The raw body of the request
* @param signature The signature header of the request
* @param timestamp The timestamp header of the request
* @param publicKey The application's public key
* @param subtleCrypto The crypto engine to use
* @param algorithm The name of the crypto algorithm to use
* @param rawBody - The raw body of the request
* @param signature - The signature header of the request
* @param timestamp - The timestamp header of the request
* @param publicKey - The application's public key
* @param subtleCrypto - The crypto engine to use
* @param algorithm - The name of the crypto algorithm to use
* @returns Whether the request is valid or not

@@ -148,0 +148,0 @@ */

/**
* These are all derived from @cloudflare/worker-types:
* These are all derived from `@cloudflare/worker-types`:
* https://github.com/cloudflare/workers-types

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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