# github-current-user

> Verify the current GitHub user via their private keys

Latest version **2.5.0** (published 2016-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install github-current-user
pnpm add github-current-user
yarn add github-current-user
bun add github-current-user
```

Provides the command `github-current-user`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.5.0 |
| Published | 2016-03-19 |
| First published | 2015-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Beau Gunderson |
| Maintainers | beaugunderson, maxogden, mafintosh, feross |
| Keywords | github |

## Links

- npm: https://www.npmjs.com/package/github-current-user
- Repository: https://github.com/beaugunderson/github-current-user
- Issues: https://github.com/beaugunderson/github-current-user/issues
- npm.io page: https://npm.io/package/github-current-user

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^2.1.3
- [ghsign](https://npm.io/package/ghsign.md) ^1.2.2
- [request](https://npm.io/package/request.md) ^2.55.0
- [git-config-path](https://npm.io/package/git-config-path.md) ^0.1.0
- [github-username](https://npm.io/package/github-username.md) ^1.1.1
- [parse-git-config](https://npm.io/package/parse-git-config.md) ^0.3.1

## Recent versions

- 2.5.0 (latest) — 2016-03-19
- 2.4.1 — 2015-04-29
- 2.4.0 — 2015-04-29
- 2.3.0 — 2015-04-29
- 2.2.2 — 2015-04-28
- 2.2.1 — 2015-04-28
- 2.2.0 — 2015-04-28
- 2.1.2 — 2015-04-27
- 2.1.1 — 2015-04-27
- 2.1.0 — 2015-04-27
- 2.0.0 — 2015-04-27
- 1.0.0 — 2015-04-26

## README

## 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

```js
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);
});
```

```js
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
```

---
_Source: https://npm.io/package/github-current-user · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
