🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

github-key-token

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-key-token

Use your local ssh private key to create a username token that can be verified using your Github public key

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

github-key-token

Use your local ssh private key to create a username token that can be verified using your Github public key

npm install github-key-token

Usage

var ghtoken = require('github-key-token')

var verify = ghtoken.verifier('test', [
  'mafintosh',
  'sorribas',
  'watson'
])

// use your own username here - mine won't work for you :)
var sign = ghtoken.signer('test', 'mafintosh')

sign(function(err, token) {
  if (err) throw err

  console.log('Got user token', token)

  verify(token, function(err, username) {
    if (err) throw err

    console.log('Verified that the token came from '+username)
  })
})

Default TTL for the token is 3600s. To change this pass it as an option

var sign = ghtoken.signer('test', 'mafintosh', {ttl:1000}) // 1000s ttl

This module is useful if you are building semi private api and want to do auth without having to setup username/passwords and send them over the wire

License

MIT

Keywords

ssh

FAQs

Package last updated on 31 Jul 2014

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