Synced app settings: colour theme and appearance (beta)
One encrypted settings item per account (a secure note carrying app_settings, at a fixed per-account id) holds the theme and light/dark appearance, so it syncs like any item and the server can't read it. Lists hide it; older apps see a note that explains itself. app_theme / set_app_theme in kv-ffi and kv-wasm. Also fixes a flaky test that checked random ciphertext for the letters K1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -51,6 +51,9 @@ export interface SignInWith { provider: string; account?: string | null; }
|
||||
|
||||
export interface SignInProvider { id: string; name: string; }
|
||||
|
||||
/** Synced theme (docs/02 "App settings"): a theme id such as "ocean", and "system" | "light" | "dark". */
|
||||
export interface AppThemeDto { theme: string | null; appearance: string | null; }
|
||||
|
||||
/** `id: ""` creates a new item. Omitted optional fields default to null / [] / false / 0. */
|
||||
export interface ItemDto {
|
||||
id: string;
|
||||
@@ -525,6 +528,17 @@ impl VaultCore {
|
||||
self.run(|s| async move { s.core.list_items() })
|
||||
}
|
||||
|
||||
/// The colour theme and appearance synced across this account's devices.
|
||||
#[wasm_bindgen(js_name = appTheme, unchecked_return_type = "Promise<AppThemeDto>")]
|
||||
pub fn app_theme(&self) -> Promise {
|
||||
self.run(|s| async move { s.core.app_theme() })
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = setAppTheme, unchecked_return_type = "Promise<void>")]
|
||||
pub fn set_app_theme(&self, theme: Option<String>, appearance: Option<String>) -> Promise {
|
||||
self.run(move |s| async move { s.core.set_app_theme(theme, appearance) })
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = getItem, unchecked_return_type = "Promise<ItemDto>")]
|
||||
pub fn get_item(&self, id: String) -> Promise {
|
||||
self.run(move |s| async move { s.core.get_item(&id) })
|
||||
|
||||
Reference in New Issue
Block a user