github-current-user
Verify the current GitHub user via their private keys
Last updated 10 years ago by beaugunderson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install github-current-user 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.5.0                                ...           latest (9 years ago)

12 Versions

  • 2.5.0                                ...           9 years ago
  • 2.4.1                                ...           10 years ago
  • 2.4.0                                ...           10 years ago
  • 2.3.0                                ...           10 years ago
  • 2.2.2                                ...           10 years ago
  • 2.2.1                                ...           10 years ago
  • 2.2.0                                ...           10 years ago
  • 2.1.2                                ...           10 years ago
  • 2.1.1                                ...           10 years ago
  • 2.1.0                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Downloads
Total 9
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE