mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
Encode key in base64 instead of hexa
This commit is contained in:
parent
94b32cce01
commit
7652295d2c
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1973,6 +1973,7 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
||||
name = "meilisearch-auth"
|
||||
version = "0.27.1"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"enum-iterator",
|
||||
"meilisearch-error",
|
||||
"milli",
|
||||
|
@ -11,6 +11,7 @@ rand = "0.8.4"
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
serde_json = { version = "1.0.79", features = ["preserve_order"] }
|
||||
sha2 = "0.10.2"
|
||||
base64 = "0.13.0"
|
||||
thiserror = "1.0.30"
|
||||
time = { version = "0.3.7", features = ["serde-well-known", "formatting", "parsing", "macros"] }
|
||||
uuid = { version = "0.8.2", features = ["serde", "v4"] }
|
||||
|
@ -238,7 +238,7 @@ impl<'a> milli::heed::BytesEncode<'a> for KeyIdActionCodec {
|
||||
pub fn generate_key(uid: &[u8], master_key: &[u8]) -> String {
|
||||
let key = [uid, master_key].concat();
|
||||
let sha = Sha256::digest(&key);
|
||||
format!("{:x}", sha)
|
||||
base64::encode_config(sha, base64::URL_SAFE_NO_PAD)
|
||||
}
|
||||
|
||||
/// Divides one slice into two at an index, returns `None` if mid is out of bounds.
|
||||
|
Loading…
Reference in New Issue
Block a user