feat: add VC verification status to federation node list
- federation.list-nodes now includes vc_verified: bool per node - True when a non-revoked FederationTrustCredential exists for the peer DID - Integrates with VC-02's automatic VC issuance on federation join Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,10 +146,26 @@ impl RpcHandler {
|
||||
}))
|
||||
}
|
||||
|
||||
/// federation.list-nodes — List all federated nodes with their status and last state.
|
||||
/// federation.list-nodes — List all federated nodes with their status, last state, and VC verification.
|
||||
pub(super) async fn handle_federation_list_nodes(&self) -> Result<serde_json::Value> {
|
||||
let nodes = federation::load_nodes(&self.config.data_dir).await?;
|
||||
|
||||
// Load credentials to check for federation VCs
|
||||
let cred_store = credentials::load_credentials(&self.config.data_dir).await.ok();
|
||||
let vc_subjects: std::collections::HashSet<String> = cred_store
|
||||
.as_ref()
|
||||
.map(|s| {
|
||||
s.credentials
|
||||
.iter()
|
||||
.filter(|vc| {
|
||||
vc.credential_type.iter().any(|t| t == "FederationTrustCredential")
|
||||
&& !credentials::is_revoked(vc)
|
||||
})
|
||||
.map(|vc| vc.credential_subject.id.clone())
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let nodes_json: Vec<serde_json::Value> = nodes
|
||||
.iter()
|
||||
.map(|n| {
|
||||
@@ -159,6 +175,7 @@ impl RpcHandler {
|
||||
"onion": n.onion,
|
||||
"trust_level": n.trust_level.to_string(),
|
||||
"added_at": n.added_at,
|
||||
"vc_verified": vc_subjects.contains(&n.did),
|
||||
});
|
||||
if let Some(name) = &n.name {
|
||||
obj["name"] = serde_json::json!(name);
|
||||
|
||||
Reference in New Issue
Block a user