🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

github-current-user

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-current-user

Verify the current GitHub user via their private keys

latest
Source
npmnpm
Version
2.5.0
Version published
Weekly downloads
142
0.71%
Maintainers
4
Weekly downloads
 
Created
Source

github-current-user

Get the current GitHub user and verify that they have access to a private key that's been authorized to that account.

Uses the username in user.username or github.user or the email address in user.email of the user's .gitconfig and the private keys in in the user's ssh-agent with fallback to ~/.ssh/id_rsa or ~/.ssh/id_dsa.

If the username is known, you can use verifyUser and pass it as the first argument which bypasses .gitconfig lookup work.

examples

var user = require('github-current-user');

user.verify(function (err, verified, username) {
  // if verified === true, the user has the correct private key or ssh-agent
  // for the username in the `username`
  console.log(verified, username);
});
var user = require('github-current-user');

user.verifyUser('beaugunderson', function (err, verified, username) {
  // if verified === true, the user has the correct private key or ssh-agent
  // for the username in the `username`
  console.log(verified, username);
});

test out on the cli

$ npm i github-current-user -g
$ github-current-user
You are verified as maxogden

$ github-current-user maxogden
You are verified as maxogden

Keywords

github

FAQs

Package last updated on 19 Mar 2016

Did you know?

Socket

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.

Install

Related posts