Skip to content
Clone

chore(deps): add lib/pow-solver crate, update workspace deps and .gitignore

ZhenYi committed
parent 4b60253 commit 13582e8 Browse files

6 files changed

+574 −17

File tree 6
Added lib/pow-solver/src/challenge.rs View lib/pow-solver/src/challenge.rs
@@ -0,0 +1,102 @@
1use serde::{Deserialize, Serialize};
2use sha2::{Digest, Sha256};
3
4#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
5pub struct Challenge {
6 pub nonce: String,
7 pub difficulty: u32,
8 pub expires_at: i64,
9 #[serde(default, skip_serializing_if = "Option::is_none")]
10 pub mac: Option<String>,
11}
12
13impl Challenge {
14 pub fn is_expired(&self, now_secs: i64) -> bool {
15 now_secs >= self.expires_at
16 }
17}
18
19fn digest(nonce: &str, answer: u64) -> [u8; 32] {
20 Sha256::digest(format!("{nonce}:{answer}")).into()
21}
22
23fn has_leading_zero_bits(digest: &[u8; 32], difficulty: u32) -> bool {
24 if difficulty > 256 {
25 return false;
26 }
27 let full_bytes = (difficulty / 8) as usize;
28 let remaining_bits = (difficulty % 8) as usize;
29 if !digest[..full_bytes].iter().all(|&byte| byte == 0) {
30 return false;
31 }
32 remaining_bits == 0 || digest[full_bytes] >> (8 - remaining_bits) == 0
33}
34
35pub fn check(nonce: &str, difficulty: u32, answer: u64) -> bool {
36 has_leading_zero_bits(&digest(nonce, answer), difficulty)
37}
38
39pub fn solve(nonce: &str, difficulty: u32, max_attempts: u64) -> Option<u64> {
40 (0..max_attempts).find(|&answer| check(nonce, difficulty, answer))
41}
42
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn solve_produces_valid_answer() {
49 let nonce = "test-nonce";
50 let answer = solve(nonce, 12, 1_000_000).expect("solution within attempts");
51 assert!(check(nonce, 12, answer));
52 assert!(!check(nonce, 12, answer - 1));
53 assert!(!check(nonce, 13, answer));
54 }
55
56 #[test]
57 fn zero_difficulty_always_passes() {
58 assert!(check("anything", 0, 0));
59 assert!(check("anything", 0, u64::MAX));
60 }
61
62 #[test]
63 fn expired_boundary() {
64 let challenge = Challenge {
65 nonce: "nonce".to_string(),
66 difficulty: 16,
67 expires_at: 1_060,
68 mac: None,
69 };
70 assert!(!challenge.is_expired(1_059));
71 assert!(challenge.is_expired(1_060));
72 assert!(challenge.is_expired(1_061));
73 }
74
75 #[test]
76 fn leading_zero_bits_edge_cases() {
77 let mut digest = [0xffu8; 32];
78 digest[0] = 0x00;
79 digest[1] = 0xff;
80 assert!(has_leading_zero_bits(&digest, 8));
81 assert!(!has_leading_zero_bits(&digest, 9));
82
83 digest[1] = 0x7f;
84 assert!(has_leading_zero_bits(&digest, 9));
85 assert!(!has_leading_zero_bits(&digest, 10));
86
87 digest[1] = 0x00;
88 digest[2] = 0x7f;
89 assert!(has_leading_zero_bits(&digest, 17));
90 assert!(!has_leading_zero_bits(&digest, 18));
91
92 let all_zero = [0u8; 32];
93 assert!(has_leading_zero_bits(&all_zero, 255));
94 assert!(!has_leading_zero_bits(&digest, 256));
95 }
96
97 #[test]
98 fn solve_respects_max_attempts() {
99 assert_eq!(solve("find-nothing", 256, 10), None);
100 assert_eq!(solve("find-nothing", 0, 0), None);
101 }
102}
No newline at end of file
Added lib/pow-solver/src/lib.rs View lib/pow-solver/src/lib.rs
@@ -0,0 +1,3 @@
1pub mod challenge;
2
3pub use challenge::{check, solve, Challenge};
No newline at end of file
Added lib/pow-solver/Cargo.toml View lib/pow-solver/Cargo.toml
@@ -0,0 +1,8 @@
1[package]
2name = "pow-solver"
3version.workspace = true
4edition.workspace = true
5
6[dependencies]
7sha2 = "0.10"
8serde = { workspace = true, features = ["derive"] }
No newline at end of file
Modified .gitignore View .gitignore
@@ -1,3 +1,4 @@
11**.iml
22.idea
3target
No newline at end of file
3target
4.zcode
No newline at end of file
Modified Cargo.lock View Cargo.lock
@@ -164,6 +164,18 @@
164164checksum = "03918c3dbd7701a85c6b9887732e2921175f26c350b4563841d0958c21d57e6d"
165165
166166[[package]]
167name = "argon2"
168version = "0.5.3"
169source = "registry+https://github.com/rust-lang/crates.io-index"
170checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072"
171dependencies = [
172 "base64ct",
173 "blake2",
174 "cpufeatures 0.2.17",
175 "password-hash",
176]
177
178[[package]]
167179name = "arrayvec"
168180version = "0.7.8"
169181source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -404,6 +416,34 @@
404416[[package]]
405417name = "auth"
406418version = "1.0.0"
419dependencies = [
420 "aes-gcm 0.10.3",
421 "argon2",
422 "axum",
423 "base64 0.23.1",
424 "config",
425 "export",
426 "hkdf",
427 "hmac 0.13.0",
428 "mailbaby",
429 "maud",
430 "models",
431 "pow-solver",
432 "pulldown-cmark",
433 "rand 0.8.7",
434 "redis",
435 "sea-orm",
436 "serde",
437 "serde_json",
438 "session",
439 "sha1",
440 "sha2 0.11.0",
441 "ssh-key",
442 "time 0.3.55",
443 "tracing",
444 "utoipa",
445 "uuid",
446]
407447
408448[[package]]
409449name = "autocfg"
@@ -554,6 +594,12 @@
554594]
555595
556596[[package]]
597name = "base16ct"
598version = "0.2.0"
599source = "registry+https://github.com/rust-lang/crates.io-index"
600checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
601
602[[package]]
557603name = "base64"
558604version = "0.9.3"
559605source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -582,6 +628,12 @@
582628checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"
583629
584630[[package]]
631name = "base64ct"
632version = "1.8.3"
633source = "registry+https://github.com/rust-lang/crates.io-index"
634checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
635
636[[package]]
585637name = "bigdecimal"
586638version = "0.4.10"
587639source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -617,6 +669,15 @@
617669]
618670
619671[[package]]
672name = "blake2"
673version = "0.10.6"
674source = "registry+https://github.com/rust-lang/crates.io-index"
675checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"
676dependencies = [
677 "digest 0.10.7",
678]
679
680[[package]]
620681name = "block-buffer"
621682version = "0.10.4"
622683source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -822,12 +883,19 @@
822883name = "config"
823884version = "1.0.0"
824885dependencies = [
886 "base64 0.23.1",
825887 "sea-orm",
826888 "serde",
827889]
828890
829891[[package]]
830892name = "const-oid"
893version = "0.9.6"
894source = "registry+https://github.com/rust-lang/crates.io-index"
895checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
896
897[[package]]
898name = "const-oid"
831899version = "0.10.2"
832900source = "registry+https://github.com/rust-lang/crates.io-index"
833901checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
@@ -987,6 +1055,18 @@
9871055checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
9881056
9891057[[package]]
1058name = "crypto-bigint"
1059version = "0.5.5"
1060source = "registry+https://github.com/rust-lang/crates.io-index"
1061checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
1062dependencies = [
1063 "generic-array",
1064 "rand_core 0.6.4",
1065 "subtle",
1066 "zeroize",
1067]
1068
1069[[package]]
9901070name = "crypto-common"
9911071version = "0.1.6"
9921072source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1095,6 +1175,16 @@
10951175]
10961176
10971177[[package]]
1178name = "der"
1179version = "0.7.10"
1180source = "registry+https://github.com/rust-lang/crates.io-index"
1181checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
1182dependencies = [
1183 "const-oid 0.9.6",
1184 "zeroize",
1185]
1186
1187[[package]]
10981188name = "deranged"
10991189version = "0.5.8"
11001190source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1143,6 +1233,7 @@
11431233checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
11441234dependencies = [
11451235 "block-buffer 0.10.4",
1236 "const-oid 0.9.6",
11461237 "crypto-common 0.1.6",
11471238 "subtle",
11481239]
@@ -1154,7 +1245,7 @@
11541245checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
11551246dependencies = [
11561247 "block-buffer 0.12.1",
1157 "const-oid",
1248 "const-oid 0.10.2",
11581249 "crypto-common 0.2.2",
11591250 "ctutils",
11601251]
@@ -1210,6 +1301,20 @@
12101301checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
12111302
12121303[[package]]
1304name = "ecdsa"
1305version = "0.16.9"
1306source = "registry+https://github.com/rust-lang/crates.io-index"
1307checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
1308dependencies = [
1309 "der",
1310 "digest 0.10.7",
1311 "elliptic-curve",
1312 "rfc6979",
1313 "signature",
1314 "spki",
1315]
1316
1317[[package]]
12131318name = "either"
12141319version = "1.17.0"
12151320source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1219,6 +1324,25 @@
12191324]
12201325
12211326[[package]]
1327name = "elliptic-curve"
1328version = "0.13.8"
1329source = "registry+https://github.com/rust-lang/crates.io-index"
1330checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
1331dependencies = [
1332 "base16ct",
1333 "crypto-bigint",
1334 "digest 0.10.7",
1335 "ff",
1336 "generic-array",
1337 "group",
1338 "pkcs8",
1339 "rand_core 0.6.4",
1340 "sec1",
1341 "subtle",
1342 "zeroize",
1343]
1344
1345[[package]]
12221346name = "encoding_rs"
12231347version = "0.8.35"
12241348source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1277,12 +1401,15 @@
12771401name = "export"
12781402version = "1.0.0"
12791403dependencies = [
1404 "axum",
12801405 "config",
12811406 "mailbaby",
12821407 "redis",
12831408 "sea-orm",
1409 "serde",
12841410 "storage",
12851411 "tokio",
1412 "utoipa",
12861413]
12871414
12881415[[package]]
@@ -1310,6 +1437,16 @@
13101437checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
13111438
13121439[[package]]
1440name = "ff"
1441version = "0.13.1"
1442source = "registry+https://github.com/rust-lang/crates.io-index"
1443checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"
1444dependencies = [
1445 "rand_core 0.6.4",
1446 "subtle",
1447]
1448
1449[[package]]
13131450name = "find-msvc-tools"
13141451version = "0.1.11"
13151452source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1514,6 +1651,7 @@
15141651dependencies = [
15151652 "typenum",
15161653 "version_check 0.9.5",
1654 "zeroize",
15171655]
15181656
15191657[[package]]
@@ -1586,6 +1724,17 @@
15861724]
15871725
15881726[[package]]
1727name = "group"
1728version = "0.13.0"
1729source = "registry+https://github.com/rust-lang/crates.io-index"
1730checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
1731dependencies = [
1732 "ff",
1733 "rand_core 0.6.4",
1734 "subtle",
1735]
1736
1737[[package]]
15891738name = "h2"
15901739version = "0.3.27"
15911740source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1946,7 +2095,7 @@
19462095 "libc",
19472096 "percent-encoding 2.3.2",
19482097 "pin-project-lite",
1949 "socket2 0.5.10",
2098 "socket2 0.6.5",
19502099 "system-configuration",
19512100 "tokio",
19522101 "tower-service",
@@ -2446,6 +2595,8 @@
24462595dependencies = [
24472596 "equivalent",
24482597 "hashbrown 0.17.1",
2598 "serde",
2599 "serde_core",
24492600]
24502601
24512602[[package]]
@@ -2570,6 +2721,15 @@
25702721checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
25712722
25722723[[package]]
2724name = "lazy_static"
2725version = "1.5.0"
2726source = "registry+https://github.com/rust-lang/crates.io-index"
2727checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
2728dependencies = [
2729 "spin",
2730]
2731
2732[[package]]
25732733name = "lexical-core"
25742734version = "1.0.6"
25752735source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2740,6 +2900,30 @@
27402900checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
27412901
27422902[[package]]
2903name = "maud"
2904version = "0.27.0"
2905source = "registry+https://github.com/rust-lang/crates.io-index"
2906checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e"
2907dependencies = [
2908 "axum-core",
2909 "http 1.5.0",
2910 "itoa",
2911 "maud_macros",
2912]
2913
2914[[package]]
2915name = "maud_macros"
2916version = "0.27.0"
2917source = "registry+https://github.com/rust-lang/crates.io-index"
2918checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca"
2919dependencies = [
2920 "proc-macro2",
2921 "proc-macro2-diagnostics",
2922 "quote",
2923 "syn 2.0.119",
2924]
2925
2926[[package]]
27432927name = "md-5"
27442928version = "0.11.0"
27452929source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2814,6 +2998,7 @@
28142998 "serde_json",
28152999 "time 0.3.55",
28163000 "tokio",
3001 "utoipa",
28173002 "uuid",
28183003]
28193004
@@ -2900,6 +3085,22 @@
29003085]
29013086
29023087[[package]]
3088name = "num-bigint-dig"
3089version = "0.8.6"
3090source = "registry+https://github.com/rust-lang/crates.io-index"
3091checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
3092dependencies = [
3093 "lazy_static",
3094 "libm",
3095 "num-integer",
3096 "num-iter",
3097 "num-traits",
3098 "rand 0.8.7",
3099 "smallvec",
3100 "zeroize",
3101]
3102
3103[[package]]
29033104name = "num-complex"
29043105version = "0.4.6"
29053106source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2924,6 +3125,16 @@
29243125]
29253126
29263127[[package]]
3128name = "num-iter"
3129version = "0.1.46"
3130source = "registry+https://github.com/rust-lang/crates.io-index"
3131checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"
3132dependencies = [
3133 "num-integer",
3134 "num-traits",
3135]
3136
3137[[package]]
29273138name = "num-rational"
29283139version = "0.4.2"
29293140source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3090,6 +3301,44 @@
30903301]
30913302
30923303[[package]]
3304name = "p256"
3305version = "0.13.2"
3306source = "registry+https://github.com/rust-lang/crates.io-index"
3307checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
3308dependencies = [
3309 "ecdsa",
3310 "elliptic-curve",
3311 "primeorder",
3312 "sha2 0.10.9",
3313]
3314
3315[[package]]
3316name = "p384"
3317version = "0.13.1"
3318source = "registry+https://github.com/rust-lang/crates.io-index"
3319checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6"
3320dependencies = [
3321 "ecdsa",
3322 "elliptic-curve",
3323 "primeorder",
3324 "sha2 0.10.9",
3325]
3326
3327[[package]]
3328name = "p521"
3329version = "0.13.3"
3330source = "registry+https://github.com/rust-lang/crates.io-index"
3331checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2"
3332dependencies = [
3333 "base16ct",
3334 "ecdsa",
3335 "elliptic-curve",
3336 "primeorder",
3337 "rand_core 0.6.4",
3338 "sha2 0.10.9",
3339]
3340
3341[[package]]
30933342name = "parking"
30943343version = "2.2.1"
30953344source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3119,6 +3368,26 @@
31193368]
31203369
31213370[[package]]
3371name = "password-hash"
3372version = "0.5.0"
3373source = "registry+https://github.com/rust-lang/crates.io-index"
3374checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
3375dependencies = [
3376 "base64ct",
3377 "rand_core 0.6.4",
3378 "subtle",
3379]
3380
3381[[package]]
3382name = "pem-rfc7468"
3383version = "0.7.0"
3384source = "registry+https://github.com/rust-lang/crates.io-index"
3385checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
3386dependencies = [
3387 "base64ct",
3388]
3389
3390[[package]]
31223391name = "percent-encoding"
31233392version = "1.0.1"
31243393source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3177,6 +3446,27 @@
31773446checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
31783447
31793448[[package]]
3449name = "pkcs1"
3450version = "0.7.5"
3451source = "registry+https://github.com/rust-lang/crates.io-index"
3452checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
3453dependencies = [
3454 "der",
3455 "pkcs8",
3456 "spki",
3457]
3458
3459[[package]]
3460name = "pkcs8"
3461version = "0.10.2"
3462source = "registry+https://github.com/rust-lang/crates.io-index"
3463checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
3464dependencies = [
3465 "der",
3466 "spki",
3467]
3468
3469[[package]]
31803470name = "pkg-config"
31813471version = "0.3.34"
31823472source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3233,6 +3523,14 @@
32333523]
32343524
32353525[[package]]
3526name = "pow-solver"
3527version = "1.0.0"
3528dependencies = [
3529 "serde",
3530 "sha2 0.10.9",
3531]
3532
3533[[package]]
32363534name = "powerfmt"
32373535version = "0.2.0"
32383536source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3258,6 +3556,15 @@
32583556]
32593557
32603558[[package]]
3559name = "primeorder"
3560version = "0.13.6"
3561source = "registry+https://github.com/rust-lang/crates.io-index"
3562checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
3563dependencies = [
3564 "elliptic-curve",
3565]
3566
3567[[package]]
32613568name = "proc-macro-crate"
32623569version = "3.5.0"
32633570source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3304,7 +3611,7 @@
33043611source = "registry+https://github.com/rust-lang/crates.io-index"
33053612checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
33063613dependencies = [
3307 "heck 0.4.1",
3614 "heck 0.5.0",
33083615 "itertools",
33093616 "log 0.4.33",
33103617 "multimap",
@@ -3379,10 +3686,17 @@
33793686dependencies = [
33803687 "bitflags",
33813688 "memchr",
3689 "pulldown-cmark-escape",
33823690 "unicase 2.9.0",
33833691]
33843692
33853693[[package]]
3694name = "pulldown-cmark-escape"
3695version = "0.11.0"
3696source = "registry+https://github.com/rust-lang/crates.io-index"
3697checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae"
3698
3699[[package]]
33863700name = "pulldown-cmark-to-cmark"
33873701version = "22.0.1"
33883702source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3414,7 +3728,7 @@
34143728 "quinn-udp",
34153729 "rustc-hash",
34163730 "rustls",
3417 "socket2 0.5.10",
3731 "socket2 0.6.5",
34183732 "thiserror 2.0.20",
34193733 "tokio",
34203734 "tracing",
@@ -3453,9 +3767,9 @@
34533767 "cfg_aliases",
34543768 "libc",
34553769 "once_cell",
3456 "socket2 0.5.10",
3770 "socket2 0.6.5",
34573771 "tracing",
3458 "windows-sys 0.52.0",
3772 "windows-sys 0.61.2",
34593773]
34603774
34613775[[package]]
@@ -3713,6 +4027,16 @@
37134027]
37144028
37154029[[package]]
4030name = "rfc6979"
4031version = "0.4.0"
4032source = "registry+https://github.com/rust-lang/crates.io-index"
4033checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
4034dependencies = [
4035 "hmac 0.12.1",
4036 "subtle",
4037]
4038
4039[[package]]
37164040name = "ring"
37174041version = "0.17.14"
37184042source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3756,6 +4080,27 @@
37564080]
37574081
37584082[[package]]
4083name = "rsa"
4084version = "0.9.10"
4085source = "registry+https://github.com/rust-lang/crates.io-index"
4086checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
4087dependencies = [
4088 "const-oid 0.9.6",
4089 "digest 0.10.7",
4090 "num-bigint-dig",
4091 "num-integer",
4092 "num-traits",
4093 "pkcs1",
4094 "pkcs8",
4095 "rand_core 0.6.4",
4096 "sha2 0.10.9",
4097 "signature",
4098 "spki",
4099 "subtle",
4100 "zeroize",
4101]
4102
4103[[package]]
37594104name = "rust-ini"
37604105version = "0.18.0"
37614106source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3902,7 +4247,7 @@
39024247 "security-framework",
39034248 "security-framework-sys",
39044249 "webpki-root-certs",
3905 "windows-sys 0.52.0",
4250 "windows-sys 0.61.2",
39064251]
39074252
39084253[[package]]
@@ -4129,6 +4474,20 @@
41294474checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
41304475
41314476[[package]]
4477name = "sec1"
4478version = "0.7.3"
4479source = "registry+https://github.com/rust-lang/crates.io-index"
4480checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
4481dependencies = [
4482 "base16ct",
4483 "der",
4484 "generic-array",
4485 "pkcs8",
4486 "subtle",
4487 "zeroize",
4488]
4489
4490[[package]]
41324491name = "security-framework"
41334492version = "3.7.0"
41344493source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4306,6 +4665,16 @@
43064665]
43074666
43084667[[package]]
4668name = "signature"
4669version = "2.2.0"
4670source = "registry+https://github.com/rust-lang/crates.io-index"
4671checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
4672dependencies = [
4673 "digest 0.10.7",
4674 "rand_core 0.6.4",
4675]
4676
4677[[package]]
43094678name = "simd_cesu8"
43104679version = "1.2.0"
43114680source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4377,6 +4746,16 @@
43774746]
43784747
43794748[[package]]
4749name = "spki"
4750version = "0.7.3"
4751source = "registry+https://github.com/rust-lang/crates.io-index"
4752checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
4753dependencies = [
4754 "base64ct",
4755 "der",
4756]
4757
4758[[package]]
43804759name = "sqlx"
43814760version = "0.9.0"
43824761source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4564,6 +4943,47 @@
45644943]
45654944
45664945[[package]]
4946name = "ssh-cipher"
4947version = "0.2.0"
4948source = "registry+https://github.com/rust-lang/crates.io-index"
4949checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f"
4950dependencies = [
4951 "cipher 0.4.4",
4952 "ssh-encoding",
4953]
4954
4955[[package]]
4956name = "ssh-encoding"
4957version = "0.2.0"
4958source = "registry+https://github.com/rust-lang/crates.io-index"
4959checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15"
4960dependencies = [
4961 "base64ct",
4962 "pem-rfc7468",
4963 "sha2 0.10.9",
4964]
4965
4966[[package]]
4967name = "ssh-key"
4968version = "0.6.7"
4969source = "registry+https://github.com/rust-lang/crates.io-index"
4970checksum = "3b86f5297f0f04d08cabaa0f6bff7cb6aec4d9c3b49d87990d63da9d9156a8c3"
4971dependencies = [
4972 "p256",
4973 "p384",
4974 "p521",
4975 "rand_core 0.6.4",
4976 "rsa",
4977 "sec1",
4978 "sha2 0.10.9",
4979 "signature",
4980 "ssh-cipher",
4981 "ssh-encoding",
4982 "subtle",
4983 "zeroize",
4984]
4985
4986[[package]]
45674987name = "stable_deref_trait"
45684988version = "1.2.1"
45694989source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5236,6 +5656,31 @@
52365656checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
52375657
52385658[[package]]
5659name = "utoipa"
5660version = "5.5.0"
5661source = "registry+https://github.com/rust-lang/crates.io-index"
5662checksum = "8bde15df68e80b16c7d16b9616e80770ad158988daa56a27dccd1e55558b0160"
5663dependencies = [
5664 "indexmap",
5665 "serde",
5666 "serde_json",
5667 "utoipa-gen",
5668]
5669
5670[[package]]
5671name = "utoipa-gen"
5672version = "5.5.0"
5673source = "registry+https://github.com/rust-lang/crates.io-index"
5674checksum = "6ba0b99ee52df3028635d93840c797102da61f8a7bb3cf751032455895b52ef8"
5675dependencies = [
5676 "proc-macro2",
5677 "quote",
5678 "regex",
5679 "syn 2.0.119",
5680 "uuid",
5681]
5682
5683[[package]]
52395684name = "uuid"
52405685version = "1.24.1"
52415686source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5433,7 +5878,7 @@
54335878source = "registry+https://github.com/rust-lang/crates.io-index"
54345879checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
54355880dependencies = [
5436 "windows-sys 0.48.0",
5881 "windows-sys 0.61.2",
54375882]
54385883
54395884[[package]]
Modified Cargo.toml View Cargo.toml
@@ -2,6 +2,7 @@
22members = ["lib/auth","lib/cache",
33 "lib/config", "lib/export",
44 "lib/models",
5 "lib/pow-solver",
56 "lib/session",
67 "lib/storage"
78]
@@ -14,22 +15,19 @@
1415
1516
1617[workspace.dependencies]
17config = { workspace = true }
18models = { workspace = true }
19storage = { workspace = true }
20
21
2218tokio = "1.53.1"
2319serde = "1.0.229"
2420serde_json = "1.0.151"
2521axum = "0.8.9"
2622axum_session = { version = "0.21.0", features = ["key-store"] }
27tracing = "0.1"
23tracing = "0.1.44"
2824rust-s3-async = "0.35.0"
29redis = { version = "1.5.0", features = ["aio", "tokio-comp", "connection-manager", "cluster-async"] }
30sea-orm = { version = "2.0.1", features = ["sqlx-postgres", "runtime-tokio-rustls"] }
25redis = { version = "1.6.0", features = ["aio", "tokio-comp", "connection-manager", "cluster-async"] }
26sea-orm = { version = "2.0.2", features = ["sqlx-postgres", "runtime-tokio-rustls"] }
3127oxcache = { version = "0.4.3", features = ["core"] }
3228async-trait = "0.1.92"
3329base64 = "0.23.1"
3430chrono = "0.4.45"
31maud = { version = "0.27", features = ["axum"] }
32pulldown-cmark = { version = "0.13", default-features = false, features = ["html"] }
3533