npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bitid

v0.0.4

Published

JavaScript implementation of the BitID authentication protocol: https://github.com/bitid/bitid

Downloads

16

Readme

BitID

This is the javascript implementation of the BitID authentication protocol. Checkout the original Ruby version at https://github.com/bitid/bitid-ruby

Basically, what the module does is build a message challenge and verifying the signature.

Installation

$ npm install bitid

Usage

Challenge

To build a challenge, you need to initialize a Bitid object with a nonce and a callback.

var bitid = new Bitid({nonce:nonce, callback:callback});

nonce is a random string associated with the user's session id. callback is the url without the scheme where the wallet will post the challenge's signature.

One example of callback could be www.site.com/callback. A callback cannot have parameters. By default the POST call will be done using https. If you need to tell the wallet to POST on http then you need to add unsecure:true.

var bitid = new Bitid({nonce:nonce, callback:callback, unsecure:true});

Once the Bitid object is initialized, you have access to the following methods :

bitid.uri

This is the uri which will trigger the wallet when clicked (or scanned as QRcode). For instance :

bitid://bitid-demo.herokuapp.com/callback?x=987f20277c015ce7

If you added unsecure:true when initializing the object then uri will be like :

bitid://bitid-demo.herokuapp.com/callback?x=987f20277c015ce7&u=1

To get the uri as QRcode :

bitid.qrcode

This is actualy an URL pointing to the QRcode image.

Verification

When getting the callback from the wallet, you must initialize a Bitid object with the received parameters address, uri, signature as well as the excpected callback :

var bitid = new Bitid(address:address, uri:uri, signature:signature, callback:callback);

You can after call the following methods :

bitid.nonce

Return the nonce, which would get you the user's session.

bitid.uriValid()

Returns true if the submitted URI is valid and corresponds to the correct callback url.

bitid.signatureValid()

If returns true, then you can authenticate the user's session with address (public Bitcoin address used to sign the challenge).

Integration example

JavaScript application using the bitid lib: https://github.com/porkchop/bitid-js-demo

Live demonstration: http://bitid-js-demo.herokuapp.com/

Author

Aaron Caswell [email protected]

Credits

Eric Larchevêque (The creator of the Bitid protocol and the original Ruby gem this code is based on) [email protected]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request