From ea35e583ef0693c2ecdfba85b16716174c049aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 12 Sep 2026 06:48:43 +0300 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20chore:=20bump=20all=20depe?= =?UTF-8?q?ndencies=20to=20latest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 228 ++++++++++++++++++++---------- Cargo.toml | 12 +- src/ai/server.rs | 4 +- src/db/badge.rs | 2 +- src/db/builder.rs | 2 +- src/db/page.rs | 2 +- src/db/pomodoro.rs | 6 +- src/db/pool_question.rs | 24 ++-- src/db/profile.rs | 10 +- src/db/solution.rs | 12 +- src/db/work_entry.rs | 2 +- src/domain/answer_image.rs | 2 +- src/domain/appointment.rs | 2 +- src/domain/bank_question_image.rs | 2 +- src/domain/board.rs | 2 +- src/domain/board_stroke.rs | 2 +- src/domain/builder.rs | 2 +- src/domain/chatbot_message.rs | 2 +- src/domain/chatbot_thread.rs | 2 +- src/domain/course.rs | 2 +- src/domain/course_note.rs | 2 +- src/domain/course_note_file.rs | 2 +- src/domain/course_session.rs | 2 +- src/domain/event.rs | 2 +- src/domain/exam.rs | 2 +- src/domain/exam_question.rs | 8 +- src/domain/homework.rs | 2 +- src/domain/homework_file.rs | 4 +- src/domain/meal_ledger.rs | 2 +- src/domain/message.rs | 2 +- src/domain/monotonic_id.rs | 2 +- src/domain/note.rs | 2 +- src/domain/note_file.rs | 2 +- src/domain/payment_ledger.rs | 2 +- src/domain/pomodoro.rs | 2 +- src/domain/pool_question.rs | 2 +- src/domain/question_image.rs | 2 +- src/domain/rag_output.rs | 2 +- src/domain/session.rs | 2 +- src/domain/solution.rs | 2 +- src/domain/subject.rs | 4 +- src/domain/term.rs | 2 +- src/domain/user.rs | 16 +-- src/domain/work_entry.rs | 2 +- src/web/questions.rs | 4 +- src/web/users.rs | 2 +- 46 files changed, 237 insertions(+), 163 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9cf9fad..6776a95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -134,9 +134,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" dependencies = [ "base64ct", - "blake2", + "blake2 0.10.6", "cpufeatures 0.2.17", - "password-hash", + "password-hash 0.5.0", +] + +[[package]] +name = "argon2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c52ddac6d63c576bef8168db10c83c49c26444ecbc68060fef078925a901c" +dependencies = [ + "base64ct", + "blake2 0.11.0", + "cpufeatures 0.3.1", + "password-hash 0.6.1", ] [[package]] @@ -250,7 +262,7 @@ checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" dependencies = [ "proc-macro2", "quote", - "syn 3.0.3", + "syn 3.0.5", ] [[package]] @@ -390,9 +402,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25655df2c3cdd83c5e5b293b88acd880332b2ddadd7c30ac43144fdc0033da9" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" [[package]] name = "base64ct" @@ -484,6 +496,15 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f" +dependencies = [ + "digest 0.11.3", +] + [[package]] name = "blake3" version = "1.8.5" @@ -495,7 +516,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq", - "cpufeatures 0.3.0", + "cpufeatures 0.3.1", ] [[package]] @@ -636,9 +657,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.3.0" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89588d05638b5b4594a3348a2d6c20277e43a7f5c5202b05cc56888475a47b8" +checksum = "005ec2760ca554fae18df7a11195552ec576cd665632a881bc011d5bb2fd4d80" dependencies = [ "find-msvc-tools", "jobserver", @@ -660,12 +681,12 @@ checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chacha20" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures 0.3.1", "rand_core 0.10.1", ] @@ -729,6 +750,12 @@ dependencies = [ "cc", ] +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -802,9 +829,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ "libc", ] @@ -916,6 +943,15 @@ dependencies = [ "smallvec", ] +[[package]] +name = "ctutils" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +dependencies = [ + "cmov", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -959,9 +995,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" [[package]] name = "der" @@ -1032,6 +1068,7 @@ dependencies = [ "block-buffer 0.12.1", "const-oid 0.10.2", "crypto-common 0.2.2", + "ctutils", ] [[package]] @@ -1094,13 +1131,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.5", ] [[package]] @@ -1318,9 +1355,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "find-msvc-tools" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" [[package]] name = "flatbuffers" @@ -1405,9 +1442,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" dependencies = [ "futures-core", "futures-sink", @@ -1415,9 +1452,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" [[package]] name = "futures-executor" @@ -1432,38 +1469,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" [[package]] name = "futures-macro" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 2.0.119", + "syn 3.0.5", ] [[package]] name = "futures-sink" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" [[package]] name = "futures-task" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" [[package]] name = "futures-util" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" dependencies = [ "futures-channel", "futures-core", @@ -1788,10 +1825,10 @@ name = "hezarfen_backend" version = "0.1.0" dependencies = [ "anyhow", - "argon2", + "argon2 0.6.0", "axum", "axum-extra", - "base64 0.23.0", + "base64 0.23.1", "chrono", "dotenvy", "futures-util", @@ -1824,7 +1861,7 @@ dependencies = [ "tracing", "tracing-opentelemetry", "tracing-subscriber", - "ulid", + "ulid 3.0.0", "utoipa", "utoipa-axum", "utoipa-swagger-ui", @@ -1912,9 +1949,9 @@ checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" [[package]] name = "hybrid-array" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818356c5132c1fede50f837ca96afbe78ff42413047f4abb886217845e1b6c8c" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" dependencies = [ "typenum", ] @@ -2242,7 +2279,7 @@ dependencies = [ "js-sys", "p256", "p384", - "pem", + "pem 3.0.6", "rand 0.8.7", "rsa", "serde", @@ -2312,9 +2349,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "lru-slab" @@ -2575,9 +2612,9 @@ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-integer" -version = "0.1.46" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ "num-traits", ] @@ -2841,6 +2878,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "password-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab41826031698d6ffcd9cff78ef56ef998e39dc7e5067cdfebe373842d4723b" +dependencies = [ + "getrandom 0.4.3", + "phc", +] + [[package]] name = "paste" version = "1.0.15" @@ -2861,7 +2908,7 @@ checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", "hmac", - "password-hash", + "password-hash 0.5.0", "sha2 0.10.9", ] @@ -2881,6 +2928,16 @@ dependencies = [ "serde_core", ] +[[package]] +name = "pem" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d354a98a3d1251555de99e8fdd8afda05573c31b82f59063a7b0a29b5527f120" +dependencies = [ + "base64 0.23.1", + "serde_core", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2896,6 +2953,17 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "phc" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44dc769b75f93afdddd8c7fa12d685292ddeff1e66f7f0f3a234cf1818afe892" +dependencies = [ + "base64ct", + "ctutils", + "getrandom 0.4.3", +] + [[package]] name = "phf" version = "0.13.1" @@ -3402,11 +3470,11 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.14.8" +version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57f6d249aad744e274e682777a50283a225a32705394ee6d5fcc01efa25e4055" +checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8" dependencies = [ - "pem", + "pem 4.0.0", "ring", "rustls-pki-types", "time", @@ -3800,9 +3868,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.42" +version = "0.23.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138" +checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba" dependencies = [ "log", "once_cell", @@ -3834,9 +3902,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.13" +version = "0.103.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" dependencies = [ "ring", "rustls-pki-types", @@ -3897,7 +3965,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" dependencies = [ - "password-hash", + "password-hash 0.5.0", "pbkdf2", "salsa20", "sha2 0.10.9", @@ -3970,7 +4038,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.3", + "syn 3.0.5", ] [[package]] @@ -4027,7 +4095,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures 0.3.1", "digest 0.11.3", ] @@ -4049,7 +4117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", + "cpufeatures 0.3.1", "digest 0.11.3", ] @@ -4301,7 +4369,7 @@ dependencies = [ "ahash 0.8.12", "ammonia", "anyhow", - "argon2", + "argon2 0.5.3", "async-channel", "async-stream", "base64 0.22.1", @@ -4376,7 +4444,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "ulid", + "ulid 1.2.1", "unicase", "url", "uuid", @@ -4446,7 +4514,7 @@ dependencies = [ "surrealdb-protocol", "surrealdb-types-derive", "tracing", - "ulid", + "ulid 1.2.1", "url", "uuid", ] @@ -4509,9 +4577,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.3" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" dependencies = [ "proc-macro2", "quote", @@ -4582,22 +4650,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.19" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn 3.0.3", + "syn 3.0.5", ] [[package]] @@ -4611,9 +4679,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.54" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" dependencies = [ "deranged", "num-conv", @@ -5099,6 +5167,16 @@ dependencies = [ "web-time", ] +[[package]] +name = "ulid" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "947dde63b6d514cc5e044edad4e0ca7261afd1099d16c83d942cb2b2f348689c" +dependencies = [ + "rand 0.10.2", + "web-time", +] + [[package]] name = "unarray" version = "0.1.4" @@ -5222,9 +5300,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.26.0" +version = "1.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5772d71c9be8a8a6ac2117d949c5b224c1b72241bb611d9a3012edcf8af7812" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -5744,18 +5822,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.55" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" +checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.55" +version = "0.8.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" +checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 28a866b..7557966 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,10 @@ surrealdb = { version = "3.2", default-features = false, features = ["protocol-w serde = { version = "1", features = ["derive"] } serde_json = "1" chrono = "0.4" -argon2 = "0.5" +argon2 = "0.6" getrandom = "0.4" hex = "0.4" -ulid = "1" +ulid = "3" thiserror = "2" anyhow = "1" tracing = "0.1" @@ -37,9 +37,9 @@ utoipa = { version = "5.5.0", features = ["axum_extras"] } utoipa-axum = "0.2.0" utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } quinn = { version = "0.11.11", default-features = false, features = ["runtime-tokio", "rustls-ring", "log"] } -rcgen = { version = "0.14.8", default-features = false, features = ["pem", "ring"] } +rcgen = { version = "0.14.10", default-features = false, features = ["pem", "ring"] } rustls-pemfile = "2.2.0" -rustls = { version = "0.23.42", default-features = false, features = ["logging", "ring", "std", "tls12"] } +rustls = { version = "0.23.44", default-features = false, features = ["logging", "ring", "std", "tls12"] } sha2 = "0.11.0" base64 = "0.23" # `ServiceExt::oneshot`, which is how the AI bridge dispatches a service's api @@ -49,7 +49,7 @@ tower = { version = "0.5", features = ["util"] } opentelemetry = "0.32.0" tracing-opentelemetry = "0.33.0" opentelemetry-semantic-conventions = "0.32.1" -uuid = { version = "1.26.0", features = ["v4"] } +uuid = { version = "1.26.1", features = ["v4"] } opentelemetry_sdk = { version = "0.32.1", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.32.0", default-features = false, features = ["trace", "metrics", "logs", "grpc-tonic", "http-proto", "reqwest-blocking-client", "internal-logs"] } opentelemetry-appender-tracing = "0.32.0" @@ -60,7 +60,7 @@ tokio = { version = "1", features = ["full", "test-util"] } reqwest = { version = "0.13", default-features = false, features = ["json", "cookies"] } tempfile = "3" tokio-tungstenite = "0.30.0" -futures-util = "0.3.32" +futures-util = "0.3.34" proptest = "1.11.0" # Compiles the pattern `GET /limits` publishes and runs it over the same inputs # the validator sees, so the published promise cannot drift from the accept set. diff --git a/src/ai/server.rs b/src/ai/server.rs index 95ba0f0..84a9e38 100644 --- a/src/ai/server.rs +++ b/src/ai/server.rs @@ -260,7 +260,7 @@ impl AiBridge { // function returns by any path, so an abandoned request frees the // worker's slot rather than leaking it. let lease = self.inner.registry.pick(capability)?; - let id = Ulid::new().to_string(); + let id = Ulid::generate().to_string(); let deadline_ms = timeout.as_millis().min(u64::MAX as u128) as u64; let request = Request { id: id.clone(), @@ -995,7 +995,7 @@ async fn register( return Err(()); } - let worker_id = Ulid::new().to_string(); + let worker_id = Ulid::generate().to_string(); let max_concurrent = clamp_concurrency(hello.max_concurrent); let greeting = Greeting::Welcome { worker_id: worker_id.clone(), diff --git a/src/db/badge.rs b/src/db/badge.rs index 9d89ad9..a8d26b7 100644 --- a/src/db/badge.rs +++ b/src/db/badge.rs @@ -184,7 +184,7 @@ mod tests { /// A user row carrying `counters`, by column name. async fn a_user(counters: &[(&str, i64)], db: &Database) -> UserId { - let user = UserId::from_key(&ulid::Ulid::new().to_string()); + let user = UserId::from_key(&ulid::Ulid::generate().to_string()); let sets: Vec = counters .iter() .map(|(field, value)| format!("{field} = {value}")) diff --git a/src/db/builder.rs b/src/db/builder.rs index eaa7803..35fd8fa 100644 --- a/src/db/builder.rs +++ b/src/db/builder.rs @@ -41,7 +41,7 @@ pub async fn create_session( db: &Database, builder: &BuilderId, ) -> Result { - let key = RecordId::new(BUILDER_SESSION_TABLE, Ulid::new().to_string()); + let key = RecordId::new(BUILDER_SESSION_TABLE, Ulid::generate().to_string()); let session = BuilderSession { id: key.clone(), builder: builder.clone(), diff --git a/src/db/page.rs b/src/db/page.rs index d584a40..ce2ba5d 100644 --- a/src/db/page.rs +++ b/src/db/page.rs @@ -206,7 +206,7 @@ mod tests { #[tokio::test] async fn the_window_walks_the_rows_and_total_stays_the_whole_list() { let db = database::init_mem().await.unwrap(); - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); for i in 0..5 { note::create( &db, diff --git a/src/db/pomodoro.rs b/src/db/pomodoro.rs index da5afe5..f4c50b6 100644 --- a/src/db/pomodoro.rs +++ b/src/db/pomodoro.rs @@ -282,7 +282,7 @@ mod tests { /// touches a record that exists, so a fabricated id would silently store /// nothing. The tests above need no row — they read only the stint log. async fn a_user(db: &Database) -> UserId { - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); db.query("CREATE $usr SET username = $name, password_hash = 'x'") .bind(("usr", user.record())) .bind(("name", user.key().to_string())) @@ -699,7 +699,7 @@ mod tests { let db = database::init_mem().await.unwrap(); // A `record` column checks the table of the id, not row // existence — a fabricated id keeps this test free of user ceremony. - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); // Nothing running yet — finishing conflicts. assert!(matches!( @@ -733,7 +733,7 @@ mod tests { #[tokio::test] async fn a_backwards_clock_records_a_zero_stint_not_a_negative_one() { let db = database::init_mem().await.unwrap(); - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); start(&db, &user, None).await.unwrap(); // Stand in for the NTP step: push the running stint's start an hour diff --git a/src/db/pool_question.rs b/src/db/pool_question.rs index 0ddfc5b..0adf2c4 100644 --- a/src/db/pool_question.rs +++ b/src/db/pool_question.rs @@ -288,7 +288,7 @@ mod tests { /// The two counter columns plus a row to carry them: the `user` table is /// SCHEMAFULL in production, and the counters are `option` there. async fn a_user(db: &Database) -> UserId { - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); db.query(format!( "DEFINE FIELD IF NOT EXISTS {POOL_APPROVED_TOTAL_FIELD} ON user TYPE option; DEFINE FIELD IF NOT EXISTS {POOL_PUBLISHED_TOTAL_FIELD} ON user TYPE option; @@ -336,8 +336,8 @@ mod tests { #[tokio::test] async fn approval_is_a_one_way_race_safe_transition() { let db = database::init_mem().await.unwrap(); - let asker = UserId::from_key(&Ulid::new().to_string()); - let teacher = UserId::from_key(&Ulid::new().to_string()); + let asker = UserId::from_key(&Ulid::generate().to_string()); + let teacher = UserId::from_key(&Ulid::generate().to_string()); let q = insert(&db, question(&asker)).await.unwrap(); assert_eq!(q.get_status(), STATUS_PENDING); @@ -420,9 +420,9 @@ mod tests { #[tokio::test] async fn visibility_hides_others_pending_questions() { let db = database::init_mem().await.unwrap(); - let asker = UserId::from_key(&Ulid::new().to_string()); - let other = UserId::from_key(&Ulid::new().to_string()); - let teacher = UserId::from_key(&Ulid::new().to_string()); + let asker = UserId::from_key(&Ulid::generate().to_string()); + let other = UserId::from_key(&Ulid::generate().to_string()); + let teacher = UserId::from_key(&Ulid::generate().to_string()); let pending = insert(&db, question(&asker)).await.unwrap(); let published = insert(&db, question(&other)).await.unwrap(); @@ -444,8 +444,8 @@ mod tests { #[tokio::test] async fn image_attaches_only_while_pending_and_reports_the_replaced_blob() { let db = database::init_mem().await.unwrap(); - let asker = UserId::from_key(&Ulid::new().to_string()); - let teacher = UserId::from_key(&Ulid::new().to_string()); + let asker = UserId::from_key(&Ulid::generate().to_string()); + let teacher = UserId::from_key(&Ulid::generate().to_string()); let png = FileContentType::try_new("image/png").unwrap(); let q = insert(&db, question(&asker)).await.unwrap(); @@ -491,8 +491,8 @@ mod tests { #[tokio::test] async fn delete_cascades_solutions_and_returns_the_row() { let db = database::init_mem().await.unwrap(); - let asker = UserId::from_key(&Ulid::new().to_string()); - let helper = UserId::from_key(&Ulid::new().to_string()); + let asker = UserId::from_key(&Ulid::generate().to_string()); + let helper = UserId::from_key(&Ulid::generate().to_string()); let q = insert(&db, question(&asker)).await.unwrap(); let offered = crate::db::solution::insert( @@ -564,8 +564,8 @@ mod tests { let (mut solutions, mut swept, mut delete_500) = (0, 0, 0); for round in 0..4 { - let asker = UserId::from_key(&Ulid::new().to_string()); - let helper = UserId::from_key(&Ulid::new().to_string()); + let asker = UserId::from_key(&Ulid::generate().to_string()); + let helper = UserId::from_key(&Ulid::generate().to_string()); let q = insert(&db, question(&asker)).await.unwrap(); let id = q.get_id().clone(); diff --git a/src/db/profile.rs b/src/db/profile.rs index 7a34f63..457d495 100644 --- a/src/db/profile.rs +++ b/src/db/profile.rs @@ -102,7 +102,7 @@ mod tests { #[tokio::test] async fn stats_are_zero_without_pomodoro_rows() { let db = crate::database::init_mem().await.unwrap(); - let user = UserId::from_key(&ulid::Ulid::new().to_string()); + let user = UserId::from_key(&ulid::Ulid::generate().to_string()); let stats = load(&db, &user, 3, 1).await.unwrap(); // Derived counters: no rows is a true zero, never a null. @@ -121,7 +121,7 @@ mod tests { #[tokio::test] async fn lifetime_totals_ride_the_same_query() { let db = crate::database::init_mem().await.unwrap(); - let user = UserId::from_key(&ulid::Ulid::new().to_string()); + let user = UserId::from_key(&ulid::Ulid::generate().to_string()); db.query(format!( "CREATE $usr SET username = $name, password_hash = 'x', {} = 4, {} = 3", @@ -148,8 +148,8 @@ mod tests { #[tokio::test] async fn stats_count_finished_stints_only() { let db = crate::database::init_mem().await.unwrap(); - let user = UserId::from_key(&ulid::Ulid::new().to_string()); - let other = UserId::from_key(&ulid::Ulid::new().to_string()); + let user = UserId::from_key(&ulid::Ulid::generate().to_string()); + let other = UserId::from_key(&ulid::Ulid::generate().to_string()); // Two finished stints (1000 ms + 2500 ms), one still running, and one // finished stint belonging to somebody else. @@ -174,7 +174,7 @@ mod tests { #[tokio::test] async fn focus_time_never_reads_negative() { let db = crate::database::init_mem().await.unwrap(); - let user = UserId::from_key(&ulid::Ulid::new().to_string()); + let user = UserId::from_key(&ulid::Ulid::generate().to_string()); // One honest 1000 ms stint and one inverted row — what a backwards // clock step left behind before `finish` grew its floor. The raw sum is diff --git a/src/db/solution.rs b/src/db/solution.rs index 18a76ea..8ab5938 100644 --- a/src/db/solution.rs +++ b/src/db/solution.rs @@ -183,7 +183,7 @@ mod tests { crate::db::pool_question::insert( db, PoolQuestion::new( - &UserId::from_key(&Ulid::new().to_string()), + &UserId::from_key(&Ulid::generate().to_string()), PoolQuestionTitle::try_new("soru").unwrap(), PoolQuestionBody::try_new("neden").unwrap(), ), @@ -199,7 +199,7 @@ mod tests { let db = database::init_mem().await.unwrap(); let question_a = question_row(&db).await; let question_b = question_row(&db).await; - let author = UserId::from_key(&Ulid::new().to_string()); + let author = UserId::from_key(&Ulid::generate().to_string()); // Distinct offer times so the assertion pins the real contract — // older `offered_at` sorts first — not the same-millisecond `id` @@ -257,7 +257,7 @@ mod tests { async fn image_set_replace_clear_report_the_replaced_blob() { let db = database::init_mem().await.unwrap(); let question = question_row(&db).await; - let author = UserId::from_key(&Ulid::new().to_string()); + let author = UserId::from_key(&Ulid::generate().to_string()); let png = FileContentType::try_new("image/png").unwrap(); let solution = insert( @@ -318,7 +318,7 @@ mod tests { async fn set_body_edits_in_place() { let db = database::init_mem().await.unwrap(); let question = question_row(&db).await; - let author = UserId::from_key(&Ulid::new().to_string()); + let author = UserId::from_key(&Ulid::generate().to_string()); let solution = insert( &db, @@ -346,7 +346,7 @@ mod tests { assert!( set_body( &db, - &SolutionId::from_key(&Ulid::new().to_string()), + &SolutionId::from_key(&Ulid::generate().to_string()), &SolutionBody::try_new("boş").unwrap(), ) .await @@ -361,7 +361,7 @@ mod tests { let two = question_row(&db).await; let one = question_row(&db).await; let none = question_row(&db).await; - let author = UserId::from_key(&Ulid::new().to_string()); + let author = UserId::from_key(&Ulid::generate().to_string()); for (question, bodies) in [(&two, vec!["a", "b"]), (&one, vec!["c"])] { for body in bodies { diff --git a/src/db/work_entry.rs b/src/db/work_entry.rs index 94a0f78..41ee636 100644 --- a/src/db/work_entry.rs +++ b/src/db/work_entry.rs @@ -154,7 +154,7 @@ mod tests { let db = database::init_mem().await.unwrap(); // A `record` column checks the table of the id, not row // existence — a fabricated id keeps this test free of user ceremony. - let user = UserId::from_key(&Ulid::new().to_string()); + let user = UserId::from_key(&Ulid::generate().to_string()); let open = check_in(&db, &user).await.unwrap(); assert!(open.is_open()); diff --git a/src/domain/answer_image.rs b/src/domain/answer_image.rs index 9522340..9cca78d 100644 --- a/src/domain/answer_image.rs +++ b/src/domain/answer_image.rs @@ -85,7 +85,7 @@ impl AnswerImage { question: question.clone(), user: user.clone(), seq, - file: Ulid::new().to_string(), + file: Ulid::generate().to_string(), content_type, size, } diff --git a/src/domain/appointment.rs b/src/domain/appointment.rs index 60d547a..fb01ff0 100644 --- a/src/domain/appointment.rs +++ b/src/domain/appointment.rs @@ -50,7 +50,7 @@ use crate::domain::user::UserId; use crate::error::ValidationError; use crate::validate::validate_required; -/// Mints booking ids in write order — `Ulid::new()`'s random low bits sort +/// Mints booking ids in write order — `Ulid::generate()`'s random low bits sort /// arbitrarily within one millisecond, which would scramble the `id` tie-break /// of the newest-first listings ([`crate::db::appointment::list_for_requester`]). static IDS: LazyLock> = diff --git a/src/domain/bank_question_image.rs b/src/domain/bank_question_image.rs index b040b93..5e097a1 100644 --- a/src/domain/bank_question_image.rs +++ b/src/domain/bank_question_image.rs @@ -73,7 +73,7 @@ impl BankQuestionImage { id: BankQuestionImageId::for_slot(question, slot), bank_question: question.clone(), slot: slot.cloned(), - file: Ulid::new().to_string(), + file: Ulid::generate().to_string(), content_type, size, } diff --git a/src/domain/board.rs b/src/domain/board.rs index 6c9ccdc..01efeea 100644 --- a/src/domain/board.rs +++ b/src/domain/board.rs @@ -25,7 +25,7 @@ use crate::validate::validate_required; pub struct BoardId(RecordId); impl BoardId { - /// Monotonic, not `Ulid::new()`: boards list newest-first by id, and a + /// Monotonic, not `Ulid::generate()`: boards list newest-first by id, and a /// random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { Self(RecordId::new(BOARD_TABLE, next_ulid().to_string())) diff --git a/src/domain/board_stroke.rs b/src/domain/board_stroke.rs index d88fb39..bba9db6 100644 --- a/src/domain/board_stroke.rs +++ b/src/domain/board_stroke.rs @@ -62,7 +62,7 @@ pub const REFUSALS: [&str; 5] = [ pub struct BoardStrokeId(RecordId); impl BoardStrokeId { - /// Monotonic, not `Ulid::new()`: this id *is* the board's total order, and + /// Monotonic, not `Ulid::generate()`: this id *is* the board's total order, and /// a random low half scrambles every stroke drawn in the same millisecond — /// which is what a burst of drawing looks like. pub fn generate() -> Self { diff --git a/src/domain/builder.rs b/src/domain/builder.rs index 01a8883..aceebeb 100644 --- a/src/domain/builder.rs +++ b/src/domain/builder.rs @@ -24,7 +24,7 @@ pub struct BuilderId(RecordId); impl BuilderId { pub fn generate() -> Self { - Self(RecordId::new(BUILDER_TABLE, Ulid::new().to_string())) + Self(RecordId::new(BUILDER_TABLE, Ulid::generate().to_string())) } pub fn from_key(key: &str) -> Self { diff --git a/src/domain/chatbot_message.rs b/src/domain/chatbot_message.rs index fdad891..4b65c45 100644 --- a/src/domain/chatbot_message.rs +++ b/src/domain/chatbot_message.rs @@ -23,7 +23,7 @@ use crate::domain::user::UserId; use crate::error::ValidationError; use crate::validate::validate_required; -/// Mints message ids in write order. Unlike `Ulid::new()`, whose 80 random +/// Mints message ids in write order. Unlike `Ulid::generate()`, whose 80 random /// low bits sort arbitrarily among ids minted in the same millisecond, this /// increments the previous id — so the `id` tie-break in the `ORDER BY` of /// [`list_for_thread`](crate::db::chatbot_message::list_for_thread) / diff --git a/src/domain/chatbot_thread.rs b/src/domain/chatbot_thread.rs index 0ecbb59..517965b 100644 --- a/src/domain/chatbot_thread.rs +++ b/src/domain/chatbot_thread.rs @@ -17,7 +17,7 @@ use crate::validate::validate_required; pub struct ChatbotThreadId(RecordId); impl ChatbotThreadId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// threads sort `updated_at DESC, id DESC` and the id breaks the tie /// between two threads last touched in the same millisecond, /// and a random low half sorts arbitrarily inside one millisecond. diff --git a/src/domain/course.rs b/src/domain/course.rs index 31151f6..4ff6a7a 100644 --- a/src/domain/course.rs +++ b/src/domain/course.rs @@ -11,7 +11,7 @@ use crate::validate::{validate_course_kind, validate_optional, validate_required pub struct CourseId(RecordId); impl CourseId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// courses list `id DESC` (newest first, [`crate::db::course::list_all`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { diff --git a/src/domain/course_note.rs b/src/domain/course_note.rs index f24f5f6..e75e5dd 100644 --- a/src/domain/course_note.rs +++ b/src/domain/course_note.rs @@ -11,7 +11,7 @@ use crate::validate::{validate_optional, validate_required}; pub struct CourseNoteId(RecordId); impl CourseNoteId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a course's notes list `id DESC` (newest first, /// [`crate::db::course_note::list_for_course`]), and a random low half /// scrambles rows minted in the same millisecond. diff --git a/src/domain/course_note_file.rs b/src/domain/course_note_file.rs index 629adf0..b4920f5 100644 --- a/src/domain/course_note_file.rs +++ b/src/domain/course_note_file.rs @@ -20,7 +20,7 @@ use crate::domain::monotonic_id::next_ulid; pub struct CourseNoteFileId(RecordId); impl CourseNoteFileId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a note's files list `id DESC` (newest first, /// [`crate::db::course_note_file::list_for`]), and a random low half /// scrambles rows minted in the same millisecond. diff --git a/src/domain/course_session.rs b/src/domain/course_session.rs index ccc7e5f..9b3c29e 100644 --- a/src/domain/course_session.rs +++ b/src/domain/course_session.rs @@ -12,7 +12,7 @@ use crate::validate::validate_optional; pub struct CourseSessionId(RecordId); impl CourseSessionId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a course's sessions sort `starts_at DESC, id DESC` and the id breaks /// the tie between two sessions starting at the same instant, /// and a random low half sorts arbitrarily inside one millisecond. diff --git a/src/domain/event.rs b/src/domain/event.rs index d771440..107c676 100644 --- a/src/domain/event.rs +++ b/src/domain/event.rs @@ -16,7 +16,7 @@ use crate::validate::{validate_optional, validate_required}; pub struct EventId(RecordId); impl EventId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// events list `id DESC` (newest first, [`crate::db::event::list_all`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { diff --git a/src/domain/exam.rs b/src/domain/exam.rs index ed55c84..27d75c2 100644 --- a/src/domain/exam.rs +++ b/src/domain/exam.rs @@ -28,7 +28,7 @@ use crate::validate::{ pub struct ExamId(RecordId); impl ExamId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// exams list `id DESC` (newest first, [`crate::db::exam::list_all`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { diff --git a/src/domain/exam_question.rs b/src/domain/exam_question.rs index 0e1fc75..cf28d2f 100644 --- a/src/domain/exam_question.rs +++ b/src/domain/exam_question.rs @@ -16,7 +16,7 @@ use crate::validate::{validate_question_kind, validate_question_points, validate pub struct ExamQuestionId(RecordId); impl ExamQuestionId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: the + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: the /// id *is* the question's presentation order /// ([`crate::db::exam_question::list_for_exam`] /// sorts `id ASC`), and a random low half scrambles a burst of saves that @@ -115,11 +115,11 @@ impl ChoiceText { pub struct ChoiceId(String); impl ChoiceId { - /// Plain `Ulid::new()` deliberately: options are ordered by their position + /// Plain `Ulid::generate()` deliberately: options are ordered by their position /// in the stored `Vec`, never by id, so nothing here reads the id as a /// clock — it only has to be unique. fn generate() -> Self { - Self(Ulid::new().to_string()) + Self(Ulid::generate().to_string()) } pub fn as_str(&self) -> &str { @@ -408,7 +408,7 @@ mod tests { /// A teacher saving several questions back to back gets them back in that /// order: `list_for_exam` sorts `id ASC`, so the ids minted inside one /// millisecond have to sort in mint order. Revert `generate` to - /// `Ulid::new()` and this fails — the low 80 bits are redrawn per id, so a + /// `Ulid::generate()` and this fails — the low 80 bits are redrawn per id, so a /// same-tick burst comes out shuffled. #[tokio::test] async fn ids_sort_in_creation_order() { diff --git a/src/domain/homework.rs b/src/domain/homework.rs index 0b8ee20..352bfa8 100644 --- a/src/domain/homework.rs +++ b/src/domain/homework.rs @@ -27,7 +27,7 @@ use crate::validate::{validate_optional, validate_required}; pub struct HomeworkId(RecordId); impl HomeworkId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// homework lists `id DESC` (newest first, [`Homework::list_all`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { diff --git a/src/domain/homework_file.rs b/src/domain/homework_file.rs index 1914a00..5fe0db6 100644 --- a/src/domain/homework_file.rs +++ b/src/domain/homework_file.rs @@ -23,7 +23,7 @@ use crate::domain::timestamp::Timestamp; pub struct HomeworkFileId(RecordId); impl HomeworkFileId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a submission's files list `id DESC` (newest first, [`HomeworkFile::list_for_submission`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { @@ -75,7 +75,7 @@ impl HomeworkFile { name, content_type, size, - file: Ulid::new().to_string(), + file: Ulid::generate().to_string(), created_at: Timestamp::now(), } } diff --git a/src/domain/meal_ledger.rs b/src/domain/meal_ledger.rs index bde0eeb..de4ecc9 100644 --- a/src/domain/meal_ledger.rs +++ b/src/domain/meal_ledger.rs @@ -70,7 +70,7 @@ use crate::domain::user::UserId; use crate::error::ValidationError; use crate::validate::validate_optional; -/// Mints ledger ids in write order — `Ulid::new()`'s random low bits sort +/// Mints ledger ids in write order — `Ulid::generate()`'s random low bits sort /// arbitrarily within one millisecond, which would scramble the `id` tie-break /// of the newest-first statement below. static IDS: LazyLock> = diff --git a/src/domain/message.rs b/src/domain/message.rs index 9d2dc0d..dd6975a 100644 --- a/src/domain/message.rs +++ b/src/domain/message.rs @@ -100,7 +100,7 @@ impl Folder { pub struct MessageId(RecordId); impl MessageId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// the folder listings sort `id DESC` (newest first, /// [`crate::db::message::list_folder`]), /// and a random low half scrambles rows minted in the same millisecond. diff --git a/src/domain/monotonic_id.rs b/src/domain/monotonic_id.rs index 8274ccf..74f09e7 100644 --- a/src/domain/monotonic_id.rs +++ b/src/domain/monotonic_id.rs @@ -1,7 +1,7 @@ //! Ids that sort in write order, for tables whose listings lean on `id` to //! break ties (or to mean "newest first" outright). //! -//! `Ulid::new()` fills the low 80 bits at random, so two ids minted in the +//! `Ulid::generate()` fills the low 80 bits at random, so two ids minted in the //! *same millisecond* sort arbitrarily against each other — millisecond- //! accurate ordering only. That is not enough when a burst of writes lands //! inside one tick (a recurring appointment publish expanding a series, a diff --git a/src/domain/note.rs b/src/domain/note.rs index 5324159..fe81bed 100644 --- a/src/domain/note.rs +++ b/src/domain/note.rs @@ -10,7 +10,7 @@ use crate::validate::{validate_optional, validate_required}; pub struct NoteId(RecordId); impl NoteId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// notes list `id DESC` (newest first, [`crate::db::note::list_for`]), /// and a random low half scrambles rows minted in the same millisecond. pub fn generate() -> Self { diff --git a/src/domain/note_file.rs b/src/domain/note_file.rs index 729d724..b2c6cee 100644 --- a/src/domain/note_file.rs +++ b/src/domain/note_file.rs @@ -16,7 +16,7 @@ use crate::error::ValidationError; pub struct NoteFileId(RecordId); impl NoteFileId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a note's files list `id DESC` (newest first, /// [`crate::db::note_file::list_for`]), and a random low half scrambles /// rows minted in the same millisecond. diff --git a/src/domain/payment_ledger.rs b/src/domain/payment_ledger.rs index 4d353c9..4b3aff3 100644 --- a/src/domain/payment_ledger.rs +++ b/src/domain/payment_ledger.rs @@ -59,7 +59,7 @@ use crate::error::ValidationError; pub struct PaymentLedgerId(RecordId); impl PaymentLedgerId { - /// A fresh id in write order — `Ulid::new()`'s random low bits sort + /// A fresh id in write order — `Ulid::generate()`'s random low bits sort /// arbitrarily within one millisecond, which would scramble the `id` /// tie-break of the newest-first statement below. pub fn generate() -> Self { diff --git a/src/domain/pomodoro.rs b/src/domain/pomodoro.rs index af9c4a4..e3888c1 100644 --- a/src/domain/pomodoro.rs +++ b/src/domain/pomodoro.rs @@ -9,7 +9,7 @@ use crate::domain::user::UserId; pub struct PomodoroSessionId(RecordId); impl PomodoroSessionId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// the log sorts `started_at DESC, id DESC` and the id breaks the tie between /// two sessions started at the same instant. The `open_` key below never ties /// with itself (one running session per user), so it needs no ordering. diff --git a/src/domain/pool_question.rs b/src/domain/pool_question.rs index 86d5c85..1d33530 100644 --- a/src/domain/pool_question.rs +++ b/src/domain/pool_question.rs @@ -28,7 +28,7 @@ use crate::validate::validate_required; pub struct PoolQuestionId(RecordId); impl PoolQuestionId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// the pool sorts `asked_at DESC, id DESC` and the id *is* the tie-break /// ([`crate::db::pool_question::list_all`]), /// and a random low half scrambles rows minted in the same millisecond. diff --git a/src/domain/question_image.rs b/src/domain/question_image.rs index 7c21f60..5b3c63f 100644 --- a/src/domain/question_image.rs +++ b/src/domain/question_image.rs @@ -75,7 +75,7 @@ impl QuestionImage { exam: exam.clone(), question: question.clone(), slot: slot.cloned(), - file: Ulid::new().to_string(), + file: Ulid::generate().to_string(), content_type, size, } diff --git a/src/domain/rag_output.rs b/src/domain/rag_output.rs index 248c99d..1fb9c56 100644 --- a/src/domain/rag_output.rs +++ b/src/domain/rag_output.rs @@ -27,7 +27,7 @@ use crate::domain::timestamp::Timestamp; pub struct RagOutputId(RecordId); impl RagOutputId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// a note's outputs list `id DESC` (newest first, /// [`list_for`](crate::db::rag_output::list_for)). pub fn generate() -> Self { diff --git a/src/domain/session.rs b/src/domain/session.rs index 245a2e9..3fe4d51 100644 --- a/src/domain/session.rs +++ b/src/domain/session.rs @@ -11,7 +11,7 @@ pub struct SessionId(RecordId); impl SessionId { pub fn generate() -> Self { - Self(RecordId::new(SESSION_TABLE, Ulid::new().to_string())) + Self(RecordId::new(SESSION_TABLE, Ulid::generate().to_string())) } pub fn record(&self) -> RecordId { diff --git a/src/domain/solution.rs b/src/domain/solution.rs index 8d05515..e7756b0 100644 --- a/src/domain/solution.rs +++ b/src/domain/solution.rs @@ -23,7 +23,7 @@ use crate::validate::validate_required; pub struct SolutionId(RecordId); impl SolutionId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// solutions sort `offered_at ASC, id ASC` and the id *is* the tie-break /// ([`crate::db::solution::list_for`]), /// and a random low half scrambles rows minted in the same millisecond. diff --git a/src/domain/subject.rs b/src/domain/subject.rs index f6d0575..4e8be6e 100644 --- a/src/domain/subject.rs +++ b/src/domain/subject.rs @@ -10,7 +10,7 @@ use crate::validate::{validate_optional, validate_required}; pub struct SubjectId(RecordId); impl SubjectId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: the + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: the /// id *is* the curriculum's order ([`crate::db::subject::list_for_course`] /// sorts `id ASC`), and a random low half scrambles a burst of saves that /// lands inside one millisecond. @@ -99,7 +99,7 @@ mod tests { /// A teacher entering a curriculum gets it back in the order they typed it: /// `list_for_course` sorts `id ASC`, so the ids minted inside one /// millisecond have to sort in mint order. Revert `generate` to - /// `Ulid::new()` and this fails — the low 80 bits are redrawn per id, so a + /// `Ulid::generate()` and this fails — the low 80 bits are redrawn per id, so a /// same-tick burst comes out shuffled. #[tokio::test] async fn ids_sort_in_creation_order() { diff --git a/src/domain/term.rs b/src/domain/term.rs index 270eaed..0b393d3 100644 --- a/src/domain/term.rs +++ b/src/domain/term.rs @@ -18,7 +18,7 @@ use crate::validate::validate_required; pub struct TermId(RecordId); impl TermId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// terms sort `starts_at DESC, id DESC` and the id breaks the tie between /// two terms starting at the same instant, /// and a random low half sorts arbitrarily inside one millisecond. diff --git a/src/domain/user.rs b/src/domain/user.rs index 50b6278..8bcd236 100644 --- a/src/domain/user.rs +++ b/src/domain/user.rs @@ -5,7 +5,7 @@ use std::sync::OnceLock; -use argon2::password_hash::SaltString; +use argon2::password_hash::phc::PasswordHash as PhcHash; use argon2::{Argon2, PasswordHasher, PasswordVerifier}; use surrealdb::types::{RecordId, RecordIdKey, SurrealValue}; @@ -23,7 +23,7 @@ use crate::validate::{validate_password, validate_username}; pub struct UserId(RecordId); impl UserId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// users list `id DESC` (newest first, [`crate::db::user::list_all`]) and page by /// offset over that order, and a random low half scrambles rows minted in /// the same millisecond. Not a secret: the session token is separate @@ -93,13 +93,9 @@ impl Password { /// Private on purpose: argon2 must never run on an async worker. Callers /// outside this module go through [`Password::hash_async`]. fn hash(&self) -> Result { - let mut salt_bytes = [0u8; 16]; - getrandom::fill(&mut salt_bytes).map_err(|e| AppError::Internal(format!("rng: {e}")))?; - let salt = SaltString::encode_b64(&salt_bytes) - .map_err(|e| AppError::Internal(format!("salt: {e}")))?; - let hash = Argon2::default() - .hash_password(self.0.as_bytes(), &salt)? - .to_string(); + // password-hash 0.6 generates the salt internally (its own CSPRNG); + // the explicit SaltString step is gone. + let hash = Argon2::default().hash_password(self.0.as_bytes())?.to_string(); Ok(PasswordHash(hash)) } @@ -142,7 +138,7 @@ impl PasswordHash { /// Private on purpose — see [`Password::hash`]. Use [`PasswordHash::verify_async`]. fn verify(&self, password: &Password) -> bool { - match argon2::password_hash::PasswordHash::new(&self.0) { + match PhcHash::new(&self.0) { Ok(parsed) => Argon2::default() .verify_password(password.0.as_bytes(), &parsed) .is_ok(), diff --git a/src/domain/work_entry.rs b/src/domain/work_entry.rs index 4b20fdd..549af8c 100644 --- a/src/domain/work_entry.rs +++ b/src/domain/work_entry.rs @@ -20,7 +20,7 @@ pub(crate) fn out_before_in_error() -> AppError { pub struct WorkEntryId(RecordId); impl WorkEntryId { - /// Minted from the process-wide monotonic generator, not `Ulid::new()`: + /// Minted from the process-wide monotonic generator, not `Ulid::generate()`: /// the log sorts `check_in DESC, id DESC` and the id breaks the tie between /// two stints checked in at the same instant. The `open_` key below never /// ties with itself (one open stint per user), so it needs no ordering. diff --git a/src/web/questions.rs b/src/web/questions.rs index 3c04e17..fbcb612 100644 --- a/src/web/questions.rs +++ b/src/web/questions.rs @@ -482,7 +482,7 @@ async fn upload_image( let upload = read_image_upload(&st, &mut multipart).await?; let size = upload.size(); - let file = ulid::Ulid::new().to_string(); + let file = ulid::Ulid::generate().to_string(); store_blob(&st, &file, &upload.data, || async { match pool_question::set_image(&st.db, question.get_id(), &file, &upload.content_type, size) .await? @@ -808,7 +808,7 @@ async fn upload_solution_image( let upload = read_image_upload(&st, &mut multipart).await?; let size = upload.size(); - let file = ulid::Ulid::new().to_string(); + let file = ulid::Ulid::generate().to_string(); store_blob(&st, &file, &upload.data, || async { match solution::set_image(&st.db, solution.get_id(), &file, &upload.content_type, size) .await? diff --git a/src/web/users.rs b/src/web/users.rs index a260921..c97855d 100644 --- a/src/web/users.rs +++ b/src/web/users.rs @@ -1151,7 +1151,7 @@ async fn upload_my_avatar( let upload = read_image_upload(&st, &mut multipart).await?; let size = upload.size(); - let file = ulid::Ulid::new().to_string(); + let file = ulid::Ulid::generate().to_string(); store_blob(&st, &file, &upload.data, || async { match crate::service::user::set_avatar( &st.db,