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.
github-username
Advanced tools
The github-username npm package is a simple utility that allows you to retrieve a GitHub username from an email address. This can be particularly useful for applications that need to map email addresses to GitHub profiles.
Retrieve GitHub Username
This feature allows you to retrieve the GitHub username associated with a given email address. The code sample demonstrates how to use the package to get the username asynchronously.
const githubUsername = require('github-username');
(async () => {
const username = await githubUsername('email@example.com');
console.log(username);
})();
The gh-user package allows you to fetch detailed information about a GitHub user by their username. Unlike github-username, which maps an email to a username, gh-user provides more comprehensive user data such as name, bio, and repositories.
The github-api package is a more general-purpose library for interacting with the GitHub API. It allows you to perform a wide range of actions, including fetching user data, repositories, and issues. While it can be used to get user information, it requires more setup and is not as specialized as github-username.
Octokit is the official GitHub REST API client for JavaScript. It provides a comprehensive set of tools for interacting with GitHub's API, including user data retrieval. However, it is more complex and feature-rich compared to the lightweight and focused github-username package.
Get a GitHub username from an email address
npm install github-username
import githubUsername from 'github-username';
console.log(await githubUsername('sindresorhus@gmail.com'));
//=> 'sindresorhus'
Get the GitHub username from an email address if the email can be found in any commits on GitHub.
Returns a Promise<string?>
with the username.
Type: string
The email address for the user of whom you want the username.
Type: object
Type: string
GitHub personal access token.
FAQs
Get a GitHub username from an email address
The npm package github-username receives a total of 830,769 weekly downloads. As such, github-username popularity was classified as popular.
We found that github-username 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.