Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

traeok/keytar-rs

Repository files navigation

keytar-rs

keytar-rs is a native Node.js module for accessing and managing OS credential storage. It is a Rust approach to the npm library node-keytar.

keytar-rs demo

Compatibility

OS / Architecture Node.js Version
v12 v14 v16 v18
Windows x64
x86
arm64
macOS x64
aarch64
Linux (gnu) x64
aarch64
Linux (musl) x64
aarch64
FreeBSD x64 ✓* ✓* ✓* ✓*
zLinux s390x ✓* ✓* ✓* ✓*
*Using node-password-store fallback

Features

keytar-rs supports the following operations within credential storage:

  • Set a credential
  • Retrieve a credential
  • Find all credentials with matching attributes
  • Find a password with matching attributes

Some benefits to using keytar-rs:

  • Cross-platform support makes for straight-forward secrets management
  • Existing OS credentials are supported out-of-the-box
  • Avoids memory allocation - memory only allocated as needed for OS-specific APIs

Node API documentation

deletePassword

Deletes a password with matching service and account parameters.

Returns: Whether the password was deleted successfully.

function deletePassword(service: string, account: string) -> Promise<boolean>

findCredentials

Finds all credentials with a matching service parameter.

Returns: An array of Credential objects, containing the account and password for each credential that is found within service.

interface Credential {
  account: string;
  password: string;
};

function findCredentials(service: string) -> Promise<Array<Credential>>

findPassword

Finds a password with a matching service and account parameter.

Returns: The first password found in <service>/<account>, or null if not found.

function findPassword(service: string, account: string) -> Promise<string | null>

getPassword

Gets a password with a matching service and account parameter.

Returns: The password stored under <service>/<account>, or null if not found.

function getPassword(service: string, account: string) -> Promise<string | null>

setPassword

Stores a password with the given service, account, and password.

function setPassword(service: string, account: string, password: string) -> Promise<void>

About

keytar meets Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •