Implement complete Android settings and recovery controls (#104)
Android ARM verification / rust (push) Failing after 46m46s
Android ARM verification / android (push) Failing after 7s
Dependency security audit / rustsec (push) Successful in 22s

This commit is contained in:
hugo committed 2026-10-10 12:07:28 +02:00
1 parent 06575363a2
commit 43f660ace3
34 files changed
+2720 -64

No files matched your search

+72 -1
View File
@@ -35,6 +35,11 @@ fn mobile_context_uses_injected_os_backend_clock_and_lifecycle_without_global_co
};
let fixture = FixtureSet::load()?;
let vault = fixture.materialize_store("basic")?;
let repository = Repository::open(vault.path())?;
ironstorage::git::GitRepository::init(
&repository,
ironstorage::git::GitIdentity::new("Original", "original@example.test")?,
)?;
let root = tempfile::tempdir()?;
let source = root.path().join("config.toml");
std::fs::write(
@@ -69,7 +74,22 @@ fn mobile_context_uses_injected_os_backend_clock_and_lifecycle_without_global_co
1,
"preferences must use the injected backend"
);
authentication.set_authentication_timeout(30)?;
let original = std::fs::read(&source)?;
for value in ["not a number", "-1", "0", "86401", "18446744073709551616"] {
assert!(
authentication
.set_authentication_timeout_text(value)
.is_err()
);
assert_eq!(std::fs::read(&source)?, original);
}
assert!(
authentication
.set_git_identity("valid".to_owned(), "invalid\nemail".to_owned())
.is_err()
);
assert_eq!(std::fs::read(&source)?, original);
authentication.set_authentication_timeout_text(" 30 ")?;
authentication.unlock_entry(
"email/personal",
Some(SecretBytes::new(
@@ -108,6 +128,57 @@ fn mobile_context_uses_injected_os_backend_clock_and_lifecycle_without_global_co
assert!(authentication.entry_editor(editor.id()).is_err());
}
let baseline_locks = backend.locks();
let identity = authentication.set_git_identity(
"Android settings author".to_owned(),
"android-settings@example.test".to_owned(),
)?;
authentication.unlock_entry(
"email/personal",
Some(SecretBytes::new(
fixture.key("alice")?.passphrase.as_bytes().to_vec(),
)),
)?;
let editor = authentication.begin_entry_editor("email/personal")?;
let id = editor.page().fields()[0].id();
authentication.discard_entry_editor(editor.id())?;
authentication.replace_entry_field(
"email/personal",
id,
"public-settings-password".to_owned(),
)?;
let git = ironstorage::git::GitRepository::open(&repository, identity)?;
let commits = git.log(Some(1))?;
assert_eq!(commits[0].author_name(), "Android settings author");
assert_eq!(commits[0].author_email(), "android-settings@example.test");
let store = SecretStore::new(
backend.clone(),
SecretCachePolicy::Disabled,
SecretProtectionPolicy::device_unlocked(),
);
store.unlock()?;
let configured = Config::load(Some(&source))?;
let (server, application) = configured.git_remotes()[0].https_credentials().unwrap();
store.store_https_git_credential(
server,
application,
"public-settings-account",
SecretBytes::new(b"public-settings-token".to_vec()),
)?;
store.lock()?;
assert_eq!(
authentication
.preferences(false, false, false)?
.application_account(),
Some("public-settings-account")
);
authentication.remove_application_token()?;
assert_eq!(
authentication
.preferences(false, false, false)?
.application_account(),
None
);
authentication.remove_application_token()?;
drop(authentication);
assert!(
backend.locks() > baseline_locks,