server_url / server_pins: the configured sync server, for the apps' Settings
ci / test (push) Canceled after 0s
ci / wasm (push) Canceled after 0s
ci / deny (push) Canceled after 0s
ci / fuzz (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-23 23:17:22 +07:00
co-authored by Claude Opus 5.5
parent 2e16892287
commit ead95bb605
2 changed files with 14 additions and 0 deletions
+11
View File
@@ -977,6 +977,17 @@ impl VaultCore {
self.store.get_meta(META_SESSION).ok().flatten().is_some()
}
/// The sync server this vault is configured with (`configure_server`, onboarding, sign-in), if any. The apps
/// show it in Settings; the core's copy is the one that counts.
pub fn server_url(&self) -> Option<String> {
self.lock_inner().server.as_ref().map(|s| s.url.clone())
}
/// The SPKI pins configured with [`Self::server_url`].
pub fn server_pins(&self) -> Vec<String> {
self.lock_inner().server.as_ref().map(|s| s.pins.clone()).unwrap_or_default()
}
/// Deletes the account (docs/03 "Deleting the account"; required by the App Store and Google Play): on the
/// sync server first when one is configured, then everything on this device. The master password is checked
/// again, so an unlocked but unattended device can't do it. A server that can't be reached fails the whole
+3
View File
@@ -679,11 +679,14 @@ async fn sign_out_device_keeps_the_account_on_the_server() {
let a = VaultCore::open(path.clone()).unwrap();
let sk = a.create_account(PW.into()).unwrap();
assert_eq!(a.server_url(), None);
connect(&a, &server);
assert_eq!(a.server_url(), Some(server.url()));
a.register_account(SETUP_TOKEN.into()).await.unwrap();
let id = a.save_item(login_item("Bank", "pw-a")).unwrap(); // not synced yet: sign-out syncs it first
a.sign_out_device(false).await.unwrap();
assert!(!a.has_account() && !a.is_logged_in());
assert_eq!(a.server_url(), None);
// Same device, signed in again: the item came back from the server.
connect(&a, &server);