How dkackman/tauri-plugin-secure-element works
Tauri Plugin Secure Element exposes a cross-platform API for generating, listing, signing with, deleting, and inspecting hardware-backed keys, with authentication modes and platform-specific hardware. The user workflow is an application calling the TypeScript bindings; Tauri dispatches commands to the Rust plugin, which uses platform implementations to reach secure hardware. The test app demonstrates key management, signing, hardware status, integration tests, and vectors. Some platform implementation details are represented at their exact source paths based on the repository tree and README; unsampled internal call wiring is omitted.
Main entry points: index.ts JS Bindings · App.svelte Demo UI · commands.rs Key Commands · windows.rs Windows TPM
Components 24
App API
- JS Bindings
tauri-plugin-secure-element/guest-js/index.ts
Plugin Core
- Command Dispatch
tauri-plugin-secure-element/src/lib.rs - Key Commands
tauri-plugin-secure-element/src/commands.rs - Validation
tauri-plugin-secure-element/src/validation.rs - API Models
tauri-plugin-secure-element/src/models.rs - Error Handling
tauri-plugin-secure-element/src/error_sanitize.rs
Platform Backends
- Desktop Backend
tauri-plugin-secure-element/src/desktop.rs - Mobile Backend
tauri-plugin-secure-element/src/mobile.rs - Windows TPM
tauri-plugin-secure-element/src/windows.rs - Windows Hello
tauri-plugin-secure-element/src/windows_hello.rs - Windows Handles
tauri-plugin-secure-element/src/windows_raii.rs - Apple Plugin
tauri-plugin-secure-element/ios/Sources/Plugin.swift - Secure Enclave
tauri-plugin-secure-element/swift/SecureEnclaveCore.swift - Android Keystore
tauri-plugin-secure-element/android/src/main/java/SecureKeysPlugin.kt
Test App
- Demo UI
test-app/src/App.svelte - Key Manager
test-app/src/lib/KeyManager.svelte - Sign / Verify
test-app/src/lib/SignVerify.svelte - Hardware Status
test-app/src/lib/HardwareStatus.svelte - Integration Tests
test-app/src/lib/IntegrationTests.svelte - Test Vectors
test-app/src/lib/TestVectors.svelte
Other components
- Tauri App
- TPM 2.0
- Apple Hardware
- StrongBox / TEE
Connections 27
- Tauri App → JS Bindings: calls
- JS Bindings → Command Dispatch: invokes commands
- Command Dispatch → Key Commands: dispatches
- Key Commands → Validation: validates input
- Key Commands → API Models: uses request/response
- Key Commands → Error Handling: sanitizes failures
- Key Commands → Desktop Backend: uses desktop backend
- Key Commands → Mobile Backend: uses mobile backend
- Desktop Backend → Windows TPM: routes on Windows
- Windows TPM → Windows Hello: uses authentication
- Windows TPM → Windows Handles: manages handles
- Windows TPM → TPM 2.0: uses hardware keys
- Mobile Backend → Apple Plugin: dispatches on Apple
- Apple Plugin → Secure Enclave: calls key operations
- Secure Enclave → Apple Hardware: uses Secure Enclave
- Mobile Backend → Android Keystore: dispatches on Android
- Android Keystore → StrongBox / TEE: uses hardware keystore
- Demo UI → JS Bindings: calls API
- Demo UI → Key Manager: renders
- Demo UI → Sign / Verify: renders
- Demo UI → Hardware Status: renders
- Demo UI → Integration Tests: renders
- Demo UI → Test Vectors: renders
- Key Manager → JS Bindings: manages keys
- Sign / Verify → JS Bindings: signs and verifies
- Hardware Status → JS Bindings: checks support
- Integration Tests → JS Bindings: exercises API