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 🙏

© 2026 – Pkg Stats / Ryan Hefner

keyshare-cli

v1.0.0

Published

CLI tool for secure key sharing

Downloads

6

Readme

Keyshare CLI

Command-line interface for secure key sharing.

Installation

Global Installation

npm install -g keyshare-cli

Local Development

npm install
npm link

Using npx (No Installation)

npx keyshare-cli init
npx keyshare-cli fetch

Configuration

Set the API URL via environment variable:

export KEYSHARE_API_URL=https://keyshare.yourcompany.com

Or create a .env file:

KEYSHARE_API_URL=https://keyshare.yourcompany.com

Commands

keyshare init

Create a new share and get a share code.

Options:

  • --api-url <url> - API server URL
  • --from-file <path> - Read secret from file
  • --ttl <minutes> - Time-to-live in minutes
  • --qr - Display QR code
  • --no-clipboard - Don't copy to clipboard
  • --no-confirm - Skip confirmation prompts

Examples:

# Interactive mode
keyshare init

# From file
keyshare init --from-file ./api-key.txt

# Custom TTL
keyshare init --ttl 5

# With QR code
keyshare init --qr

# Custom API URL
keyshare init --api-url https://keyshare.company.com

Output:

✓ Share created successfully!

Share code (give this to your colleague):
  AB12XY9Q

Expires: 10/4/2025, 9:23:32 AM
TTL: 10 minutes

✓ Code copied to clipboard

keyshare fetch

Retrieve a secret using a share code.

Options:

  • --api-url <url> - API server URL
  • --code <code> - Share code
  • --env-file <path> - Environment file path (default: .env)
  • --var-name <name> - Variable name (default: API_KEY)
  • --no-write - Don't write to file, just display
  • --overwrite - Overwrite existing variable
  • --no-confirm - Skip confirmation prompts

Examples:

# Interactive mode
keyshare fetch

# With code
keyshare fetch --code AB12XY9Q

# Custom env file
keyshare fetch --env-file .env.local

# Custom variable name
keyshare fetch --var-name DATABASE_URL

# Just display (don't write)
keyshare fetch --no-write

# Overwrite existing
keyshare fetch --overwrite

Output:

✓ Share retrieved successfully!

✓ Secret written to /path/to/.env
  Variable: API_KEY
  Backup created
  Permissions: 600 (owner read/write only)

keyshare revoke

Revoke a share before it's used.

Options:

  • --code <code> - Share code to revoke (required)
  • --api-url <url> - API server URL
  • --no-confirm - Skip confirmation prompts

Examples:

# Revoke a share
keyshare revoke --code AB12XY9Q

# Skip confirmation
keyshare revoke --code AB12XY9Q --no-confirm

Features

Secure Env File Writing

  • Creates .env file with 600 permissions (owner read/write only)
  • Backs up existing file before modification
  • Prevents accidental overwrites
  • Validates variable names

Clipboard Support

  • Automatically copies share codes to clipboard
  • Works on macOS, Linux, and Windows
  • Can be disabled with --no-clipboard

QR Code Display

  • Generate QR codes for easy mobile sharing
  • Enable with --qr flag

Error Handling

Clear, user-friendly error messages:

  • Invalid share codes
  • Expired shares
  • Already used shares
  • Rate limiting
  • Network errors

Testing

npm test

Run tests in watch mode:

npm run test:watch

Development

Project Structure

cli/
├── bin/
│   └── cli.js          # Executable entry point
├── src/
│   ├── index.js        # Command definitions
│   ├── apiClient.js    # API communication
│   └── envWriter.js    # Env file management
└── test/
    └── envWriter.test.js

Adding New Commands

  1. Edit src/index.js
  2. Add command using Commander.js
  3. Implement command logic
  4. Add tests
  5. Update documentation

Publishing

# Update version
npm version patch  # or minor, major

# Publish to npm
npm publish

# Test installation
npm install -g keyshare-cli

License

MIT