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

@thefirstspine/certificate-authority

v1.0.4

Published

Self-signed certificate authority to automate & check secure layer for protected endpoints.

Downloads

40

Readme

certificate-authority // @thefirstspine/certificate-authority

Self-signed certificate authority to automate & check secure layer for protected endpoints.

Install

npm i @thefirstspine/certificate-authority

Philosophy

Here in TFS we strongly believe that services calls must be verified through private / public key pairs to ensure that the calls are from the good service: IPs are not sufficient for distributed service and DNS can be compromised.

Here's a model of what we engourage:

INCOMING REQUEST                               REQUEST GUARD                         PROTECTED RESOURCE
+---------------------------------+            +-----------------------+             +---------------------+
|                                 | +------->  |                       | +-------->  |                     |
| x-client-cert: dXAgdXAgZG93...  |            | Request validation    |             | Accessing protected |
| x-client-cert-encoding: base64  |            | against a private key |             | resources           |
|                                 | +------->  |                       | +-------->  |                     |
+---------------------------------+            +-----------------------+             +---------------------+
INCOMING REQUEST                               REQUEST GUARD                         PROTECTED RESOURCE

Configuration

As part of TFS Platform, the validation service will use environment variable.

| Environement key | Summary | |-|-| | PRIVATE_KEY | The pivate key to use to validate incoming requests |

Service documentation

ValidatorService

Global service to validate incoming requests. This service will use the environment variable PRIVATE_KEY to fetch the private key.

challenge

Challenge the certificate against the private key.

Synopsis: challenge(certificate: string): boolean

Params:

  • certificate: string The decoded certificate provided by the request.

CLI documentation

In order to use the CLI, the dependency should be installed globally.

tfs-ca-generate

Generates files to be validated in the services.

Example: -m=pair -k=private.key -c=public.cert

Options:

  • -m Defines what's to be generated. "ask" or "pair". If not provided, a prompt will be displayed.
  • -k The private key path. If not provided, a prompt will be displayed. If the file already exists, a confirmation will be asked.
  • -c The public certificate path. If not provided, a prompt will be displayed. If the file already exists, a confirmation will be asked.

How to use

Build

npm run build

Lint

npm run lint

Publish on NPM

npm publish

How it is used in the TFS Platform?

In TFS we use GCP buckets along with Secret Manager to store these generated certificates:

for SERVICE in arena bots
do
  tfs-ca-generate --mode=pair --key=private.key --certificate=public.cert --force
  gsutil cp public.cert gs://bucket-artefacts-eu/$SERVICE.cert
  gcloud secrets versions add "secret-$SERVICE-private-key-eu" --data-file=private.key
done

These generated pairs are copied & loaded during the build to ensure that there is no human access to these credentials. Moreover, all the credentials are updated in the Appengines every day at 2:00 AM UTC and stored in environement variables.