2024 edition
This commit is contained in:
@ -12,10 +12,10 @@ crate::export_handlers!(
|
||||
|
||||
use crate::{
|
||||
entity::locale::LocaleType,
|
||||
errors::{handle_error, InvalidCommand},
|
||||
errors::{InvalidCommand, handle_error},
|
||||
locales::LocaleTypeExt,
|
||||
};
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD as B64_ENGINE, Engine as _};
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD_NO_PAD as B64_ENGINE};
|
||||
use teloxide::types::{CallbackQuery, MaybeInaccessibleMessage};
|
||||
|
||||
type NameHash = Vec<u8>;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::entity::account::Account;
|
||||
use chacha20poly1305::{AeadCore, AeadInPlace, ChaCha20Poly1305, KeyInit};
|
||||
use pbkdf2::pbkdf2_hmac_array;
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
use sha2::Sha256;
|
||||
|
||||
pub struct Cipher {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::entity::master_pass::MasterPass;
|
||||
use rand::{rngs::OsRng, RngCore};
|
||||
use scrypt::{scrypt, Params};
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
use scrypt::{Params, scrypt};
|
||||
use std::sync::LazyLock;
|
||||
use subtle::ConstantTimeEq;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use arrayvec::ArrayString;
|
||||
use rand::{seq::SliceRandom, thread_rng, CryptoRng, Rng};
|
||||
use rand::{CryptoRng, Rng, seq::SliceRandom, thread_rng};
|
||||
use std::array;
|
||||
|
||||
const CHARS: &[u8] = br##"!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~"##;
|
||||
@ -60,8 +60,8 @@ where
|
||||
|
||||
#[must_use]
|
||||
#[allow(clippy::module_name_repetitions)]
|
||||
pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>(
|
||||
) -> [ArrayString<LENGTH>; AMOUNT] {
|
||||
pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>()
|
||||
-> [ArrayString<LENGTH>; AMOUNT] {
|
||||
let mut rng = thread_rng();
|
||||
array::from_fn(|_| generate_password(&mut rng))
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
};
|
||||
use teloxide::{
|
||||
adaptors::throttle::Limits,
|
||||
dispatching::{dialogue::InMemStorage, filter_command, DefaultKey},
|
||||
dispatching::{DefaultKey, dialogue::InMemStorage, filter_command},
|
||||
dptree::{case, deps},
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{errors::NoUserInfo, prelude::*};
|
||||
use std::sync::Arc;
|
||||
use teloxide::{
|
||||
dispatching::{dialogue::GetChatId, DpHandlerDescription},
|
||||
dispatching::{DpHandlerDescription, dialogue::GetChatId},
|
||||
dptree::Handler,
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@ pub mod account;
|
||||
pub mod locale;
|
||||
pub mod master_pass;
|
||||
|
||||
pub use sqlx::{mysql::MySqlPool as Pool, Result};
|
||||
pub use sqlx::{Result, mysql::MySqlPool as Pool};
|
||||
|
||||
pub async fn migrate(pool: &Pool) -> Result<(), sqlx::migrate::MigrateError> {
|
||||
sqlx::migrate!().run(pool).await
|
||||
|
@ -1,6 +1,6 @@
|
||||
use super::Pool;
|
||||
use futures::{Stream, TryStreamExt};
|
||||
use sqlx::{query, query_as, Executor, FromRow, MySql};
|
||||
use sqlx::{Executor, FromRow, MySql, query, query_as};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, FromRow, Default)]
|
||||
pub struct Account {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::{locale::LocaleType, Pool};
|
||||
use sqlx::{prelude::FromRow, query, query_as, Executor, MySql};
|
||||
use super::{Pool, locale::LocaleType};
|
||||
use sqlx::{Executor, MySql, prelude::FromRow, query, query_as};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, FromRow, Eq)]
|
||||
pub struct MasterPass {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use std::fmt::{Debug, Display};
|
||||
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
|
||||
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
|
||||
|
||||
#[derive(derive_more::Error, derive_more::Display, Debug)]
|
||||
#[display("No user info found")]
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::prelude::*;
|
||||
use base64::{engine::general_purpose::STANDARD_NO_PAD as B64_ENGINE, Engine as _};
|
||||
use base64::{Engine as _, engine::general_purpose::STANDARD_NO_PAD as B64_ENGINE};
|
||||
use itertools::Itertools;
|
||||
use sha2::{Digest, Sha256};
|
||||
use teloxide::types::{InlineKeyboardButton, InlineKeyboardMarkup};
|
||||
|
@ -1,6 +1,6 @@
|
||||
pub use crate::{
|
||||
cryptography::{account::Decrypted as DecryptedAccount, validate_field},
|
||||
entity::{account::Account, master_pass::MasterPass, Pool},
|
||||
entity::{Pool, account::Account, master_pass::MasterPass},
|
||||
errors::handle_error,
|
||||
first_handler, handler,
|
||||
locales::LocaleRef,
|
||||
|
Reference in New Issue
Block a user