chore: 更新 rust 依赖 (#391)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-07-11 20:44:38 +08:00
committed by GitHub
parent 2837bb5234
commit c8f7a2267d
4 changed files with 354 additions and 222 deletions

View File

@@ -100,7 +100,7 @@ JNrRuoEUXpabUzGB8QIDAQAB
.expect("fail to decode public key");
let ts = chrono::Local::now().timestamp_millis();
let data = format!("refresh_{}", ts).into_bytes();
let mut rng = rand::rngs::OsRng;
let mut rng = rand::rng();
let encrypted = key
.encrypt(&mut rng, Oaep::new::<Sha256>(), &data)
.expect("fail to encrypt");

View File

@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::seq::IndexedRandom;
pub(super) fn default_time_format() -> String {
"%Y-%m-%d".to_string()
@@ -7,7 +7,7 @@ pub(super) fn default_time_format() -> String {
/// 默认的 auth_token 实现,生成随机 16 位字符串
pub(super) fn default_auth_token() -> String {
let byte_choices = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=";
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
(0..16)
.map(|_| *(byte_choices.choose(&mut rng).expect("choose byte failed")) as char)
.collect()