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

discord-interactions

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-interactions - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

4

dist/index.js

@@ -50,2 +50,5 @@ "use strict";

});
var InteractionResponseFlags = Object.freeze({
EPHEMERAL: 1 << 6,
});
function verifyKey(rawBody, signature, timestamp, clientPublicKey) {

@@ -114,2 +117,3 @@ return __awaiter(this, void 0, void 0, function () {

InteractionResponseType: InteractionResponseType,
InteractionResponseFlags: InteractionResponseFlags,
verifyKey: verifyKey,

@@ -116,0 +120,0 @@ verifyKeyMiddleware: verifyKeyMiddleware,

4

package.json
{
"name": "discord-interactions",
"version": "1.0.0",
"version": "1.0.2",
"description": "Helpers for discord interactions",

@@ -18,3 +18,3 @@ "main": "dist/index.js",

"build:watch": "tsc --watch",
"format": "prettier --write \"src/**/*.ts\"",
"format": "prettier --write \"(src|examples)/**/*.[tj]s\"",
"lint": "tslint -p tsconfig.json"

@@ -21,0 +21,0 @@ },

@@ -18,2 +18,13 @@ discord-interactions

```
const signature = req.get('X-Signature-Ed25519');
const timestamp = req.get('X-Signature-Timestamp');
const isValidRequest = await verifyKey(req.rawBody, signature, timestamp, 'MY_CLIENT_PUBLIC_KEY');
if (!isValidRequest) {
return res.status(403).end('Bad request signature');
}
```
Note that `req.rawBody` must be populated by a middleware (it is also set by some cloud function providers).
If you're using an express-like API, you can simplify things by using the `verifyKeyMiddleware`. For example:

@@ -49,2 +60,6 @@

### InteractionResponseFlags
An enum of flags you can set on your response data.
### verifyKey(rawBody: Buffer, signature: string, timestamp: string, clientPublicKey: string): Promise<boolean>

@@ -51,0 +66,0 @@

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