docs: documented most of the code

This commit is contained in:
Даниил 2024-03-08 23:07:10 +04:00
parent e367930505
commit e4287bb2ac
Signed by: nm17
GPG key ID: 3303B70C59145CD4
18 changed files with 223 additions and 191 deletions

View file

@ -1,3 +1,5 @@
//! Сборник утилит для работы с Redis.
use crate::web_server::app_error::AppError;
use fred::prelude::*;
use heapless::String as HeaplessString;
@ -6,13 +8,17 @@ use regex::Regex;
use ufmt::uwrite;
lazy_static! {
/// Разрешённые знаки для API ключа.
static ref ALLOWED_API_KEY_CHARACTERS: Regex = Regex::new("[a-zA-Z0-9]{13}").unwrap();
}
/// Описание полей в KV DB у `apikey_{}`.
pub struct ApiKeyDescription {
/// ID владельца API ключа.
apikey_owner: i64,
}
/// Проверка API ключа на валидность.
pub async fn is_api_key_valid(
client: &RedisClient,
api_key: &str,