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.
@stacks/profile
Advanced tools
Functions for manipulating user profiles.
npm install @stacks/profile
import { extractProfile } from '@stacks/profile';
// Token received after signin in browser using auth or connect package
const token = '<insert profile token here>';
const profile = extractProfile(token);
// profile
import { verifyProfileToken } from '@stacks/profile';
// Token received after signin in browser using auth or connect package
const token = '<insert profile token here>';
const publicKey = '<insert public key>';
const decodedToken = verifyProfileToken(token, publicKey);
// decodedToken if verified successfully
// Otherwise throws an error if token verification fails
import { makeProfileZoneFile } from '@stacks/profile';
const fileUrl = 'https://_example_.s3.amazonaws.com/naval.id/profile.json';
const origin = 'naval.id';
const zoneFile = makeProfileZoneFile(origin, fileUrl);
// zoneFile contents
import { signProfileToken, verifyProfileToken, extractProfile } from '@stacks/profile';
// Token received after signin in browser using auth or connect
const token = '<insert profile token here>';
const profile = extractProfile(token);
// warning: Do not expose your private key by hard coding in code. Use env variables to load private keys.
const privateKey = '<private key>'; // process.env.privateKey
const publicKey = '<public key>';
const signedToken = signProfileToken(profile, privateKey);
const decodedToken = verifyProfileToken(signedToken, publicKey);
// decodedToken if verified successfully
// Otherwise throws an error if token verification fails
import { extractProfile, Profile } from '@stacks/profile';
// Token received after signin in browser using auth or connect
const token = '<insert profile token here>';
// warning: Do not expose your private key by hard coding in code. Use env variables to load private keys.
const privateKey = '<private key>'; // process.env.privateKey
const publicKey = '<public key>';
const profile = extractProfile(token);
const profileObject = new Profile(profile);
console.log(profileObject);
const validationResults = Profile.validateSchema(profile);
console.log(validationResults.valid);
const profileJson = profileObject.toJSON();
console.log(profileJson);
const tokenRecords = profileObject.toToken(privateKey);
console.log(tokenRecords);
const profileFromToken = Profile.fromToken(tokenRecords, publicKey);
console.log(profileFromToken);
FAQs
Library for Stacks profiles
The npm package @stacks/profile receives a total of 12,195 weekly downloads. As such, @stacks/profile popularity was classified as popular.
We found that @stacks/profile 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.