feat(wave-1): 适配器框架与安全基座(schema校验/dry-run/exec沙箱/密钥库/日志脱敏/字段拆分)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//! 密钥库抽象接口(架构 §4.1)
|
||||
|
||||
use crate::error::SecretStoreError;
|
||||
|
||||
/// 系统密钥库封装接口。`service` 固定前缀 `agentdock.<cli_id>`,
|
||||
/// `account` 为字段 id(如 `api_key`)。
|
||||
pub trait SecretStore: Send + Sync {
|
||||
/// 写入密钥。
|
||||
fn set(&self, service: &str, account: &str, secret: &str) -> Result<(), SecretStoreError>;
|
||||
/// 读取密钥。
|
||||
fn get(&self, service: &str, account: &str) -> Result<String, SecretStoreError>;
|
||||
/// 是否存在该密钥条目。
|
||||
fn has(&self, service: &str, account: &str) -> bool;
|
||||
/// 删除密钥条目。
|
||||
fn delete(&self, service: &str, account: &str) -> Result<(), SecretStoreError>;
|
||||
}
|
||||
|
||||
/// 构造 service 名:`agentdock.<cli_id>`。
|
||||
pub fn service_name(cli_id: &str) -> String {
|
||||
format!("agentdock.{cli_id}")
|
||||
}
|
||||
Reference in New Issue
Block a user