
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
senler-sdk
Advanced tools
`SenlerSDK' is a TypeScript library for easy interaction with the Senler API. It provides a modular structure for working with various Senler resources, such as subscribers, mailing lists, messages, etc.
npm install senler-sdk
To work with the API, you will need the access_token and vk_group_id of your VKontakte community.
import { SenlerApiClientV2 } from "senler-sdk"
const client = new SenlerApiClientV2({
accessToken: "YOUR_ACCESS_TOKEN",
vkGroupId: "YOUR_VK_GROUP_ID",
})
client.subscribers.get().then((res) => console.log(res))
npm i passport passport-senler
import express from 'express';
import passport from 'passport';
import { SenlerStrategy } from 'passport-senler';
passport.use(
new SenlerStrategy({
clientID: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
callbackURL: 'https://yourapp.com/auth/senler/callback',
})
);
const app = express();
app.get('/auth/senler', passport.authenticate('senler'));
app.get(
'/auth/senler/callback',
passport.authenticate('senler', {
failureRedirect: '/auth/senler/error',
session: false, // Disable session (senler does not used it)
}),
async (req, res) => {
const client = new SenlerApiClientV2({
accessToken: req.accessToken,
vkGroupId: "YOUR_VK_GROUP_ID",
})
res.json(await client.subscribers.get())
}
);
app.listen(3000, () => {
console.log('Server is starting on port: 3000');
});
To handle errors correctly, use try-catch blocks or .catch() methods.
const client = new SenlerApiClientV2({
accessToken: "YOUR_TOKEN",
vkGroupId: "YOUR_VK_GROUP_ID",
})
const app = express();
app.get('/get', async (_req, res) => {
try {
res.json(await client.subscribers.get())
}
catch (error: any) {
res.send(error.message)
}
});
Errors implemented via success, error_code and error_message (docs) are converted and throws out as an ApiError with the corresponding message.
Logging is based on pino, you can overwrite the default configuration.
const loggingConfig = {
level: 'info',
destination: pino.destination("./log.log"),
base: { pid: false },
transport: {
target: 'pino-pretty',
options: {
colorize: true,
indent: 4
}
}
}
const client = new SenlerApiClientV2(apiConfig, loggingConfig, retryConfig, cacheConfig);
Retrying is based on axios-retry, you can overwrite the default configuration.
const retryConfig = {
retries: 3,
retryDelay(retryCount, error): number {
return axiosRetry.exponentialDelay(retryCount, error, 100);
}
}
const client = new SenlerApiClientV2(apiConfig, loggingConfig, retryConfig, cacheConfig);
Caching is based on cache-manager:
const cacheConfig = {
enabled: true,
manager: createCache({ ttl: 10_000 })
}
const client = new SenlerApiClientV2(apiConfig, loggingConfig, retryConfig, cacheConfig);
You can also provide custom cache config in any routes:
await client.subscribers.get({count: 30}, cacheConfig)
This project is licensed under the MIT license. See LICENSE for details.
FAQs
SDK for Senler API
The npm package senler-sdk receives a total of 532 weekly downloads. As such, senler-sdk popularity was classified as not popular.
We found that senler-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.