Parent issue: #773
We generate random 32-char keys like this: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, with only alphanumeric chars.
This is the statement we use to generate the keys:
let random_id: String = thread_rng()
.sample_iter(&Alphanumeric)
.take(AUTH_KEY_LENGTH)
.map(char::from)
.collect();
And this is the Key struct.
/// A randomly generated token used for authentication.
///
/// It contains lower and uppercase letters and numbers.
/// It's a 32-char string.
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone, Display, Hash)]
pub struct Key(String);
After merging this PR, it will be possible to upload preexisting keys. The uploaded keys should have the same restrictions:
- 32 chars
- Only alphanumeric chars: a-z, A-Z and 0-9.
However, the Key struct does not enforce these restrictions. It only checks that the string length is 32. That will allow uploading keys like this: %QEs2ZNcCm9cwEV9dBpcPB5OwNFWFiRd, which is not a valid key.
Parent issue: #773
We generate random 32-char keys like this:
YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, with only alphanumeric chars.This is the statement we use to generate the keys:
And this is the
Keystruct.After merging this PR, it will be possible to upload preexisting keys. The uploaded keys should have the same restrictions:
However, the
Keystruct does not enforce these restrictions. It only checks that the string length is 32. That will allow uploading keys like this:%QEs2ZNcCm9cwEV9dBpcPB5OwNFWFiRd, which is not a valid key.