Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@trivia-api/fetch
Advanced tools
Functions to fetch data from The Trivia API.
Install with npm install @trivia-api/fetch
.
import { getQuestions } from "@trivia-api/fetch";
getQuestions({ limit: 5 }).then((questions) => {
// questions is an array of questions
});
import { searchQuestions } from "@trivia-api/fetch";
searchQuestions({ freetext: "france" }).then((questions) => {
// questions is an array of questions that have either the tag 'france'
// or match 'france' to a freetext search on the question.
});
import { getMetadata } from "@trivia-api/fetch";
getMetadata().then((metadata) => {
// metadata is an object representing the number of questions in the API, broken down by category and state
});
import { getTags } from "@trivia-api/fetch";
getTags().then((tags) => {
// tags is an array of all the tags used by questions in the API
});
import { updateQuestion } from "@trivia-api/fetch";
const question = await getQuestions()[0];
const newQuestion = {
...question,
correctAnswer: "A different answer",
};
const API_KEY = "abcd1234";
try {
await updateQuestion(API_KEY, newQuestion);
// If the promise resolves then the question has been successfully updated
} catch {
// If the promise is rejected then the question has not been updated. Did you
// pass in a valid API key? Is the ID wrong? Did you miss a required property?
}
import { createSession, getQuestions } from "@trivia-api/fetch";
createSession().then((session) => {
// You can use the session object to request questions with no duplicates
// Request 10 questions from the session you just created
getQuestions({ session: session.id, limit: 10 });
/**
* Request 10 more questions from the session you just created. These
* questions are guaranteed to be different to the questions previously
* received.
*/
getQuestions({ session: session.id, limit: 10 });
});
FAQs
Functions to fetch data from The Trivia API.
The npm package @trivia-api/fetch receives a total of 2 weekly downloads. As such, @trivia-api/fetch popularity was classified as not popular.
We found that @trivia-api/fetch 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.