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

jwk-to-ssh

v1.2.0

Published

💯 JWK to SSH in a lightweight, zero-dependency library.

Downloads

404

Readme

JWK to SSH (for node.js)

A minimal library to encode a JWK as an SSH public key (id_rsa.pub).

Works for RSA and ECDSA public keys.

Features

< 75 lines of code | < 0.7kb gzipped | 1.5kb minified | 2.1kb with comments

  • [x] SSH Public Keys
  • [x] OpenSSH Private Keys
  • [x] RSA Keys
  • [x] EC Keys
    • P-256 (prime256v1, secp256r1)
    • P-384 (secp384r1)
  • [x] Browser Version

Note: the file size stats are for v1.0 which did not include private key packing. I plan to go back and update the stats, but just know that it grew a little over 2x.

Need JWK to SSH? PEM to SSH?

Try one of these:

Need Alternate SSH Private Keys?

This library supports OpenSSH private keys.

  • [x] OpenSSH
  • [ ] Normal PKCS1 / SEC1 / PKCS8
    • [x] Rasha.js
    • [x] Eckles.js
  • [ ] Putty

Library Usage

You can also use it from JavaScript:

var fs = require('fs');
var jwktossh = require('jwk-to-ssh');

var jwk = JSON.parse(fs.readFileSync("./privkey.jwk.json"));
var pub = jwktossh.pack({
  jwk: jwk
, comment: 'root@localhost'
, public: true
});

console.info(pub);

CLI Usage

You can install jwk-to-ssh and use it from command line:

npm install -g jwk-to-ssh
jwk-to-ssh [keyfile] [comment] [public]
jwk-to-ssh pubkey.jwk.json
jwk-to-ssh privkey.jwk.json root@localhost
jwk-to-ssh privkey.jwk.json root@localhost public

Legal

jwk-to-ssh.js | MPL-2.0 | Terms of Use | Privacy Policy