aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/command/client/store/verify.rs
blob: a39227f988f04d0062d5cb35727fce6ef00ca7f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use clap::Args;
use eyre::Result;

use crate::atuin_client::{
    encryption::load_key, record::sqlite_store::SqliteStore, settings::Settings,
};

#[derive(Args, Debug)]
pub(crate) struct Verify {}

impl Verify {
    pub(crate) async fn run(&self, settings: &Settings, store: SqliteStore) -> Result<()> {
        println!("Verifying local store can be decrypted with the current key");

        let key = load_key(settings)?;

        match store.verify(&key.into()).await {
            Ok(()) => println!("Local store encryption verified OK"),
            Err(e) => println!("Failed to verify local store encryption: {e:?}"),
        }

        Ok(())
    }
}