diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f075a9b..9610fb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: Cargo Build & Test on: push: - branches: ["main"] + branches: ["master"] pull_request: - branches: ["main"] + branches: ["master"] env: CARGO_TERM_COLOR: always diff --git a/src/crypto.rs b/src/crypto.rs index 9e4e1c2..b2fdcfc 100755 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -4,6 +4,7 @@ use aes_gcm::{ aes::Aes256, Aes256Gcm, AesGcm, KeyInit, Nonce, }; +use rand::{distributions::Alphanumeric, Rng}; use rand::{rngs::OsRng, RngCore}; use std::{error::Error, path::Path}; use tokio::{ @@ -87,6 +88,14 @@ pub fn try_hash(path: &String) -> Result> { Ok(hash) } +pub fn keygen() -> String { + rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(8) + .map(char::from) + .collect::() +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/listener.rs b/src/listener.rs index a36afa1..92b4c47 100755 --- a/src/listener.rs +++ b/src/listener.rs @@ -2,7 +2,6 @@ use crate::{ common::{Connection, Message}, comms, crypto, }; -use rand::{distributions::Alphanumeric, Rng}; use std::{collections::HashMap, error::Error, net::SocketAddr, path::PathBuf, str::FromStr}; use tokio::{ fs::File, @@ -218,11 +217,3 @@ impl Listener { Ok(()) } } - -pub fn keygen() -> String { - rand::thread_rng() - .sample_iter(&Alphanumeric) - .take(8) - .map(char::from) - .collect::() -}