The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
style: apply rustfmt formatting to security and storage modules
Steven Enamakelda2b516c35be
diff --git a/crates/openhuman-core/src/security/credentials/profiles/persistence.rs b/crates/openhuman-core/src/security/credentials/profiles/persistence.rsindex 66c376b4b6..de92710429 100644--- a/crates/openhuman-core/src/security/credentials/profiles/persistence.rs+++ b/crates/openhuman-core/src/security/credentials/profiles/persistence.rs@@ -18,7 +18,6 @@ use super::{PERSIST_RETRY_BASE_MS, PROFILES_FILENAME,};-/// The secret the profiles live in on a storage backend/// ([`crate::storage::secrets`]): the same JSON as `auth-profiles.json`,/// encrypted as one secret in the acting agent's scope.diff --git a/crates/openhuman-core/src/security/keyring/crypto.rs b/crates/openhuman-core/src/security/keyring/crypto.rsindex d1e2570b10..37d7f60afa 100644--- a/crates/openhuman-core/src/security/keyring/crypto.rs+++ b/crates/openhuman-core/src/security/keyring/crypto.rs@@ -14,8 +14,7 @@ pub(super) const KEY_LEN: usize = 32;/// The cipher is `tinystoragedrivers`' (`secrets::crypto`), the same format/// its secret stores read and write.pub(super) fn chacha20_encrypt(key: &[u8; KEY_LEN], plaintext: &[u8]) -> Result<Vec<u8>, String> {- secrets_crypto::encrypt(key, plaintext)- .map_err(|e| format!("ChaCha20 encryption failed: {e}"))+ secrets_crypto::encrypt(key, plaintext).map_err(|e| format!("ChaCha20 encryption failed: {e}"))}/// Decrypt a `nonce || ciphertext || tag` blob produced by [`chacha20_encrypt`].diff --git a/crates/openhuman-core/src/security/keyring/ops.rs b/crates/openhuman-core/src/security/keyring/ops.rsindex 6614441fc0..0b4c488668 100644--- a/crates/openhuman-core/src/security/keyring/ops.rs+++ b/crates/openhuman-core/src/security/keyring/ops.rs@@ -47,8 +47,7 @@ pub enum MigrationOutcome {// belong to this process, not to an agent./// The storage-backed secret store for this call, when one is configured.-fn storage_secrets(-) -> Result<Option<tinystoragedrivers::secrets::DocumentSecrets>, KeyringError> {+fn storage_secrets() -> Result<Option<tinystoragedrivers::secrets::DocumentSecrets>, KeyringError> {crate::storage::secrets::current().map_err(|error| KeyringError::Backend(format!("storage secrets: {error}")))}@@ -69,8 +68,8 @@ pub fn get(user_id: &str, key: &str) -> Result<Option<String>, KeyringError> {};log::debug!("[keyring] get (storage) user_id={user_id} key={key}");let name = namespaced_key(user_id, key);- let value = crate::storage::block_on(async move { secrets.get(&name).await })- .map_err(storage_error)?;+ let value =+ crate::storage::block_on(async move { secrets.get(&name).await }).map_err(storage_error)?;value.map(|bytes| {String::from_utf8(bytes.to_vec()).map_err(|source| KeyringError::InvalidUtf8 {@@ -91,8 +90,7 @@ pub fn set(user_id: &str, key: &str, value: &str) -> Result<(), KeyringError> {log::debug!("[keyring] set (storage) user_id={user_id} key={key}");let name = namespaced_key(user_id, key);let value = zeroize::Zeroizing::new(value.as_bytes().to_vec());- crate::storage::block_on(async move { secrets.set(&name, &value).await })- .map_err(storage_error)+ crate::storage::block_on(async move { secrets.set(&name, &value).await }).map_err(storage_error)}/// Delete a secret: from the storage backend when one is configured, else@@ -110,7 +108,6 @@ pub fn delete(user_id: &str, key: &str) -> Result<(), KeyringError> {// ── Process backend ───────────────────────────────────────────────────────────-/// Retrieve a secret from the process backend.////// Returns `Ok(None)` when no entry exists for this user + key combination.diff --git a/crates/openhuman-core/src/storage/secrets_tests.rs b/crates/openhuman-core/src/storage/secrets_tests.rsindex d3a1e2b14a..57b295c901 100644--- a/crates/openhuman-core/src/storage/secrets_tests.rs+++ b/crates/openhuman-core/src/storage/secrets_tests.rs@@ -6,7 +6,10 @@ fn keys(byte: u8) -> Arc<dyn KeyProvider> {}fn secrets_in(storage: &MemoryStorage, scope: &str, key: u8) -> DocumentSecrets {- over(&storage.for_scope(&Scope::new(scope).unwrap()).unwrap(), keys(key))+ over(+ &storage.for_scope(&Scope::new(scope).unwrap()).unwrap(),+ keys(key),+ )}#[test]@@ -16,7 +19,10 @@ fn a_secret_round_trips_from_sync_code() {assert!(get_blocking(&secrets, "user:token").unwrap().is_none());set_blocking(&secrets, "user:token", b"s3cret").unwrap();assert_eq!(- get_blocking(&secrets, "user:token").unwrap().unwrap().as_slice(),+ get_blocking(&secrets, "user:token")+ .unwrap()+ .unwrap()+ .as_slice(),b"s3cret");}@@ -40,7 +46,12 @@ fn scopes_and_keys_keep_secrets_apart() {#[test]fn the_stored_document_holds_no_plaintext() {let storage = MemoryStorage::new();- set_blocking(&secrets_in(&storage, "local", 7), "user:token", b"plain-value").unwrap();+ set_blocking(+ &secrets_in(&storage, "local", 7),+ "user:token",+ b"plain-value",+ )+ .unwrap();let docs = storage.for_scope(&Scope::new("local").unwrap()).unwrap()