sal-modular/vault/src/wasm_helpers.rs
Sameh Abouelsaad 13945a8725 feat: Add WASM support and browser extension infrastructure
- Add WASM build target and dependencies for all crates.
- Implement IndexedDB-based persistent storage for WASM.
- Create browser extension infrastructure (UI, scripting, etc.).
- Integrate Rhai scripting engine for secure automation.
- Implement user stories and documentation for the extension.
2025-05-16 15:31:53 +03:00

16 lines
589 B
Rust

//! WASM-specific helpers for Rhai bindings and session management
//! Provides global functions for Rhai integration in WASM builds.
#[cfg(target_arch = "wasm32")]
pub fn select_keypair_global(key_id: &str) -> Result<(), String> {
use crate::session_singleton::SESSION_MANAGER;
SESSION_MANAGER.with(|cell| {
let mut opt = cell.borrow_mut();
if let Some(session) = opt.as_mut() {
session.select_keypair(key_id).map_err(|e| format!("select_keypair error: {e}"))
} else {
Err("Session not initialized".to_string())
}
})
}