feat(wasm): default_vault_settings_json() for wizard parity with CLI init

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-27 18:27:07 -04:00
parent 399a276fdd
commit 3aa17e6be2

View File

@@ -120,6 +120,16 @@ pub fn settings_encrypt(handle: &SessionHandle, settings_json: &str) -> Result<V
.map_err(|e| JsError::new(&e.to_string())) .map_err(|e| JsError::new(&e.to_string()))
} }
/// Returns the JSON for `VaultSettings::default()`. Used by the setup
/// wizard to encrypt and write a default settings.enc on new-vault setup.
/// Keeping this in WASM (instead of hand-encoding in TS) prevents drift
/// when the default VaultSettings shape changes in Rust.
#[wasm_bindgen]
pub fn default_vault_settings_json() -> Result<String, JsError> {
let s = VaultSettings::default();
serde_json::to_string(&s).map_err(|e| JsError::new(&e.to_string()))
}
// ── Task 20: attachment / generator / imgsecret / ID / TOTP bridges ───────── // ── Task 20: attachment / generator / imgsecret / ID / TOTP bridges ─────────
use relicario_core::{decrypt_attachment, encrypt_attachment, FieldId, ItemId}; use relicario_core::{decrypt_attachment, encrypt_attachment, FieldId, ItemId};