Skip to main content

krust/commands/
oobi.rs

1use anyhow::{Context, Result};
2
3use super::hab;
4
5/// `krust oobi resolve` (kli `oobi resolve`): fetch an OOBI and ingest the KEL
6/// and signed endpoint replies it serves.
7pub async fn handle_resolve(name: &str, oobi_alias: &str, oobi: &str) -> Result<()> {
8    let mut hby = hab::open(name, None)?;
9    let stream = libkeri_http::Client::new()
10        .get_oobi(oobi)
11        .await
12        .with_context(|| format!("Failed to fetch OOBI {}", oobi))?;
13    let n = hby
14        .ingest(&stream, false)
15        .with_context(|| format!("Failed to process OOBI {}", oobi))?;
16    println!("{} succeeded ({} messages, alias {})", oobi, n, oobi_alias);
17    Ok(())
18}