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

pkauth

v1.1.1

Published

This npm package provides a secure user authentication method that utilizes private keys for authentication. By eliminating the need for usernames and passwords, it enhances security. However if you wanted added security with a passphrase, a encrypted pri

Downloads

9

Readme

🔑 PkAuth (Private key authentication)

This npm package provides a secure user authentication method that utilizes private keys for authentication. By eliminating the need for usernames and passwords, it enhances security. However if you wanted added security with a passphrase, a encrypted private key option is avaliable. This authentication system employs openpgp and a curve algorithm of your choice to function effectively.

Installation

Installing torv3 is a straightforward process. First, ensure that you have Node.js version 12.x or higher and a node package manager (such as NPM) installed on your system.

To install pkauth, open your terminal or command prompt and enter the following command:

npm i pkauth

Example

Standard authentication

const pkauth = require('pkauth');
const auth = new pkauth('ed25519')

(async () => {
  const keys = await auth.generateKeyPair();
  /*{
     privateKey: <String>,
     publicKey: <String>,
     revocationCertificate:  <String>
  }*/

  const publicKey = await auth.generatePublic(keys.privateKey);
  /*{
     publicKey: <String>
  }*/

  const valide = await auth.validateKeys(keys.privateKey, publicKey)
  /* True */
})():

Encrypted authentication

const pkauth = require('pkauth');
const auth = new pkauth('ed25519')

(async () => {
  const keys = await auth.generateKeyPair();
  /*{
     privateKey: <String>,
     publicKey: <String>,
     revocationCertificate:  <String>
  }*/

  const encryptedPrivateKey = await auth.encryptPrivateKey(keys.privateKey, 'SuperSecurePassPhrase')
  /*{
     privateKey: <String>
  }*/
  
  const decryptedPrivateKey = await auth.decryptPrivateKey(encryptedPrivateKey.privateKey, 'SuperSecurePassPhrase')
  /*{
     privateKey: <String>
  }*/

  const publicKey = auth.generatePublic(decryptedPrivateKey.privateKey);
  /*{
     publicKey: <String>
  }*/

  const valide = auth.validateKeys(keys.privateKey, publicKey)
  /* True */
})();

API

auth.generateKeyPair

auth.generateKeyPair()

Generates a pair key.

auth.generatePublic

auth.generatePublic(privateKey)

Generates a public key from the provided private key.

  • privateKey is a required string armoured pgp private key.

auth.encryptPrivateKey

auth.encryptPrivateKey(privateKey, passphrase)

Generates a encrypted private key from the provided private key and passphrase

  • privateKey is a required string armoured pgp private key.
  • passphrase is a required string passphrase.

auth.decryptPrivateKey

auth.decryptPrivateKey(encryptedPrivateKey, passphrase)

Generates a decrypted private key from the provided encrypted private key and passphrase

  • encryptedPrivateKey is a required string armoured pgp encrypted private key.
  • passphrase is a required string passphrase.

auth.validateKeys

auth.validateKeys(privateKey, publicKey)

Validates inputed public key is equal to the derived public key from the private key.

  • privateKey is a required string armoured pgp private key.
  • publicKey is a required string armoured pgp public key.