Get rid of rust-crypto and uuid

This commit is contained in:
Clément Renault 2019-10-31 15:24:47 +01:00
parent c2a12b661a
commit db898001eb
2 changed files with 8 additions and 8 deletions

View File

@ -22,13 +22,12 @@ main_error = "0.1.0"
meilidb-core = { path = "../meilidb-core", version = "0.6.0" }
meilidb-schema = { path = "../meilidb-schema", version = "0.6.0" }
pretty-bytes = "0.2.2"
rand = "0.7.2"
rayon = "1.2.0"
rust-crypto = "0.2.36"
serde = { version = "1.0.101", features = ["derive"] }
serde_json = { version = "1.0.41", features = ["preserve_order"] }
structopt = "0.3.3"
sysinfo = "0.9.5"
uuid = { version = "0.8.1", features = ["v4"] }
walkdir = "2.2.9"
[dependencies.async-compression]

View File

@ -1,13 +1,11 @@
use chrono::serde::ts_seconds;
use chrono::{DateTime, Utc};
use crypto::digest::Digest;
use crypto::sha1::Sha1;
use heed::types::{SerdeBincode, Str};
use http::StatusCode;
use rand::seq::SliceRandom;
use serde::{Deserialize, Serialize};
use tide::response::IntoResponse;
use tide::{Context, Response};
use uuid::Uuid;
use crate::error::{ResponseError, SResult};
use crate::helpers::tide::ContextExt;
@ -16,9 +14,12 @@ use crate::models::token::*;
use crate::Data;
fn generate_api_key() -> String {
let mut hasher = Sha1::new();
hasher.input_str(&Uuid::new_v4().to_string());
hasher.result_str().to_string()
let mut rng = rand::thread_rng();
let sample = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
sample
.choose_multiple(&mut rng, 40)
.map(|c| *c as char)
.collect()
}
pub async fn list(ctx: Context<Data>) -> SResult<Response> {