@napi-rs/keyring
https://github.com/hwchen/keyring-rs Node.js binding via https://napi.rs
Last updated 2 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @napi-rs/keyring 
SYNC missed versions from official npm registry.

@napi-rs/keyring

https://github.com/Brooooooklyn/keyring-node/actions Downloads

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

Usage

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 (gnome-keyring, KWallet, keepassxc, ...) is tried first, and the binding silently falls back to the kernel keyutils keyring 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):

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 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.

Current Tags

  • 2.1.2                                ...           latest (a month ago)

19 Versions

  • 2.1.2                                ...           a month ago
  • 2.1.1                                ...           2 months ago
  • 2.1.0                                ...           2 months ago
  • 2.0.0                                ...           3 months ago
  • 1.3.0                                ...           7 months ago
  • 1.2.0                                ...           a year ago
  • 1.1.10                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           2 years ago
  • 1.1.7                                ...           2 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Downloads
Total 62
Today 0
This Week 0
This Month 22
Last Day 0
Last Week 18
Last Month 40
Dependencies (0)
None
Dev Dependencies (12)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE