https://github.com/traeok/keytar-rs
keytar meets Rust
https://github.com/traeok/keytar-rs
Last synced: 2 months ago
JSON representation
keytar meets Rust
- Host: GitHub
- URL: https://github.com/traeok/keytar-rs
- Owner: traeok
- License: mit
- Archived: true
- Created: 2022-12-05T18:01:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-21T19:46:49.000Z (almost 2 years ago)
- Last Synced: 2025-04-02T04:05:04.136Z (2 months ago)
- Language: Rust
- Homepage:
- Size: 5.82 MB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/atom/node-keytar).

## 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:
- [x] **Set** a credential
- [x] **Retrieve** a credential
- [x] **Find all credentials** with matching attributes
- [x] **Find a password** with matching attributesSome benefits to using keytar-rs:
- [x] **Cross-platform support** makes for straight-forward secrets management
- [x] **Existing OS credentials are supported** out-of-the-box
- [x] **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.
```ts
function deletePassword(service: string, account: string) -> Promise
```### 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`.
```ts
interface Credential {
account: string;
password: string;
};function findCredentials(service: string) -> Promise>
```### findPassword
Finds a password with a matching `service` and `account` parameter.
**Returns:** The first password found in `/`, or `null` if not found.
```ts
function findPassword(service: string, account: string) -> Promise
```### getPassword
Gets a password with a matching `service` and `account` parameter.
**Returns:** The password stored under `/`, or `null` if not found.
```ts
function getPassword(service: string, account: string) -> Promise
```### setPassword
Stores a password with the given `service`, `account`, and `password`.
```ts
function setPassword(service: string, account: string, password: string) -> Promise
```