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.
@grammyjs/storage-deta
Advanced tools
Storage adapter that can be used to store your session data on Deta.sh Base when using sessions.
Node
npm install @grammyjs/storage-deta --save
Deno
import { DetaAdapter } from "https://deno.land/x/grammy_storages/deta/src/mod.ts";
Set up your Deta Base by creating a Deta project. Copy the Project Key to here.
You should now have:
Put those values into the following example code:
You can check examples folder.
Example of a message counter bot running on Deno:
import {
Bot,
Context,
session,
SessionFlavor,
} from "https://lib.deno.dev/x/grammy@1.x/mod.ts";
import { DetaAdapter } from "https://deno.land/x/grammy_storages/deta/src/mod.ts";
// Define session structure
interface SessionData {
count: number;
}
type MyContext = Context & SessionFlavor<SessionData>;
// Create the bot and register the session middleware
const bot = new Bot<MyContext>(""); // <-- Put your Bot token here.
bot.use(session({
initial: () => ({ count: 0 }),
storage: new DetaAdapter<SessionData>({
baseName: "session", // <-- Base name - your choice.
projectKey: "", // <-- Project Key here.
}),
}));
// Use persistant session data in update handlers
bot.on("message", async (ctx) => {
ctx.session.count++;
await ctx.reply(`Message count: ${ctx.session.count}`);
});
bot.catch((err) => console.error(err));
bot.start();
2.3.2 (2023-09-05)
Note: Version bump only for package @grammyjs/storages
FAQs
deta.sh storage adapter for grammY
The npm package @grammyjs/storage-deta receives a total of 1 weekly downloads. As such, @grammyjs/storage-deta popularity was classified as not popular.
We found that @grammyjs/storage-deta demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.