discord-verify
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -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
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
30622
19
764
1
+ Added@types/express@^4.17.14
+ Added@types/body-parser@1.19.5(transitive)
+ Added@types/connect@3.4.38(transitive)
+ Added@types/express@4.17.21(transitive)
+ Added@types/express-serve-static-core@4.19.6(transitive)
+ Added@types/http-errors@2.0.4(transitive)
+ Added@types/mime@1.3.5(transitive)
+ Added@types/node@22.9.1(transitive)
+ Added@types/qs@6.9.17(transitive)
+ Added@types/range-parser@1.2.7(transitive)
+ Added@types/send@0.17.4(transitive)
+ Added@types/serve-static@1.15.7(transitive)
+ Addedundici-types@6.19.8(transitive)