discord-interactions
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -83,1 +83,2 @@ /// <reference types="node" /> | ||
export { InteractionType, InteractionResponseType, InteractionResponseFlags, verifyKey, verifyKeyMiddleware }; | ||
export * from './components'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verifyKeyMiddleware = exports.verifyKey = exports.InteractionResponseFlags = exports.InteractionResponseType = exports.InteractionType = void 0; | ||
const nacl = require('tweetnacl'); | ||
const tweetnacl_1 = __importDefault(require("tweetnacl")); | ||
/** | ||
@@ -149,3 +162,3 @@ * The type of interaction this request is. | ||
const publicKeyData = valueToUint8Array(clientPublicKey, 'hex'); | ||
return nacl.sign.detached.verify(message, signatureData, publicKeyData); | ||
return tweetnacl_1.default.sign.detached.verify(message, signatureData, publicKeyData); | ||
} | ||
@@ -216,2 +229,3 @@ catch (ex) { | ||
exports.verifyKeyMiddleware = verifyKeyMiddleware; | ||
__exportStar(require("./components"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "discord-interactions", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Helpers for discord interactions", | ||
@@ -29,4 +29,4 @@ "main": "dist/index.js", | ||
"build:watch": "tsc --watch", | ||
"format": "prettier --write \"(src|examples)/**/*.[tj]s\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"format": "eslint --fix '**/*.ts' '**/*.js'", | ||
"lint": "eslint '**/*.ts' '**/*.js'", | ||
"test": "jest --verbose" | ||
@@ -42,3 +42,8 @@ }, | ||
"@types/node-fetch": "^2.5.7", | ||
"@typescript-eslint/eslint-plugin": "^5.16.0", | ||
"@typescript-eslint/parser": "^5.16.0", | ||
"body-parser": "^1.19.0", | ||
"eslint": "^8.11.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"express": "^4.17.1", | ||
@@ -49,6 +54,4 @@ "jest": "^27.5.1", | ||
"ts-jest": "^27.1.3", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.1.2" | ||
} | ||
} |
@@ -54,20 +54,30 @@ discord-interactions | ||
### InteractionType | ||
### `InteractionType` | ||
An enum of interaction types that can be POSTed to your webhook endpoint. | ||
### InteractionResponseType | ||
### `InteractionResponseType` | ||
An enum of response types you may provide in reply to Discord's webhook. | ||
### InteractionResponseFlags | ||
### `InteractionResponseFlags` | ||
An enum of flags you can set on your response data. | ||
### verifyKey(rawBody: Buffer, signature: string, timestamp: string, clientPublicKey: string): Promise<boolean> | ||
### `MessageComponentTypes` | ||
An enum of message component types that can be used in messages and modals. | ||
### Message components | ||
Types for the different message component structures: `Button`, `ActionRow`, `StringSelect`, and `InputText`. | ||
Also includes the enums `ButtonStyleTypes` and `TextStyleTypes`, and a `StringSelectOption` type. | ||
### `verifyKey(rawBody: Buffer, signature: string, timestamp: string, clientPublicKey: string): Promise<boolean>` | ||
Verify a signed payload POSTed to your webhook endpoint. | ||
### verifyKeyMiddleware(clientPublicKey: string) | ||
### `verifyKeyMiddleware(clientPublicKey: string)` | ||
Express-style middleware that will verify request signatures (make sure you include this before any other middleware that modifies the request body). |
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
26288
9
432
83
16