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

@root/x509

v0.7.2

Published

VanillaJS, Lightweight, Zero-Dependency, X509 schema encoder and decoder.

Downloads

70,564

Readme

@root/x509

Built by The Root Company for Greenlock, ACME.js, and Keypairs.js

Lightweight, Zero-Dependency, x509 encoder and decoder for Node.js and Browsers

| 1.6k gzipped | 6.8k minified | 9.7k pretty |

This provides a set ASN.1 / x509 schemas for DER encoding and decoding Public / Private Keypairs and CSRs.

  • [x] Zero External Dependencies
  • [x] x509 schemas for common crypto
    • [x] RSA & ECDSA Public/Private Keypairs
      • PKCS1
      • PKCS8
      • SEC1
      • SPKI
      • PKIX
    • [x] Certificate Signing Requests (CSR)
      • PKCS10
  • [x] Universal Support
    • [x] Node.js
    • [x] Browsers
  • [x] Vanilla JS

Looking for easy?

You probably just want to use one of these:

Looking for a deep dive? Well, in addition to x509.js, you'll probably also want one of more of these:

Want to contribute? Need commercial support?

Install

This package contains both node-specific and browser-specific code, and the package.json#browser field ensures that your package manager will automatically choose the correct code for your environment.

Node (and Webpack)

npm install --save @root/x509
var X509 = require('@root/x509');
// just the encoders
var X509 = require('@root/x509/packers');
// just the decoders
var X509 = require('@root/x509/parsers');

Browsers (Vanilla JS)

<script src="https://unpkg.com/@root/x509/dist/x509.all.js"></script>
<script src="https://unpkg.com/@root/x509/dist/x509.all.min.js"></script>
var X509 = window.X509;

Usage

This is a very tiny, very efficient x509 package.

Rather than implementing full schemas as defined by the RFCs, it only implements the parts that are actually used in the wild by programs like openssl, Let's Encrypt, ssh-keygen, etc.

Additionally, rather than always using a full parser, it uses happy-path heuristics to quickly and efficiently extract the necessary information. It likewise packs very quickly.

Encoders

The packers encoder JWK as DER.

X509.packPkcs1(jwk);
X509.packSec1(jwk);
X509.packPkcs8(jwk);
X509.packSpki(jwk);
X509.packPkix(jwk); // alias of X509.packSpki

There are two special functions specifically for embeding keys in CSRs.

X509.packCsrRsaPublicKey(jwk);
X509.packCsrEcPublicKey(jwk);

The rest of the CSR code is in csr.js.

Decoders

The keypair format parsers each return a JWK, for convenience. To conserve memory, they expect taht you give an empty object as the jwk parameter.

If you are using crv: 'P-384', you should pass that in as part of the otherwise empty JWK.

X509.parsePkcs1(buf, jwk);
X509.parseSec1(buf, jwk);
X509.parsePkcs8(buf, jwk);
X509.parseSpki(buf, jwk);
X509.parsePkix(buf, jwk); // aliase of parseSpki

Contributions

Did this project save you some time? Maybe make your day? Even save the day?

Please say "thanks" via Paypal or Patreon:

Where does your contribution go?

Root is a collection of experts who trust each other and enjoy working together on deep-tech, Indie Web projects.

Our goal is to operate as a sustainable community.

Your contributions - both in code and especially monetarily - help to not just this project, but also our broader work of projects that fuel the Indie Web.

Also, we chat on Keybase in #rootprojects

Commercial Support

Do you need...

  • more features?
  • bugfixes, on your timeline?
  • custom code, built by experts?
  • commercial support and licensing?

Contact [email protected] for support options.

Legal

Copyright AJ ONeal, Root 2018-2019

MPL-2.0 | Terms of Use | Privacy Policy