Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socketโs threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@sapphire/plugin-api
Advanced tools
Plugin for @sapphire/framework to expose a REST API
This plugin provides an API endpoint for your bot that can be called from external services. A good exemplary use case for this is once your bot grows to have enough configuration options that you want to offer a website to your end-users to change those settings, and your website needs to interface with the bot for this to work.
@sapphire/plugin-api
depends on the following packages. Be sure to install these along with this package!
You can use the following command to install this package, or replace npm install
with your package manager of choice.
npm install @sapphire/plugin-api @sapphire/framework @sapphire/pieces@1 discord.js discord-api-types
Start by importing the registration file in your project to use the plugin:
JavaScript
require('@sapphire/plugin-api/register');
TypeScript
import '@sapphire/plugin-api/register';
Then, you can use the following configuration options in your SapphireClient extension class or initializer. This will either be located in your new SapphireClient
constructor call, or super
in your constructor method if you use an extension class.
{
auth: {
// The application/client ID of your bot.
// You can find this at https://discord.com/developers/applications
id: '',
// The client secret of your bot.
// You can find this at https://discord.com/developers/applications
secret: '',
// The name of the authentication cookie.
cookie: 'SAPPHIRE_AUTH',
// The URL that users should be redirected to after a successful authentication
redirect: '',
// The scopes that should be given to the authentication.
scopes: ['identify'],
// Transformers to transform the raw data from Discord to a different structure.
transformers: []
},
// The prefix for all routes, e.g. / or v1/.
prefix: '',
// The origin header to be set on every request at 'Access-Control-Allow-Origin.
origin: '*',
// Any options passed to the NodeJS "net" internal server.listen function
// See https://nodejs.org/api/net.html#net_server_listen_options_callback
listenOptions: {
// The port the API will listen on.
port: 4000
}
}
For the full API documentation please refer to the TypeDoc generated documentation.
Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
We accept donations through Open Collective, Ko-fi, Paypal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
Donate With | Address |
---|---|
Open Collective | Click Here |
Ko-fi | Click Here |
Patreon | Click Here |
PayPal | Click Here |
Thanks goes to these wonderful people (emoji key):
Jeroen Claassens ๐ป ๐ ๐ | Nejc Drobnic ๐ป ๐ | Antonio Romรกn ๐ป | Vlad Frangu ๐ | depfu[bot] ๐ง | dependabot[bot] ๐ง | allcontributors[bot] ๐ |
Tyler J Russell ๐ป | Stitch07 ๐ป ๐ | PlatinBae ๐ |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Plugin for @sapphire/framework to expose a REST API
The npm package @sapphire/plugin-api receives a total of 557 weekly downloads. As such, @sapphire/plugin-api popularity was classified as not popular.
We found that @sapphire/plugin-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socketโs threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.