use serde::Deserialize;
use serde_json::{Value, json};
use crate::error::RpcError;
use crate::server::SharedConfium;
#[derive(Deserialize)]
struct HashCreateParams {
algorithm: String,
#[serde(default)]
provider: Option<String>,
}
pub async fn hash_create(
cfm: SharedConfium,
_params: Value,
) -> std::result::Result<Value, RpcError> {
let p: HashCreateParams =
serde_json::from_value(_params).map_err(|e| RpcError::InvalidParams {
detail: e.to_string(),
})?;
let cfm = cfm.borrow();
let _hash = confium_core::hash::Hash::new(&cfm, &p.algorithm, p.provider.as_deref(), None)
.map_err(|e| RpcError::Engine {
message: e.to_string(),
})?;
Ok(json!({ "handle": "<pending>" }))
}
pub async fn hash_update(
_cfm: SharedConfium,
_params: Value,
) -> std::result::Result<Value, RpcError> {
Err(RpcError::Engine {
message: "hash_update requires per-connection handle management (pending)".to_string(),
})
}
pub async fn hash_finalize(
_cfm: SharedConfium,
_params: Value,
) -> std::result::Result<Value, RpcError> {
Err(RpcError::Engine {
message: "hash_finalize requires per-connection handle management (pending)".to_string(),
})
}