perf(crypto): native Argon2id via dryoc — 6x faster vault unlock
Phase A of the crypto/livekit rust-native migration. Rust side - dryoc crate (pure-rust libsodium-compat, no C toolchain) - Tauri commands: crypto_random_bytes, crypto_secretbox_encrypt/decrypt, crypto_box_keypair, crypto_box_encrypt/decrypt, crypto_box_seal/open, crypto_pwhash — all bit-compatible with libsodium-wrappers-sumo - Commands registered via invoke_handler in lib.rs - All IPC payloads base64-encoded to survive serde_json JS side - lib/nativeCryptoOps.ts exposes pwhashArgon2id + randomBytesAsync plus optional secretbox accelerators for future call-site migration - Native-first, WASM fallback on error or when VITE_USE_NATIVE_CRYPTO is false / in browser preview - Argon2id call-sites migrated: secureFileStore.deriveKey and deviceBackup.deriveKey (covers vault unlock + backup/recovery flows) Impact - Vault unlock: ~1200ms → ~200ms (measured locally, Argon2id moderate) - Per-message AEAD left on WASM-worker path: IPC overhead ~40µs would dominate any native speedup below ~100µs/op - WASM stays installed as graceful fallback so browser-preview builds keep working and a native failure self-heals at runtime
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
mod crypto;
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
use tauri::{
|
||||
menu::{Menu, MenuEvent, MenuItem, PredefinedMenuItem},
|
||||
@@ -48,6 +50,17 @@ fn handle_menu_event(app: &AppHandle, event: MenuEvent) {
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let mut builder = tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
crypto::crypto_random_bytes,
|
||||
crypto::crypto_secretbox_encrypt,
|
||||
crypto::crypto_secretbox_decrypt,
|
||||
crypto::crypto_box_keypair,
|
||||
crypto::crypto_box_encrypt,
|
||||
crypto::crypto_box_decrypt,
|
||||
crypto::crypto_box_seal,
|
||||
crypto::crypto_box_seal_open,
|
||||
crypto::crypto_pwhash,
|
||||
])
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_sql::Builder::default().build())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
|
||||
Reference in New Issue
Block a user