| Crates.io | tauri-plugin-keystore |
| lib.rs | tauri-plugin-keystore |
| version | 2.1.0-alpha.1 |
| created_at | 2025-02-20 09:40:40.816506+00 |
| updated_at | 2025-02-20 09:40:40.816506+00 |
| description | Interact with the device-native key storage (Android Keystore, iOS Keychain). |
| homepage | |
| repository | https://github.com/impierce/tauri-plugin-keystore |
| max_upload_size | |
| id | 1562428 |
| size | 193,896 |
Interact with the device-native key storage (Android Keystore, iOS Keychain).
[!NOTE]
This plugin is scoped to interact with the device-specific keystore. It assumes that biometrics are set up on the user's device and performs no preflight check before trying to interact with the keystore. You should use the official biometric plugin tocheckStatusbefore, if you want to make sure (see Usage below).
| Platform | Supported |
|---|---|
| Linux | ❌ |
| Windows | ❌ |
| macOS | ❌ |
| Android | ✅ |
| iOS | ✅ |
Add the following to your src-tauri/Cargo.toml:
[dependencies]
tauri-plugin-keystore = "2"
Then install the JS guest bindings:
pnpm add @impierce/tauri-plugin-keystore
This also works for npm and yarn.
First you need to register the plugin with your Tauri app:
src-tauri/src/lib.rs
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_keystore::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
import { remove, retrieve, store } from "@impierce/tauri-plugin-keystore";
await store("secr3tPa$$w0rd");
const password = await retrieve();
await remove();
The provided functions will fail if the device has no biometrics set up, so you should check the biometric status with the official tauri-plugin-biometric before using them:
import { checkStatus, type Status } from "@tauri-apps/plugin-biometric";
const biometricsStatus: Status = await checkStatus();
assert(biometricsStatus.biometryType !== BiometryType.None);
This plugin is semantically versioned, but there are some caveats:
v2.0.0 to match the Tauri version it supports (common practice for Tauri plugins).The next version is determined by semantic-release which does not recommend making commits during the release process.
When publishing a new npm package to npmjs.com this is circumvented by semantic-release by pushing the version in the release metadata, so the version field in package.json is ignored.
However, crates.io uses the version field from Cargo.toml to determine the version. There seems to be no easy way to replace the version number during the publish to crates.io.
This repository provides a workaround for this issue by using a semi-automated release process which decouples building a new release from pushing it to the package registries:
Run the release --dry-run Action to let semantic-release determine the next version. Take note of the version it produces.
Manually update the version fields in the Cargo.toml and package.json files (omit the "v", so just 2.1.0 instead of v2.1.0).
Commit the changes using the following commit message (replace the version):
build: release version v1.1.0-alpha.1
Open a pull request with the same title as the commit message.
After the PR is merged, the actual release Action will run which creates a new release on GitHub and adds a git tag.
The publish Action then publishes the packages to npm and crates.io.