second_brain_api/
identity_report.rs1use std::path::Path;
2
3use chrono::Utc;
4use second_brain_core::sqlite_store::SqliteStore;
5use second_brain_sync::keyring::Keyring;
6
7use crate::health::Health;
8
9pub fn report(sqlite: &SqliteStore, data_dir: &Path, health: &Health) {
10 match Keyring::load(sqlite, data_dir) {
11 Ok(keyring) => report_keyring(&keyring, health),
12 Err(e) => tracing::warn!("cannot read this device's sync identity: {e:#}"),
13 }
14}
15
16pub fn report_keyring(keyring: &Keyring<'_>, health: &Health) {
17 match keyring.status() {
18 Ok(status) => health.identity_checked(status, Utc::now()),
19 Err(e) => tracing::warn!("cannot read this device's sync identity: {e:#}"),
20 }
21}