keygen to crypto module & fixed CI branch naming
This commit is contained in:
parent
f1bb0049da
commit
66dec81364
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -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
|
||||
|
@ -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<String, Box<dyn Error + Send + Sync>> {
|
||||
Ok(hash)
|
||||
}
|
||||
|
||||
pub fn keygen() -> String {
|
||||
rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(8)
|
||||
.map(char::from)
|
||||
.collect::<String>()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -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::<String>()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user