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

acme-protocol

v0.5.1

Published

Automatic Certificate Management Environment (ACME) Protocol

Downloads

2

Readme

ACME Protocol

npm npm license npm downloads Travis CI status AppVeyor CI status Dependency Status Known Vulnerabilities Code Quality Grade

This module aims to implement the Automatic Certificate Management Environment (ACME) Protocol, with compatibility for both, the currently employed (e.g. by LetsEncrypt), and the currently being specified version.

Install via npm

$ npm install --save acme-protocol

Index

Usage

var ACME = require( 'acme-protocol' )

Creating a Client

// Create a new ACME protocol client
var client = new ACME.Client({
  // ACME service URL
  baseUrl: 'https://acme-staging.api.letsencrypt.org',
  // PEM encoded public key (required)
  publicKey: fs.readFileSync( 'public-key.pem', 'utf8' ),
  // PEM encoded private key (required)
  privateKey: fs.readFileSync( 'private-key.pem', 'utf8' ),
})
// Configure the client with the ACME server's directory
// NOTE: Optional, will be done on API if unconfigured
client.configure( function( error, directory ) {
  directory == {
    'new-authz': 'https://acme-staging.api.letsencrypt.org/acme/new-authz',
    'new-cert': 'https://acme-staging.api.letsencrypt.org/acme/new-cert',
    'new-reg': 'https://acme-staging.api.letsencrypt.org/acme/new-reg',
    'revoke-cert': 'https://acme-staging.api.letsencrypt.org/acme/revoke-cert'
  }
})

Registering an Account

// Define your contact details
var contact = [ 'mailto:root@localhost' ]

// Register a new account for defined contact and
// keys the client was initialized with
client.register( contact, function( error, registration ) {
  client.registrationUrl = registration == {
    resource: 'new-reg',
    contact: [ 'mailto:[email protected]' ],
    id: 246840,
    key: JSONWebKey {
      kty: 'RSA',
      n: 'oL9U7lsMfBGZiFO_NmvTbPlPaMgMfg9iuxO2IkgKrJbKVtrGvfzNCOMIaO_wAx8AIf3-tegeaEWWV6FyO6haW1zPhKovVAYyXQKof8CKvueooTie46d0JAHirdAGWn2BWCQKQ-GlFqqMx2ou1BHv9MxfGKaT9CjT8cIROl1ptag3kdUH5ZsjhGmdg_TNXeu4wtiYVf0JG9nWfZncX4Dgv6IpSCoQiGf6FIE_q0jaUhpdBdQ6HEL_s6O3L45FFYvGfAuiciuKVZugR3hXCUJ26NmShMKfdu5qUKPQ02-IQAFGncnMNOVPeDhkLMMIaNerGCsjVz1l_TjXOSTW-h1paw',
      e: 'AQAB'
    },
    initialIp: '217.246.162.70',
    createdAt: '2016-07-05T22:28:50Z'
  }
})
// Create a registration update with `agreement` set
var registration = {
  resource: ACME.REGISTRATION,
  agreement: 'https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf',
}

// Update your registration with agreement to TOS
client.updateRegistration( registration, function( error, registration ) {
  client.registration = registration == {
    resource: 'new-reg',
    contact: [ 'mailto:[email protected]' ],
    id: 246840,
    key: JSONWebKey {
      kty: 'RSA',
      n: 'oL9U7lsMfBGZiFO_NmvTbPlPaMgMfg9iuxO2IkgKrJbKVtrGvfzNCOMIaO_wAx8AIf3-tegeaEWWV6FyO6haW1zPhKovVAYyXQKof8CKvueooTie46d0JAHirdAGWn2BWCQKQ-GlFqqMx2ou1BHv9MxfGKaT9CjT8cIROl1ptag3kdUH5ZsjhGmdg_TNXeu4wtiYVf0JG9nWfZncX4Dgv6IpSCoQiGf6FIE_q0jaUhpdBdQ6HEL_s6O3L45FFYvGfAuiciuKVZugR3hXCUJ26NmShMKfdu5qUKPQ02-IQAFGncnMNOVPeDhkLMMIaNerGCsjVz1l_TjXOSTW-h1paw',
      e: 'AQAB'
    },
    agreement: 'https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf',
    initialIp: '217.246.162.70',
    createdAt: '2016-07-05T22:28:50Z'
  }
})

Applying for Authorization

// Create an Authorization Resource
var auth = {
  resource: ACME.NEW_AUTHORIZATION,
  identifier: {
    type: 'dns',
    value: 'example.com'
  },
}

// Request a new authorization
client.newAuthorization( auth, function( error, authorization ) {
  authorization == {
    identifier: {
      type: 'dns',
      value: 'example.com'
    },
    status: 'pending',
    expires: '2016-08-23T17:01:04.813031251Z',
    challenges: [
      {
        type: 'dns-01',
        status: 'pending',
        uri: 'https://acme-staging.api.letsencrypt.org/acme/challenge/FoNKbCvpWIeWZ1zPag2Y9_RoYS1p_nfp12IGx2HE444/10741622',
        token: 'MCb7GlKjWtYpFiediI1Lxl2eYT1Idswkv6KcoLIu7Eg'
      },
      {
        type: 'tls-sni-01',
        status: 'pending',
        uri: 'https://acme-staging.api.letsencrypt.org/acme/challenge/FoNKbCvpWIeWZ1zPag2Y9_RoYS1p_nfp12IGx2HE444/10741623',
        token: 'q3pTKDKJiqRF9HRYTTiqK6grKmFFNgXXYCH_Ar61IpY'
      },
      {
        type: 'http-01',
        status: 'pending',
        uri: 'https://acme-staging.api.letsencrypt.org/acme/challenge/FoNKbCvpWIeWZ1zPag2Y9_RoYS1p_nfp12IGx2HE444/10741624',
        token: 'gpjesS8JfKGwBx5X6T7RDycRPM9Mxj32xuirCpCbhGU'
      }
    ],
    combinations: [ [ 1 ], [ 0 ], [ 2 ] ]
  }
})