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

webid

v0.3.11

Published

WebID module

Downloads

140

Readme

node-webid

Build Status NPM Version Gitter chat

Node.js module with tools to help using WebID.

Installation

$ npm install webid --save

Features

  • [x] Retrieve a WebID
  • [x] Verify a WebID+TLS
  • [x] Generate a WebID+TLS

Usage

To verify a WebID / certificate:

// Self-signed certificate parsed by Express
var validCert = {
  subject: { O: 'WebID', CN: 'Nicola Greco (test) [on test_nicola.databox.me]' },
  issuer: { O: 'WebID', CN: 'Nicola Greco (test) [on test_nicola.databox.me]' },
  subjectaltname: 'URI:https://test_nicola.databox.me/profile/card#me',
  modulus: 'C62AE4CE77A8D915527F79EE1B5365099A35A3BF8E4AA68ED7CBF4D6B966ACE0FCAD79DE66A0EA89FF5EF8DAB2619F51E2F28227C9AA594BA3A4176723BA00813D8F8C738359F6240DF8FADD1A7AE56F2B24E7329A189E1065E3E7C2CEC96CC57CD9D3BF782DC15C11FBEFD24E536C46E8E1285BEC27CB3CC6C295595F18BC564A6ACA45ABCB8AD0C6617F42F5151DDB1A42513BE7AA9E2593DFDBB03938C15136C202C61E59DFE7C563F56301B5B29F91C03A9C92458BA26918E22CB137B998FF76EC85E97D16424078A949F491E348D9E33A43C9D5D938C6E12B2F2015FA2C1A950E28C6ECC6DD70CE228275DBB4C085BC4063DA24178F5B13601E3E6CE17F',
  exponent: '10001',
  valid_from: 'Jan  1 00:00:00 2000 GMT',
  valid_to: 'Dec 31 23:59:59 2049 GMT',
  fingerprint: '17:09:CB:F5:8D:D7:49:BB:36:45:B8:96:01:C9:0F:0D:E7:56:5B:C0',
  serialNumber: '2A'
}

// Using the TLS webid strategy
var webid = require('webid')('tls')

var agentWebId = 'https://corysabol.databox.me/profile/card#me'
webid.verify(validCert, callback)

To generate a WebID / certificate.

var forge = require('node-forge')
var asn1 = forge.asn1
var pki = forge.pki

var webid = require('webid')('tls')

// Sample Express handler for the account /register endpoint
// This is what a form containing a `<keygen>` element will POST to
app.post('/register', bodyParser(), function (req, res) {
  var options = {
    // <keygen name=spkack>
    spkac: Buffer.from(req.body.spkac),
    agent: req.session.userWebId
  }
  webid.generate(options, function(err, cert) {
    // Some browsers only accept DER formatted certificates
    var der = asn1.toDer(pki.certificateToAsn1(cert)).getBytes()
    // Send back the generated certificate with a WebID URI in the subjectAltName
    res.set('Content-Type', 'application/x-x509-user-cert')
    res.send(Buffer.from(der, 'binary'))
  })
})

Options

var options = {
  // <keygen name=spkack>
  spkac: Buffer.from(req.body.spkac),
  agent: req.session.userWebId,
  commonName: '',
  organizationName: '',
  issuer: {
    commonName: '',
    organizationName: ''
  }
}

History

Originally forked from magnetik/node-webid

License

MIT