Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(security): use schema_support for key generation

Steven Enamakelaeb8fc3bd855
diff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rs
index d003638198..c1d5920cc3 100644
--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs
+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs
@@ -449,7 +449,7 @@ impl ApprovalGate {
}
}
- let request_id = tinystoragedrivers::Key::ulid().as_str().to_owned();
+ let request_id = crate::storage::schema_support::fresh_key();
let now = chrono::Utc::now();
// Routes key on the tenant (profile and agent), so two SaaS profiles'
// default agents, which carry no agent id, never share one.
diff --git a/crates/openhuman-core/src/security/approval/store_documents.rs b/crates/openhuman-core/src/security/approval/store_documents.rs
index 8fb918a997..3f9557c22e 100644
--- a/crates/openhuman-core/src/security/approval/store_documents.rs
+++ b/crates/openhuman-core/src/security/approval/store_documents.rs
@@ -31,9 +31,10 @@ use serde_json::{json, Value};
use crate::config::Config;
use crate::storage::documents::compare_and_swap;
use crate::storage::local;
+use crate::storage::schema_support::fresh_key;
use crate::storage::{block_on, DocumentStore, DocumentStoreExt, Storage, StorageError};
use tinystoragedrivers::{
- CollectionSpec, ErrorKind, Filter, Key, Precondition, Query, Sort, Versioned,
+ CollectionSpec, ErrorKind, Filter, Precondition, Query, Sort, Versioned,
};
#[cfg(feature = "legacy-import")]
@@ -242,7 +243,7 @@ impl Docs {
"decided_ms": now,
"decision": decision.as_str(),
});
- let id = Key::ulid().as_str().to_owned();
+ let id = fresh_key();
self.run(|docs| async move {
docs.put(APPROVALS, &id, doc, Precondition::Absent)
.await