keytar

Native Node.js bindings for storing passwords in the OS keychain

Library
npm
v7.9.0
1,426stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
46/100Fair
Development Activity0
Maintenance32
Community64
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
65/100Good
Architecture68
Code Quality62
Innovation55
Learning Curve75

keytar is a native Node.js addon that provides a simple, promise-based API for storing, retrieving, and deleting passwords in your operating system’s secure credential store — Keychain on macOS, the Secret Service API/libsecret on Linux, and Credential Vault on Windows.

Originally built by GitHub for the Atom editor, keytar became the de facto standard for desktop applications — including many built with Electron — that need to persist user credentials without writing them to disk in plain text. It ships prebuilt binaries for supported Node.js and Electron ABI versions, avoiding a native compile step for most consumers.

What You Get

  • A cross-platform native addon that talks to macOS Keychain, Windows Credential Vault, and Linux libsecret through a single API
  • Prebuilt binaries for supported Node.js and Electron runtimes via prebuild-install, avoiding local compilation for most installs
  • A minimal, promise-based API surface: getPassword, setPassword, deletePassword, findCredentials, and findPassword
  • TypeScript typings shipped in the package (keytar.d.ts)

Common Use Cases

  • Storing a user’s API token or session credential for an Electron desktop app
  • Persisting database or service passwords for a CLI tool without writing them to a plaintext config file
  • Building a password manager or credential-vault integration on top of native OS keychains

Under The Hood

Architecture - keytar is a thin native addon: a small JavaScript wrapper (lib/keytar.js) forwards five calls (getPassword, setPassword, deletePassword, findCredentials, findPassword) to a compiled keytar.node binary built from C++ sources in src/. Each OS gets its own backend file — keytar_mac.cc talks to the macOS Security framework’s Keychain APIs, keytar_posix.cc talks to libsecret/Secret Service on Linux, and keytar_win.cc talks to the Windows Credential Vault — all implementing the same KEYTAR_OP_RESULT-returning C++ interface defined in keytar.h, with async.cc bridging the synchronous native calls into async N-API work so JS callers get promises instead of blocking the event loop.

Tech Stack - Built on node-addon-api (N-API) for ABI-stable native bindings, node-gyp for compiling from source when no prebuilt binary matches, and prebuild-install/prebuild to fetch or produce per-platform, per-ABI prebuilt binaries so most npm install runs skip compilation entirely. Platform SDKs are used directly: Apple’s Security framework on macOS, libsecret on Linux, and the Windows Credential Manager API (wincred.h) on Windows.

Code Quality - The native code is compact and single-purpose (under 1,200 lines across all four backend files), with a consistent error-passing convention (std::string* errStr out-parameters) across platforms. Tests live in spec/keytar-spec.js and run via Mocha against the compiled binary, exercising the real OS keychain rather than mocks. The project has been archived since December 2022 (last commit) after GitHub sunset Atom, so no further maintenance or security patches are expected.

API Design - The public API is deliberately tiny: five verbs, each taking plain strings, each returning a promise. There is no configuration, no classes, and no setup beyond require('keytar'), which makes it trivial to adopt but leaves error handling coarse (a single rejected promise per failure mode).

Used by 7 apps in this directory

TypeScript
84%
MIT

Amical

Note Taking · AI Assistants

1,495

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
79
Repo Health
82
Technical
67
Dependency
Built with
TypeScript84%
Updated 3 weeks ago
TypeScript
89%
Other

anytype-ts

Knowledge Management · Note Taking · Collaboration

8,665

A local-first, end-to-end encrypted knowledge OS that lets you build notes, tasks, wikis, and entire apps — with your data stored offline and synced peer-to-peer.

View details
88
Repo Health
78
Technical
67
Dependency
Built with
TypeScript89%
Updated yesterday
JavaScript
88%
GPL 3.0

Glass by Pickle

AI Assistants

7,577

A privacy-first desktop AI assistant that sees your screen, hears your meetings, and turns live context into structured summaries—without sending a single byte to the cloud.

View details
46
Repo Health
76
Technical
68
Dependency
Built with
JavaScript88%
TypeScript12%
Updated 9 months ago
TypeScript
76%
Other

Joplin

Note Taking

56,003

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
62
Dependency
Built with
TypeScript76%
JavaScript15%
Updated yesterday
Clojure
73%
AGPL 3.0

Logseq

Note Taking · Knowledge Management

44,506

A privacy-first, open-source knowledge graph platform combining Markdown, Org-mode, bidirectional linking, and local-first storage for building your second brain.

View details
92
Repo Health
82
Technical
68
Dependency
Built with
Clojure73%
OCaml11%
Updated today
TypeScript
82%
AGPL 3.0

Standard Notes

Note Taking

6,589

End-to-end encrypted notes and files — private by design, built to last, and fully self-hostable.

View details
91
Repo Health
83
Technical
67
Dependency
Built with
TypeScript82%
JavaScript14%
Updated yesterday
TypeScript
95%
Apache 2.0

Void

AI Code Assistants · Code Editors · Automation

28,833

Open-source AI code editor with direct LLM integration and data privacy

View details
49
Repo Health
84
Technical
69
Dependency
Built with
TypeScript95%
Updated 2 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search