diff --git a/wasm_app/src/vault_bindings.rs b/wasm_app/src/vault_bindings.rs index e38e4fd..95ecfee 100644 --- a/wasm_app/src/vault_bindings.rs +++ b/wasm_app/src/vault_bindings.rs @@ -270,6 +270,22 @@ pub async fn sign(message: &[u8]) -> Result { } } +/// Get the current keyspace name +#[wasm_bindgen] +pub fn get_current_keyspace_name() -> Result { + SESSION_MANAGER.with(|cell| { + if let Some(session) = cell.borrow().as_ref() { + if let Some(keyspace_name) = session.current_keyspace_name() { + Ok(keyspace_name.to_string()) + } else { + Err(JsValue::from_str("No keyspace unlocked")) + } + } else { + Err(JsValue::from_str("Session not initialized")) + } + }) +} + /// Sign message with default keypair (first keypair in keyspace) without changing session state #[wasm_bindgen] pub async fn sign_with_default_keypair(message: &[u8]) -> Result {