From 7f5310a1aa87cb32499e7f50c864fdaa9a82bd53 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Mon, 25 Apr 2022 07:13:30 +0100 Subject: history list (#340) --- atuin-client/src/sync.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'atuin-client/src/sync.rs') diff --git a/atuin-client/src/sync.rs b/atuin-client/src/sync.rs index 9e749614..23f552e5 100644 --- a/atuin-client/src/sync.rs +++ b/atuin-client/src/sync.rs @@ -3,13 +3,20 @@ use std::convert::TryInto; use chrono::prelude::*; use eyre::Result; -use atuin_common::{api::AddHistoryRequest, utils::hash_str}; +use atuin_common::api::AddHistoryRequest; use crate::api_client; use crate::database::Database; use crate::encryption::{encrypt, load_encoded_key, load_key}; use crate::settings::{Settings, HISTORY_PAGE_SIZE}; +pub fn hash_str(string: &str) -> String { + use sha2::{Digest, Sha256}; + let mut hasher = Sha256::new(); + hasher.update(string.as_bytes()); + hex::encode(hasher.finalize()) +} + // Currently sync is kinda naive, and basically just pages backwards through // history. This means newly added stuff shows up properly! We also just use // the total count in each database to indicate whether a sync is needed. -- cgit v1.3.1