trying to resolve conflict for nanorand pr
This commit is contained in:
parent
a1444cf478
commit
61b33d1613
|
@ -2075,6 +2075,33 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
name = "nanorand"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "729eb334247daa1803e0a094d0a5c55711b85571179f5ec6e53eccfdf7008958"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "native-tls"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"log 0.4.14",
|
||||||
|
"openssl",
|
||||||
|
"openssl-probe",
|
||||||
|
"openssl-sys",
|
||||||
|
"schannel",
|
||||||
|
"security-framework",
|
||||||
|
"security-framework-sys",
|
||||||
|
"tempfile",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
>>>>>>> nanorand
|
||||||
name = "nb"
|
name = "nb"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
@ -2494,16 +2521,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "peach-lib"
|
name = "peach-lib"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"env_logger 0.6.2",
|
|
||||||
"fslock",
|
"fslock",
|
||||||
"jsonrpc-client-core",
|
"jsonrpc-client-core",
|
||||||
"jsonrpc-client-http",
|
"jsonrpc-client-http",
|
||||||
"jsonrpc-core 8.0.1",
|
"jsonrpc-core 8.0.1",
|
||||||
"log 0.4.14",
|
"log 0.4.14",
|
||||||
"rand 0.8.4",
|
"nanorand",
|
||||||
"regex",
|
"regex",
|
||||||
"rust-crypto",
|
"rust-crypto",
|
||||||
"serde 1.0.130",
|
"serde 1.0.130",
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
[package]
|
[package]
|
||||||
name = "peach-lib"
|
name = "peach-lib"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
authors = ["Andrew Reid <glyph@mycelial.technology>"]
|
authors = ["Andrew Reid <glyph@mycelial.technology>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
chrono = "0.4.19"
|
||||||
|
fslock="0.1.6"
|
||||||
jsonrpc-client-core = "0.5"
|
jsonrpc-client-core = "0.5"
|
||||||
jsonrpc-client-http = "0.5"
|
jsonrpc-client-http = "0.5"
|
||||||
jsonrpc-core = "8.0.1"
|
jsonrpc-core = "8.0.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
log = "0.4"
|
||||||
|
nanorand = "0.6.1"
|
||||||
|
regex = "1"
|
||||||
rust-crypto = "0.2.36"
|
rust-crypto = "0.2.36"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_yaml = "0.8"
|
serde_yaml = "0.8"
|
||||||
|
<<<<<<< HEAD
|
||||||
regex = "1"
|
regex = "1"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
rand="0.8.4"
|
rand="0.8.4"
|
||||||
fslock="0.1.6"
|
fslock="0.1.6"
|
||||||
|
=======
|
||||||
|
>>>>>>> nanorand
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use std::iter;
|
|
||||||
|
|
||||||
use crypto::{digest::Digest, sha3::Sha3};
|
use crypto::{digest::Digest, sha3::Sha3};
|
||||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
use nanorand::{Rng, WyRand};
|
||||||
|
|
||||||
use crate::{config_manager, error::PeachError, sbot_client};
|
use crate::{config_manager, error::PeachError, sbot_client};
|
||||||
|
|
||||||
|
@ -68,13 +66,10 @@ pub fn verify_temporary_password(password: &str) -> Result<(), PeachError> {
|
||||||
/// Generates a temporary password and sends it via ssb dm
|
/// Generates a temporary password and sends it via ssb dm
|
||||||
/// to the ssb id configured to be the admin of the peachcloud device
|
/// to the ssb id configured to be the admin of the peachcloud device
|
||||||
pub fn send_password_reset() -> Result<(), PeachError> {
|
pub fn send_password_reset() -> Result<(), PeachError> {
|
||||||
// first generate a new random password of ascii characters
|
// initialise random number generator
|
||||||
let mut rng = thread_rng();
|
let mut rng = WyRand::new();
|
||||||
let temporary_password: String = iter::repeat(())
|
// generate a new password of random numbers
|
||||||
.map(|()| rng.sample(Alphanumeric))
|
let temporary_password = rng.generate::<u64>().to_string();
|
||||||
.map(char::from)
|
|
||||||
.take(10)
|
|
||||||
.collect();
|
|
||||||
// save this string as a new temporary password
|
// save this string as a new temporary password
|
||||||
set_new_temporary_password(&temporary_password)?;
|
set_new_temporary_password(&temporary_password)?;
|
||||||
let domain = config_manager::get_peachcloud_domain()?;
|
let domain = config_manager::get_peachcloud_domain()?;
|
||||||
|
|
Loading…
Reference in New Issue