# @napi-rs/keyring

> https://github.com/hwchen/keyring-rs Node.js binding via https://napi.rs

Latest version **2.1.0** (published 2026-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @napi-rs/keyring
pnpm add @napi-rs/keyring
yarn add @napi-rs/keyring
bun add @napi-rs/keyring
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-09-13 |
| First published | 2023-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 46.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 103 |
| Maintainers | broooooklyn, forehalo |
| Keywords | napi-rs, NAPI, N-API, Rust, node-addon, node-addon-api |

## Links

- npm: https://www.npmjs.com/package/@napi-rs/keyring
- Repository: https://github.com/Brooooooklyn/keyring-node
- Homepage: https://github.com/Brooooooklyn/keyring-node#readme
- Issues: https://github.com/Brooooooklyn/keyring-node/issues
- Funding: https://github.com/sponsors/Brooooooklyn
- npm.io page: https://npm.io/package/@napi-rs/keyring

## Recent versions

- 2.1.0 (latest) — 2026-09-13
- 2.0.0 — 2026-08-31
- 1.3.0 — 2026-04-30
- 1.2.0 — 2025-09-02
- 1.1.10 — 2025-08-29
- 1.1.9 — 2025-07-24
- 1.1.8 — 2025-05-20
- 1.1.7 — 2025-05-04
- 1.1.6 — 2024-04-17
- 1.1.5 — 2024-04-09
- 1.1.4 — 2024-03-18
- 1.1.3 — 2023-07-17
- 1.1.2 — 2023-07-17
- 1.1.1 — 2023-03-08
- 1.1.0 — 2023-03-07
- … 2 more at https://npm.io/package/@napi-rs/keyring/versions

## README

# `@napi-rs/keyring`

![https://github.com/Brooooooklyn/keyring-node/actions](https://github.com/Brooooooklyn/keyring-node/workflows/CI/badge.svg)
[![install size](https://packagephobia.com/badge?p=@napi-rs/keyring)](https://packagephobia.com/result?p=@napi-rs/keyring)
[![Downloads](https://img.shields.io/npm/dm/@napi-rs/keyring.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/keyring?minimal=true)

> https://github.com/hwchen/keyring-rs Node.js binding via https://napi.rs

# Usage

```js
import { Entry } from '@napi-rs/keyring'

const entry = new Entry('my_service', 'my_name')
entry.setPassword('topS3cr3tP4$$w0rd')
const password = entry.getPassword()
console.log('My password is ', password)
entry.deletePassword()
```

# Linux backend selection

On Linux, `Entry` and `AsyncEntry` pick a credential store automatically: the
[Secret Service](https://crates.io/crates/dbus-secret-service-keyring-store) (gnome-keyring, KWallet,
keepassxc, ...) is tried first, and the binding silently falls back to the
[kernel keyutils keyring](https://crates.io/crates/linux-keyutils-keyring-store) when no Secret Service
is available.

You can pin an entry to one specific store by passing the options bag as the last argument (the
option is accepted on every platform but only meaningful on Linux):

```js
new Entry('my_service', 'my_name', { linux: { store: 'secret-service' } }) // require Secret Service
new Entry('my_service', 'my_name', { linux: { store: 'keyutils' } }) // require the kernel keyring
Entry.withTarget('target', 'my_service', 'my_name', { linux: { store: 'keyutils' } })
```

When a store is required, the constructor throws if that store is unavailable — there is no silent
fallback. When `withTarget` is combined with the keyutils store, the target is used as the kernel key
description, so distinct targets keep distinct credentials.

> **Note:** the keyutils store keeps credentials in kernel memory: per the
> [linux-keyutils-keyring-store](https://crates.io/crates/linux-keyutils-keyring-store) docs, the key
> management facility "is completely in-memory and will not persist across reboots". Prefer
> `secret-service` for credentials that must survive a restart.

---
_Source: https://npm.io/package/@napi-rs/keyring · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
