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

@kingofmac/easykey

v0.1.1

Published

Node.js wrapper for the easykey CLI - secure keychain access

Readme

EasyKey Node.js Package

A simple Node.js wrapper for the easykey CLI that provides secure keychain access on macOS.

Installation

Prerequisites

  1. First, ensure you have the easykey CLI installed and available in your PATH
  2. Install this Node.js package:
npm install @kingofmac/easykey

Local Development Installation

If you're working with the source code:

cd nodejs
npm install
npm link

Usage

Basic Secret Retrieval

const easykey = require('@kingofmac/easykey');

// Get a secret (this will trigger biometric authentication)
const secret = easykey.secret('MySecretName');
console.log(secret);

// Get a secret with a reason for audit logging
const secret = easykey.secret('MySecretName', 'Connecting to production database');

ES6 Import Syntax

import { secret, list, status } from '@kingofmac/easykey';

// Get a secret
const mySecret = secret('MySecretName');

TypeScript Support

import { secret, list, status, SecretInfo, VaultStatus, EasyKeyError } from '@kingofmac/easykey';

// Get a secret with full type safety
try {
    const secretValue: string = secret('MySecretName', 'API access');
    console.log(secretValue);
} catch (error) {
    if (error instanceof EasyKeyError) {
        console.error('EasyKey operation failed:', error.message);
    }
}

Listing and Status

const easykey = require('@kingofmac/easykey');

// List all secret names
const secrets = easykey.list();
for (const secret of secrets) {
    console.log(`Secret: ${secret.name}`);
}

// List secrets with creation timestamps
const secretsWithTimestamps = easykey.list(true);
for (const secret of secretsWithTimestamps) {
    console.log(`Secret: ${secret.name}, Created: ${secret.createdAt || 'Unknown'}`);
}

// Get vault status
const status = easykey.status();
console.log(`Total secrets: ${status.secrets}`);
console.log(`Last access: ${status.last_access}`);

API Reference

Functions

  • secret(name, reason?) - Retrieve a secret value
  • getSecret(name, reason?) - Alias for secret()
  • list(includeTimestamps?) - List all secrets
  • status() - Get vault status information

Parameters

  • name (string): The name/identifier of the secret
  • reason (string, optional): Reason for the operation (for audit logging)
  • includeTimestamps (boolean, optional): Whether to include creation timestamps in list results

Return Values

  • secret() returns the secret value as a string
  • list() returns an array of objects with secret information
  • status() returns an object with vault status

Exceptions

All functions may throw EasyKeyError if the underlying CLI operation fails.

TypeScript Support

This package includes comprehensive TypeScript definitions:

interface SecretInfo {
    name: string;
    createdAt?: string;
    [key: string]: any;
}

interface VaultStatus {
    secrets: number;
    last_access: string | null;
    [key: string]: any;
}

Security Notes

  • This package is a thin wrapper around the easykey CLI
  • All security features (biometric authentication, keychain integration) are handled by the CLI
  • Secrets are retrieved through child processes and are not cached in Node.js
  • The package automatically locates the easykey binary in common installation paths

Requirements

  • macOS (required by the underlying easykey CLI)
  • Node.js 12.0.0+
  • easykey CLI installed and accessible

Quick Start Example

const easykey = require('@kingofmac/easykey');

async function example() {
    try {
        // Check vault status
        const vaultStatus = easykey.status();
        console.log(`Vault contains ${vaultStatus.secrets} secrets`);

        // List all secrets
        const secrets = easykey.list();
        for (const secret of secrets) {
            console.log(`Found secret: ${secret.name}`);
        }

        // Retrieve a specific secret (requires biometric authentication)
        const secretValue = easykey.secret('MySecretName', 'Accessing for API call');
        console.log(`Secret value: ${secretValue}`);
    } catch (error) {
        if (error instanceof easykey.EasyKeyError) {
            console.error('EasyKey error:', error.message);
        } else {
            console.error('Unexpected error:', error);
        }
    }
}

example();

Note: This is a read-only package. To store or manage secrets, use the easykey CLI directly:

easykey set SECRET_NAME "secret_value"
easykey remove SECRET_NAME

License

MIT License - see the main easykey project for details.