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.
Wrapper of happn api for nodeJS. Working may 2022 - Only facebook auth.
Exemple of use : https://github.com/christophe77/happn-bot
npm i happn-api
// or
yarn add happn-api
then in your project :
const happnApi = require("happn-api").default;
// or
import happnApi from "happn-api"
All return types can be found here : types
Only with facebook for the moment.
const { auth } = happnApi;
const facebookCredentials = {
email: "email@gmail.com",
password: "12345",
};
async function login() {
return auth.withFacebook(facebookCredentials);
}
Auth is mandatory before any action.
Used to get your profile datas.
const { me } = happnApi;
async function getMyDatas() {
return me();
}
const { recommandations } = happnApi;
async function getMyRecommandations() {
return recommandations();
}
const { shortList } = happnApi;
async function getShortList() {
return shortList();
}
const { recommandations, like } = happnApi;
async function likeUserExample() {
const myRecs = await recommandations();
if (myRecs.length > 0) {
const userToLike = myRecs[0].content.user;
try {
const likeResponse = await like(userToLike.id, userToLike.picture.id);
const remainingLikes = likeResponse.data.renewable_likes;
const hasLikedMe = likeResponse.data.has_liked_me;
const hasCrushed = likeResponse.data.has_crushed;
console.log(`you liked ${userToLike.first_name} ${userToLike.age}`);
console.log(`remaining likes : ${remainingLikes}`);
if (hasLikedMe) {
console.log("she liked you");
}
if (hasCrushed) {
console.log("we have a crush");
}
} catch (error) {
console.log(error);
}
}
}
const { recommandations, dislike } = happnApi;
async function disLikeUserExample() {
const myRecs = await recommandations();
if (myRecs.length > 0) {
const userToDisLike = myRecs[0].content.user;
await dislike(userToLike.id);
}
}
const happnApi = require("happn-api").default;
const { auth, recommandations, like } = happnApi;
const facebookCredentials = {
email: "email@gmail.com",
password: "12345",
};
async function login() {
return auth.withFacebook(facebookCredentials);
}
async function getRecommandations() {
const loginSuccess = await login();
if (loginSuccess) {
const myRecommandations = await recommandations();
return myRecommandations.data || [];
}
return [];
}
async function example() {
const myRecs = await getRecommandations();
if (myRecs.length > 0) {
const userToLike = myRecs[0].content.user;
try {
const likeResponse = await like(userToLike.id, userToLike.picture.id);
const remainingLikes = likeResponse.data.renewable_likes;
const hasLikedMe = likeResponse.data.has_liked_me;
const hasCrushed = likeResponse.data.has_crushed;
console.log(`you liked ${userToLike.first_name} ${userToLike.age}`);
console.log(`remaining likes : ${remainingLikes}`);
if (hasLikedMe) {
console.log("she liked you");
}
if (hasCrushed) {
console.log("we have a crush");
}
} catch (error) {
console.log(error);
}
}
}
example();
Implement other happn routes.
FAQs
happn api wrapper for nodejs
The npm package happn-api receives a total of 2 weekly downloads. As such, happn-api popularity was classified as not popular.
We found that happn-api demonstrated a not healthy version release cadence and project activity because the last version was released 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’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.