use freetsa::prelude::*;
use std::{fs::OpenOptions, io::Write};
#[tokio::main]
async fn main() {
let TimestampResponse { query: _, reply } = timestamp_file("Cargo.toml").await.unwrap();
let mut reply_file = OpenOptions::new()
.create(true)
.write(true)
.open("./example.tsr")
.unwrap();
reply_file.write_all(&reply).unwrap();
reply_file.flush().unwrap();
println!("Download cacert.pem and tsa.crt from https://freetsa.org, then");
println!("run `openssl ts -verify -in example.tsr -data Cargo.toml -CAfile cacert.pem -untrusted tsa.crt`");
}