 
npm install tauri-plugin-keyring-api!NPM Version
!Crates.io Version
A simple wrapper over rust keyring crate. This may be useful for many applications that require storing user's sensitive data on disk, so although it's simple, I made a plugin for it.
Using keyring allows you to store user's password in the system keychain safely without prompting user for password everytime.
Tauri's stronghold plugin is also used for storing secrets and keys. But it requires user to enter a password or storing the encryption key somewhere. keyring is a good place to store this encryption key.
Sample Usage:
- Storing random database encryption key
- Storing user's password for auto-login
- Storing user's auth token
Sample Project that uses this plugin: kunkunsh/kunkun
- Crate: https://crates.io/crates/tauri-plugin-keyring
- cargo add tauri-plugin-keyring
- NPM Package: https://www.npmjs.com/package/tauri-plugin-keyring-api
- npm install tauri-plugin-keyring-api
``ts
import {
getPassword,
setPassword,
deletePassword,
} from "tauri-plugin-keyring-api";
const service = "my-service";
const user = "my-user";
if (!pass) {
await setPassword(service, user, "my-password");
}
const pass: string = await getPassword(service, user);
await deletePassword(service, user);
`
`rust``
use tauri::Manager;
use tauri_plugin_keyring::KeyringExt;
// app is a tauri::AppHandle
let pass: Option