forge
Explore
Log in

Don't you dare go Hollow

Bump remaining crates to latest

Browse files at this commit

25140f308a711d4090fa75bb29558a3f5335587cAhmet Kaan GümüşParent: ce3c543
  • chore
    • bump remaining crates to latest
Show full message
chore: bump remaining crates to latest

topcoat 0.8, ulid 3, chacha20poly1305 0.11, base64 0.23, rsa 0.10-rc.18.
Cargo.lockmodified+179 -146
@@ -18,6 +18,16 @@ dependencies = [
1818 "generic-array",
1919 ]
2020
21+[[package]]
22+name = "aead"
23+version = "0.6.1"
24+source = "registry+https://github.com/rust-lang/crates.io-index"
25+checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99"
26+dependencies = [
27+ "crypto-common 0.2.2",
28+ "inout 0.2.2",
29+]
30+
2131 [[package]]
2232 name = "aegis"
2333 version = "0.9.15"
@@ -35,7 +45,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3545 checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
3646 dependencies = [
3747 "cfg-if",
38- "cipher",
48+ "cipher 0.4.4",
3949 "cpufeatures 0.2.17",
4050 ]
4151
@@ -45,9 +55,9 @@ version = "0.10.3"
4555 source = "registry+https://github.com/rust-lang/crates.io-index"
4656 checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"
4757 dependencies = [
48- "aead",
58+ "aead 0.5.2",
4959 "aes",
50- "cipher",
60+ "cipher 0.4.4",
5161 "ctr",
5262 "ghash",
5363 "subtle",
@@ -293,6 +303,12 @@ dependencies = [
293303 "pkg-config",
294304 ]
295305
306+[[package]]
307+name = "base16ct"
308+version = "1.0.0"
309+source = "registry+https://github.com/rust-lang/crates.io-index"
310+checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6"
311+
296312 [[package]]
297313 name = "base64"
298314 version = "0.22.1"
@@ -537,17 +553,6 @@ version = "0.1.1"
537553 source = "registry+https://github.com/rust-lang/crates.io-index"
538554 checksum = "18758054972164c3264f7c8386f5fc6da6114cb46b619fd365d4e3b2dc3ae487"
539555
540-[[package]]
541-name = "chacha20"
542-version = "0.9.1"
543-source = "registry+https://github.com/rust-lang/crates.io-index"
544-checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
545-dependencies = [
546- "cfg-if",
547- "cipher",
548- "cpufeatures 0.2.17",
549-]
550-
551556 [[package]]
552557 name = "chacha20"
553558 version = "0.10.2"
@@ -555,21 +560,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
555560 checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
556561 dependencies = [
557562 "cfg-if",
563+ "cipher 0.5.2",
558564 "cpufeatures 0.3.1",
559565 "rand_core 0.10.1",
560566 ]
561567
562568 [[package]]
563569 name = "chacha20poly1305"
564-version = "0.10.1"
570+version = "0.11.0"
565571 source = "registry+https://github.com/rust-lang/crates.io-index"
566-checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
572+checksum = "9b89e1c441e926b9c82a8d023f6e1b7ae0adcfaa7d621814e4d60789bac751cb"
567573 dependencies = [
568- "aead",
569- "chacha20 0.9.1",
570- "cipher",
574+ "aead 0.6.1",
575+ "chacha20",
576+ "cipher 0.5.2",
571577 "poly1305",
572- "zeroize",
573578 ]
574579
575580 [[package]]
@@ -592,8 +597,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
592597 checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
593598 dependencies = [
594599 "crypto-common 0.1.7",
595- "inout",
596- "zeroize",
600+ "inout 0.1.4",
601+]
602+
603+[[package]]
604+name = "cipher"
605+version = "0.5.2"
606+source = "registry+https://github.com/rust-lang/crates.io-index"
607+checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"
608+dependencies = [
609+ "block-buffer 0.12.1",
610+ "crypto-common 0.2.2",
611+ "inout 0.2.2",
597612 ]
598613
599614 [[package]]
@@ -698,12 +713,6 @@ dependencies = [
698713 "crossbeam-utils",
699714 ]
700715
701-[[package]]
702-name = "const-oid"
703-version = "0.9.6"
704-source = "registry+https://github.com/rust-lang/crates.io-index"
705-checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
706-
707716 [[package]]
708717 name = "const-oid"
709718 version = "0.10.2"
@@ -750,6 +759,12 @@ version = "1.0.0"
750759 source = "registry+https://github.com/rust-lang/crates.io-index"
751760 checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"
752761
762+[[package]]
763+name = "cpubits"
764+version = "0.1.1"
765+source = "registry+https://github.com/rust-lang/crates.io-index"
766+checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae"
767+
753768 [[package]]
754769 name = "cpufeatures"
755770 version = "0.2.17"
@@ -826,6 +841,20 @@ version = "0.2.4"
826841 source = "registry+https://github.com/rust-lang/crates.io-index"
827842 checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
828843
844+[[package]]
845+name = "crypto-bigint"
846+version = "0.7.5"
847+source = "registry+https://github.com/rust-lang/crates.io-index"
848+checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271"
849+dependencies = [
850+ "cpubits",
851+ "ctutils",
852+ "num-traits",
853+ "rand_core 0.10.1",
854+ "serdect",
855+ "zeroize",
856+]
857+
829858 [[package]]
830859 name = "crypto-common"
831860 version = "0.1.7"
@@ -843,7 +872,19 @@ version = "0.2.2"
843872 source = "registry+https://github.com/rust-lang/crates.io-index"
844873 checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
845874 dependencies = [
875+ "getrandom 0.4.3",
846876 "hybrid-array",
877+ "rand_core 0.10.1",
878+]
879+
880+[[package]]
881+name = "crypto-primes"
882+version = "0.7.2"
883+source = "registry+https://github.com/rust-lang/crates.io-index"
884+checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f"
885+dependencies = [
886+ "crypto-bigint",
887+ "rand_core 0.10.1",
847888 ]
848889
849890 [[package]]
@@ -852,7 +893,7 @@ version = "0.9.2"
852893 source = "registry+https://github.com/rust-lang/crates.io-index"
853894 checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"
854895 dependencies = [
855- "cipher",
896+ "cipher 0.4.4",
856897 ]
857898
858899 [[package]]
@@ -912,11 +953,11 @@ checksum = "c286de4e81ea2590afc24d754e0f83810c566f50a1388fa75ebd57928c0d9745"
912953
913954 [[package]]
914955 name = "der"
915-version = "0.7.10"
956+version = "0.8.2"
916957 source = "registry+https://github.com/rust-lang/crates.io-index"
917-checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
958+checksum = "a878c850e9e421b20262e9b41f9c860e4785fa07541c266b62ff9d1ef998a80a"
918959 dependencies = [
919- "const-oid 0.9.6",
960+ "const-oid",
920961 "pem-rfc7468",
921962 "zeroize",
922963 ]
@@ -937,7 +978,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
937978 checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
938979 dependencies = [
939980 "block-buffer 0.10.4",
940- "const-oid 0.9.6",
941981 "crypto-common 0.1.7",
942982 "subtle",
943983 ]
@@ -949,7 +989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
949989 checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
950990 dependencies = [
951991 "block-buffer 0.12.1",
952- "const-oid 0.10.2",
992+ "const-oid",
953993 "crypto-common 0.2.2",
954994 "ctutils",
955995 ]
@@ -1782,16 +1822,15 @@ dependencies = [
17821822 name = "im-client"
17831823 version = "0.1.0"
17841824 dependencies = [
1785- "base64 0.22.1",
1825+ "base64 0.23.1",
17861826 "chacha20poly1305",
17871827 "http",
17881828 "rand 0.10.2",
1789- "rand_core 0.6.4",
1829+ "rand_core 0.10.1",
17901830 "reqwest",
17911831 "rsa",
17921832 "serde",
17931833 "serde_json",
1794- "sha2 0.10.9",
17951834 "sha2 0.11.0",
17961835 "subtle",
17971836 "thiserror",
@@ -1805,17 +1844,16 @@ name = "im-core"
18051844 version = "0.1.0"
18061845 dependencies = [
18071846 "argon2",
1808- "base64 0.22.1",
1847+ "base64 0.23.1",
18091848 "chacha20poly1305",
18101849 "data-encoding",
18111850 "hmac 0.13.0",
18121851 "rand 0.10.2",
1813- "rand_core 0.6.4",
1852+ "rand_core 0.10.1",
18141853 "rsa",
18151854 "serde",
18161855 "serde_json",
18171856 "sha1 0.11.0",
1818- "sha2 0.10.9",
18191857 "sha2 0.11.0",
18201858 "subtle",
18211859 "tempfile",
@@ -1842,7 +1880,7 @@ dependencies = [
18421880 name = "im-web"
18431881 version = "0.1.0"
18441882 dependencies = [
1845- "base64 0.22.1",
1883+ "base64 0.23.1",
18461884 "data-encoding",
18471885 "futures-util",
18481886 "grass",
@@ -1880,6 +1918,15 @@ dependencies = [
18801918 "generic-array",
18811919 ]
18821920
1921+[[package]]
1922+name = "inout"
1923+version = "0.2.2"
1924+source = "registry+https://github.com/rust-lang/crates.io-index"
1925+checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7"
1926+dependencies = [
1927+ "hybrid-array",
1928+]
1929+
18831930 [[package]]
18841931 name = "intrusive-collections"
18851932 version = "0.9.7"
@@ -2029,9 +2076,6 @@ name = "lazy_static"
20292076 version = "1.5.0"
20302077 source = "registry+https://github.com/rust-lang/crates.io-index"
20312078 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
2032-dependencies = [
2033- "spin",
2034-]
20352079
20362080 [[package]]
20372081 name = "lazycell"
@@ -2391,22 +2435,6 @@ dependencies = [
23912435 "num-traits",
23922436 ]
23932437
2394-[[package]]
2395-name = "num-bigint-dig"
2396-version = "0.8.6"
2397-source = "registry+https://github.com/rust-lang/crates.io-index"
2398-checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"
2399-dependencies = [
2400- "lazy_static",
2401- "libm",
2402- "num-integer",
2403- "num-iter",
2404- "num-traits",
2405- "rand 0.8.8",
2406- "smallvec",
2407- "zeroize",
2408-]
2409-
24102438 [[package]]
24112439 name = "num-conv"
24122440 version = "0.2.2"
@@ -2422,16 +2450,6 @@ dependencies = [
24222450 "num-traits",
24232451 ]
24242452
2425-[[package]]
2426-name = "num-iter"
2427-version = "0.1.46"
2428-source = "registry+https://github.com/rust-lang/crates.io-index"
2429-checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"
2430-dependencies = [
2431- "num-integer",
2432- "num-traits",
2433-]
2434-
24352453 [[package]]
24362454 name = "num-traits"
24372455 version = "0.2.19"
@@ -2439,7 +2457,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
24392457 checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
24402458 dependencies = [
24412459 "autocfg",
2442- "libm",
24432460 ]
24442461
24452462 [[package]]
@@ -2546,9 +2563,9 @@ checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
25462563
25472564 [[package]]
25482565 name = "pem-rfc7468"
2549-version = "0.7.0"
2566+version = "1.0.0"
25502567 source = "registry+https://github.com/rust-lang/crates.io-index"
2551-checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"
2568+checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9"
25522569 dependencies = [
25532570 "base64ct",
25542571 ]
@@ -2620,20 +2637,19 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
26202637
26212638 [[package]]
26222639 name = "pkcs1"
2623-version = "0.7.5"
2640+version = "0.8.0-rc.4"
26242641 source = "registry+https://github.com/rust-lang/crates.io-index"
2625-checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
2642+checksum = "986d2e952779af96ea048f160fd9194e1751b4faea78bcf3ceb456efe008088e"
26262643 dependencies = [
26272644 "der",
2628- "pkcs8",
26292645 "spki",
26302646 ]
26312647
26322648 [[package]]
26332649 name = "pkcs8"
2634-version = "0.10.2"
2650+version = "0.11.0"
26352651 source = "registry+https://github.com/rust-lang/crates.io-index"
2636-checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
2652+checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7"
26372653 dependencies = [
26382654 "der",
26392655 "spki",
@@ -2661,13 +2677,12 @@ dependencies = [
26612677
26622678 [[package]]
26632679 name = "poly1305"
2664-version = "0.8.0"
2680+version = "0.9.1"
26652681 source = "registry+https://github.com/rust-lang/crates.io-index"
2666-checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"
2682+checksum = "6e2d0073b297041425c7c3df6eb4792d598a15323fe63346852b092eca02904c"
26672683 dependencies = [
2668- "cpufeatures 0.2.17",
2669- "opaque-debug",
2670- "universal-hash",
2684+ "cpufeatures 0.3.1",
2685+ "universal-hash 0.6.1",
26712686 ]
26722687
26732688 [[package]]
@@ -2679,7 +2694,7 @@ dependencies = [
26792694 "cfg-if",
26802695 "cpufeatures 0.2.17",
26812696 "opaque-debug",
2682- "universal-hash",
2697+ "universal-hash 0.5.1",
26832698 ]
26842699
26852700 [[package]]
@@ -2892,7 +2907,7 @@ version = "0.10.2"
28922907 source = "registry+https://github.com/rust-lang/crates.io-index"
28932908 checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
28942909 dependencies = [
2895- "chacha20 0.10.2",
2910+ "chacha20",
28962911 "getrandom 0.4.3",
28972912 "rand_core 0.10.1",
28982913 ]
@@ -3110,21 +3125,19 @@ dependencies = [
31103125
31113126 [[package]]
31123127 name = "rsa"
3113-version = "0.9.10"
3128+version = "0.10.0-rc.18"
31143129 source = "registry+https://github.com/rust-lang/crates.io-index"
3115-checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
3130+checksum = "30b2aa4ba0d89f73d1e332df05be0eeab8840351c36ca5654341dfdb57bb3caf"
31163131 dependencies = [
3117- "const-oid 0.9.6",
3118- "digest 0.10.7",
3119- "num-bigint-dig",
3120- "num-integer",
3121- "num-traits",
3132+ "const-oid",
3133+ "crypto-bigint",
3134+ "crypto-primes",
3135+ "digest 0.11.3",
31223136 "pkcs1",
31233137 "pkcs8",
3124- "rand_core 0.6.4",
3138+ "rand_core 0.10.1",
31253139 "signature",
31263140 "spki",
3127- "subtle",
31283141 "zeroize",
31293142 ]
31303143
@@ -3418,6 +3431,16 @@ dependencies = [
34183431 "serde",
34193432 ]
34203433
3434+[[package]]
3435+name = "serdect"
3436+version = "0.4.3"
3437+source = "registry+https://github.com/rust-lang/crates.io-index"
3438+checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e"
3439+dependencies = [
3440+ "base16ct",
3441+ "serde",
3442+]
3443+
34213444 [[package]]
34223445 name = "sha1"
34233446 version = "0.10.7"
@@ -3521,12 +3544,12 @@ dependencies = [
35213544
35223545 [[package]]
35233546 name = "signature"
3524-version = "2.2.0"
3547+version = "3.0.0"
35253548 source = "registry+https://github.com/rust-lang/crates.io-index"
3526-checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
3549+checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5"
35273550 dependencies = [
3528- "digest 0.10.7",
3529- "rand_core 0.6.4",
3551+ "digest 0.11.3",
3552+ "rand_core 0.10.1",
35303553 ]
35313554
35323555 [[package]]
@@ -3611,9 +3634,9 @@ checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"
36113634
36123635 [[package]]
36133636 name = "spki"
3614-version = "0.7.3"
3637+version = "0.8.0"
36153638 source = "registry+https://github.com/rust-lang/crates.io-index"
3616-checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
3639+checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f"
36173640 dependencies = [
36183641 "base64ct",
36193642 "der",
@@ -4076,14 +4099,13 @@ checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
40764099
40774100 [[package]]
40784101 name = "topcoat"
4079-version = "0.6.2"
4102+version = "0.8.0"
40804103 source = "registry+https://github.com/rust-lang/crates.io-index"
4081-checksum = "050c11e7b0e146a2b1eb15855abd5fa03e2754eb880922f8b6cab5ec71cac5aa"
4104+checksum = "f3c199295b1c52e0a9c88a2b0518f6bc7522503cd0bb06d9f4742c515ac4df0a"
40824105 dependencies = [
40834106 "futures-util",
40844107 "inventory",
40854108 "serde",
4086- "serde_urlencoded",
40874109 "tokio",
40884110 "tokio-tungstenite",
40894111 "topcoat-asset",
@@ -4104,9 +4126,9 @@ dependencies = [
41044126
41054127 [[package]]
41064128 name = "topcoat-asset"
4107-version = "0.6.2"
4129+version = "0.8.0"
41084130 source = "registry+https://github.com/rust-lang/crates.io-index"
4109-checksum = "a72e4ba8cb6a9d29613a25c2151e72d887b4a79b3f179b497734eed0e65ea702"
4131+checksum = "fba199ae779d0409672929e7c32711ac35e87c9e39e0823d0b33b6293e3e0011"
41104132 dependencies = [
41114133 "http",
41124134 "memchr",
@@ -4122,9 +4144,9 @@ dependencies = [
41224144
41234145 [[package]]
41244146 name = "topcoat-cookie"
4125-version = "0.6.2"
4147+version = "0.8.0"
41264148 source = "registry+https://github.com/rust-lang/crates.io-index"
4127-checksum = "f68c83654c4bf075f667d39463cd38ef0be9fee057054454b06612efe16e7a37"
4149+checksum = "3cb0bf2f95c1931d32d579389695e8cf221d114f9629a57fc005d7a0bb459c0d"
41284150 dependencies = [
41294151 "cookie",
41304152 "getrandom 0.2.17",
@@ -4137,9 +4159,9 @@ dependencies = [
41374159
41384160 [[package]]
41394161 name = "topcoat-core"
4140-version = "0.6.2"
4162+version = "0.8.0"
41414163 source = "registry+https://github.com/rust-lang/crates.io-index"
4142-checksum = "42f94adaa301d7a4b949d650fa803323c00cc8ffa8bf1984511c1ec5d390b6c6"
4164+checksum = "d88c5ed693dd383ba8a4112f5b665bdb7e979ada413a7b5f9ede6935fe18e8e6"
41434165 dependencies = [
41444166 "anyhow",
41454167 "anymap3",
@@ -4153,9 +4175,9 @@ dependencies = [
41534175
41544176 [[package]]
41554177 name = "topcoat-core-grammar"
4156-version = "0.6.2"
4178+version = "0.8.0"
41574179 source = "registry+https://github.com/rust-lang/crates.io-index"
4158-checksum = "0756aa9285794c155624494bc563d56859e35205313db883a89d7dabfa6d0393"
4180+checksum = "ce257f5c2248b4d7bf1bbd76a0e71709221f06d690462a49aad5929732c42001"
41594181 dependencies = [
41604182 "proc-macro-crate",
41614183 "proc-macro2",
@@ -4165,9 +4187,9 @@ dependencies = [
41654187
41664188 [[package]]
41674189 name = "topcoat-core-macro"
4168-version = "0.6.2"
4190+version = "0.8.0"
41694191 source = "registry+https://github.com/rust-lang/crates.io-index"
4170-checksum = "e4908dba6268c8592be73e9059cdefa053066e1b1bc879c1c9a5d8d3b6e97aad"
4192+checksum = "5d239098a8c674f16120e7bfcba6f670865c807eec2a0e2648cb319d300fab39"
41714193 dependencies = [
41724194 "quote",
41734195 "syn 2.0.119",
@@ -4176,9 +4198,9 @@ dependencies = [
41764198
41774199 [[package]]
41784200 name = "topcoat-font"
4179-version = "0.6.2"
4201+version = "0.8.0"
41804202 source = "registry+https://github.com/rust-lang/crates.io-index"
4181-checksum = "e7b8308aff65f46bbe2f58371fc9823db596236bd0ea3c9d87de6534fd977e60"
4203+checksum = "8ccc2da492bfdcf2d23d761b60338eb20ad178fd754ef19570abe6030663137d"
41824204 dependencies = [
41834205 "heck",
41844206 "inventory",
@@ -4193,9 +4215,9 @@ dependencies = [
41934215
41944216 [[package]]
41954217 name = "topcoat-font-grammar"
4196-version = "0.6.2"
4218+version = "0.8.0"
41974219 source = "registry+https://github.com/rust-lang/crates.io-index"
4198-checksum = "5b7d68e226827fb7531d0dba69cb74fa7b82515f8428fd1a75f556f5a2bf87c1"
4220+checksum = "6125e270bb16bf826a54e4b40b41484682b2b660af4803688887f64a9918745a"
41994221 dependencies = [
42004222 "proc-macro2",
42014223 "quote",
@@ -4206,9 +4228,9 @@ dependencies = [
42064228
42074229 [[package]]
42084230 name = "topcoat-font-macro"
4209-version = "0.6.2"
4231+version = "0.8.0"
42104232 source = "registry+https://github.com/rust-lang/crates.io-index"
4211-checksum = "e655c430bcb380f879603ea750c6222ade2ff3ade33869d9eaa32e3fc49f5469"
4233+checksum = "5f46d0a9c08e7bf774683c05add490824af80a844f410e6ffc9fdaf00c88d7be"
42124234 dependencies = [
42134235 "quote",
42144236 "syn 2.0.119",
@@ -4217,9 +4239,9 @@ dependencies = [
42174239
42184240 [[package]]
42194241 name = "topcoat-mail"
4220-version = "0.6.2"
4242+version = "0.8.0"
42214243 source = "registry+https://github.com/rust-lang/crates.io-index"
4222-checksum = "959c9c32172ad3840f94c589a29bd143c072661c9abf2215a68fd76440ed2300"
4244+checksum = "1b8fa0e1ad5a4f4419c50b783ac565426df5c30dfa3dc9ca9602c8cd1c3535a3"
42234245 dependencies = [
42244246 "lettre",
42254247 "thiserror",
@@ -4231,9 +4253,9 @@ dependencies = [
42314253
42324254 [[package]]
42334255 name = "topcoat-router"
4234-version = "0.6.2"
4256+version = "0.8.0"
42354257 source = "registry+https://github.com/rust-lang/crates.io-index"
4236-checksum = "e062bd348df5647f6904f4f4045b3c92c08c4a8826196e8e91a51aade00b5764"
4258+checksum = "9f452945373fac2b61a4050639681829e99afeea872faebc93ef0b03c4211335"
42374259 dependencies = [
42384260 "bytes",
42394261 "form_urlencoded",
@@ -4249,6 +4271,7 @@ dependencies = [
42494271 "matchit",
42504272 "multer",
42514273 "percent-encoding",
4274+ "pin-project-lite",
42524275 "ref-cast",
42534276 "serde",
42544277 "serde_json",
@@ -4263,9 +4286,9 @@ dependencies = [
42634286
42644287 [[package]]
42654288 name = "topcoat-router-grammar"
4266-version = "0.6.2"
4289+version = "0.8.0"
42674290 source = "registry+https://github.com/rust-lang/crates.io-index"
4268-checksum = "c052423d2aa4039036f1ac5567d1e2dac48897602d34561b3024a87830e5bdce"
4291+checksum = "188df45ec401d790e3dd84564580c5c436a456331a187bdbfb7441f8e48fa1ca"
42694292 dependencies = [
42704293 "heck",
42714294 "proc-macro2",
@@ -4276,9 +4299,9 @@ dependencies = [
42764299
42774300 [[package]]
42784301 name = "topcoat-router-macro"
4279-version = "0.6.2"
4302+version = "0.8.0"
42804303 source = "registry+https://github.com/rust-lang/crates.io-index"
4281-checksum = "cea98692b786bab3adda35a60d71981f60b2a98c6e7105ac92e582b7c9ce9cab"
4304+checksum = "ac6f9a61d3ecfe1252b861795070c4317aca6b816382919d9c941eccad2fe42d"
42824305 dependencies = [
42834306 "quote",
42844307 "syn 2.0.119",
@@ -4287,9 +4310,9 @@ dependencies = [
42874310
42884311 [[package]]
42894312 name = "topcoat-runtime"
4290-version = "0.6.2"
4313+version = "0.8.0"
42914314 source = "registry+https://github.com/rust-lang/crates.io-index"
4292-checksum = "5dea200c86ca554bab7410f09cae8790a8adcbfd8f306eb78db7092ca71f8aae"
4315+checksum = "b75367a6fb32878f28bb1e42fe97385c9b14f1d3455b0bb69afb399260a8995a"
42934316 dependencies = [
42944317 "inventory",
42954318 "ref-cast",
@@ -4299,14 +4322,13 @@ dependencies = [
42994322 "topcoat-core",
43004323 "topcoat-router",
43014324 "topcoat-view",
4302- "uuid",
43034325 ]
43044326
43054327 [[package]]
43064328 name = "topcoat-runtime-grammar"
4307-version = "0.6.2"
4329+version = "0.8.0"
43084330 source = "registry+https://github.com/rust-lang/crates.io-index"
4309-checksum = "87b73f7e4e10f49e006a71dd43e8ee629c76c08451acbc51faa7ec5b6952c53c"
4331+checksum = "c19d5cf0ad59525a9fdd0a6ada36448833b39b85602736df16d32712f6c3a3c8"
43104332 dependencies = [
43114333 "proc-macro2",
43124334 "quote",
@@ -4320,9 +4342,9 @@ dependencies = [
43204342
43214343 [[package]]
43224344 name = "topcoat-runtime-macro"
4323-version = "0.6.2"
4345+version = "0.8.0"
43244346 source = "registry+https://github.com/rust-lang/crates.io-index"
4325-checksum = "5dc3e4e245abcaea6af780437cae072e8f2157c9852ec5b3058a658c61b9e0bf"
4347+checksum = "3504cd2966788c4cb6f417a9f73faf3ae2631c5aa415bc0d37d142ba597d5c42"
43264348 dependencies = [
43274349 "quote",
43284350 "syn 2.0.119",
@@ -4331,9 +4353,9 @@ dependencies = [
43314353
43324354 [[package]]
43334355 name = "topcoat-session"
4334-version = "0.6.2"
4356+version = "0.8.0"
43354357 source = "registry+https://github.com/rust-lang/crates.io-index"
4336-checksum = "e079e8c5a63987d7f929ab05a75922feab1fe390a9cfa2c101eb35829e67eac2"
4358+checksum = "d432a276f3d7e4e0af0f9789ee0c919fbfbf8d2025d0dac7f8072a918521cf6d"
43374359 dependencies = [
43384360 "base64 0.22.1",
43394361 "getrandom 0.4.3",
@@ -4348,25 +4370,26 @@ dependencies = [
43484370
43494371 [[package]]
43504372 name = "topcoat-view"
4351-version = "0.6.2"
4373+version = "0.8.0"
43524374 source = "registry+https://github.com/rust-lang/crates.io-index"
4353-checksum = "5904449bd6f633759d187fa621ded68178b551428c297959fd53d8fb91f3e6f6"
4375+checksum = "4acc959c83729cb4b967c2e7de8ee78a2fc3216cceb1be650ee9524fabd26baa"
43544376 dependencies = [
4377+ "base64 0.22.1",
43554378 "futures-core",
43564379 "futures-util",
43574380 "http",
4358- "itoa",
43594381 "memchr",
43604382 "pin-project-lite",
4383+ "siphasher",
43614384 "smallvec",
43624385 "topcoat-core",
43634386 ]
43644387
43654388 [[package]]
43664389 name = "topcoat-view-grammar"
4367-version = "0.6.2"
4390+version = "0.8.0"
43684391 source = "registry+https://github.com/rust-lang/crates.io-index"
4369-checksum = "1bf4293156d7c5fa7960edc573b686eb27426dcd888bfbe9e532304178cdda24"
4392+checksum = "fa71393a00dba3ce203d3236e24311851134721f5bfae6a17bfacd709a983660"
43704393 dependencies = [
43714394 "heck",
43724395 "proc-macro2",
@@ -4378,9 +4401,9 @@ dependencies = [
43784401
43794402 [[package]]
43804403 name = "topcoat-view-macro"
4381-version = "0.6.2"
4404+version = "0.8.0"
43824405 source = "registry+https://github.com/rust-lang/crates.io-index"
4383-checksum = "58ab2b200eda4516abdb543f307006d83fedd3681b871d2042c17106c688f716"
4406+checksum = "2a625be243364f6674204ba412700d9eed2a1c9168f7add3b1020be4825f0e49"
43844407 dependencies = [
43854408 "quote",
43864409 "syn 2.0.119",
@@ -4792,11 +4815,11 @@ dependencies = [
47924815
47934816 [[package]]
47944817 name = "ulid"
4795-version = "1.2.1"
4818+version = "3.0.0"
47964819 source = "registry+https://github.com/rust-lang/crates.io-index"
4797-checksum = "470dbf6591da1b39d43c14523b2b469c86879a53e8b758c8e090a470fe7b1fbe"
4820+checksum = "947dde63b6d514cc5e044edad4e0ca7261afd1099d16c83d942cb2b2f348689c"
47984821 dependencies = [
4799- "rand 0.9.5",
4822+ "rand 0.10.2",
48004823 "web-time",
48014824 ]
48024825
@@ -4831,6 +4854,16 @@ dependencies = [
48314854 "subtle",
48324855 ]
48334856
4857+[[package]]
4858+name = "universal-hash"
4859+version = "0.6.1"
4860+source = "registry+https://github.com/rust-lang/crates.io-index"
4861+checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96"
4862+dependencies = [
4863+ "crypto-common 0.2.2",
4864+ "ctutils",
4865+]
4866+
48344867 [[package]]
48354868 name = "untrusted"
48364869 version = "0.9.0"
Cargo.tomlmodified+3 -3
@@ -18,7 +18,7 @@ im-core = { path = "crates/im-core", default-features = false }
1818 serde = { version = "1.0.229", features = ["derive"] }
1919 serde_json = "1.0.151"
2020 thiserror = "2.0.20"
21-ulid = "1"
21+ulid = "3"
2222 time = { version = "0.3.55", features = ["serde", "formatting", "parsing", "macros"] }
2323 tokio = { version = "1.53.1", features = ["full"] }
2424 turso = "=0.8.0-pre.10"
@@ -26,8 +26,8 @@ argon2 = "0.6.0"
2626 rand = "0.10.2"
2727 sha2 = "0.11.0"
2828 subtle = "2.6.1"
29-chacha20poly1305 = "0.10.1"
30-base64 = "0.22.1"
29+chacha20poly1305 = "0.11.0"
30+base64 = "0.23.1"
3131 toml = "1"
3232 async-trait = "0.1.92"
3333
crates/im-client/Cargo.tomlmodified+8 -9
@@ -15,7 +15,7 @@ default = ["oidc"]
1515 oidc = []
1616
1717 [dependencies]
18-topcoat = { version = "0.6.2", default-features = false, features = [
18+topcoat = { version = "0.8.0", default-features = false, features = [
1919 "router",
2020 "cookie",
2121 ] }
@@ -29,10 +29,9 @@ rand.workspace = true
2929 sha2.workspace = true
3030 subtle.workspace = true
3131 chacha20poly1305.workspace = true
32-# rsa 0.9 verifies through the digest 0.10 traits, so its hasher comes from
33-# the sha2 0.10 line; the workspace sha2 0.11 stays for PKCE.
34-sha2-for-rsa = { package = "sha2", version = "0.10", features = ["oid"] }
35-rsa = "0.9.10"
32+# rsa 0.10 verifies through the digest 0.11 traits, so its hasher is the
33+# workspace sha2 0.11 that PKCE already uses.
34+rsa = "0.10.0-rc.18"
3635 reqwest = { version = "0.13.5", default-features = false, features = [
3736 "rustls",
3837 "json",
@@ -46,7 +45,7 @@ name = "demo"
4645 required-features = ["oidc"]
4746
4847 [dev-dependencies]
49-topcoat = { version = "0.6.2", default-features = false, features = [
48+topcoat = { version = "0.8.0", default-features = false, features = [
5049 "router",
5150 "cookie",
5251 "view",
@@ -54,6 +53,6 @@ topcoat = { version = "0.6.2", default-features = false, features = [
5453 "discover",
5554 ] }
5655 http = "1.5"
57-# Tests generate their own RSA keys, and rsa 0.9's RNG is the rand_core 0.6
58-# line.
59-rand_core06 = { package = "rand_core", version = "0.6.4", features = ["getrandom"] }
56+# Tests generate their own RSA keys, and rsa 0.10's RNG is the rand_core 0.10
57+# line that the workspace rand 0.10 provides.
58+rand_core010 = { package = "rand_core", version = "0.10.1" }
crates/im-client/src/directory.rsmodified+4 -4
@@ -257,10 +257,10 @@ impl SseParser {
257257 fn take_event(&mut self) -> Option<DirectoryEvent> {
258258 let data = std::mem::take(&mut self.data);
259259 let event = self.event.take();
260- if let Some(kind) = event {
261- if kind != "profile" {
262- return None;
263- }
260+ if let Some(kind) = event
261+ && kind != "profile"
262+ {
263+ return None;
264264 }
265265 serde_json::from_str::<DirectoryMember>(&data)
266266 .ok()
crates/im-client/src/oidc.rsmodified+10 -10
@@ -178,8 +178,9 @@ fn seal(key: &[u8; 32], plaintext: &[u8]) -> String {
178178 let cipher = XChaCha20Poly1305::new(key.into());
179179 let mut nonce_bytes = [0u8; 24];
180180 rand::rng().fill_bytes(&mut nonce_bytes);
181+ let nonce = XNonce::from(nonce_bytes);
181182 let ciphertext = cipher
182- .encrypt(XNonce::from_slice(&nonce_bytes), plaintext)
183+ .encrypt(&nonce, plaintext)
183184 .expect("XChaCha20-Poly1305 cannot fail on a payload this small");
184185 let mut payload = nonce_bytes.to_vec();
185186 payload.extend_from_slice(&ciphertext);
@@ -193,9 +194,8 @@ fn open(key: &[u8; 32], sealed: &str) -> Option<Vec<u8>> {
193194 }
194195 let (nonce_bytes, ciphertext) = payload.split_at(24);
195196 let cipher = XChaCha20Poly1305::new(key.into());
196- cipher
197- .decrypt(XNonce::from_slice(nonce_bytes), ciphertext)
198- .ok()
197+ let nonce: &XNonce = nonce_bytes.try_into().ok()?;
198+ cipher.decrypt(nonce, ciphertext).ok()
199199 }
200200
201201 fn seal_json<T: Serialize>(key: &[u8; 32], value: &T) -> String {
@@ -514,7 +514,7 @@ fn verify_claims(
514514 .map_err(|e| Error::Token(e.to_string()))?;
515515 let signature = rsa::pkcs1v15::Signature::try_from(signature_bytes.as_slice())
516516 .map_err(|e| Error::Token(e.to_string()))?;
517- let verifying = rsa::pkcs1v15::VerifyingKey::<sha2_for_rsa::Sha256>::new(key.clone());
517+ let verifying = rsa::pkcs1v15::VerifyingKey::<sha2::Sha256>::new(key.clone());
518518 verifying
519519 .verify(format!("{}.{}", parts[0], parts[1]).as_bytes(), &signature)
520520 .map_err(|_| Error::Token("bad signature".into()))?;
@@ -575,8 +575,8 @@ async fn refetch_jwks(state: &ImClient) -> Result<()> {
575575 continue;
576576 };
577577 let key = rsa::RsaPublicKey::new(
578- rsa::BigUint::from_bytes_be(&n),
579- rsa::BigUint::from_bytes_be(&e),
578+ rsa::BoxedUint::from_be_slice_vartime(&n),
579+ rsa::BoxedUint::from_be_slice_vartime(&e),
580580 )
581581 .map_err(|err| Error::Token(format!("bad jwk {kid}: {err}")))?;
582582 keys.push((kid.to_string(), key));
@@ -595,8 +595,8 @@ mod tests {
595595
596596 fn keypair() -> (rsa::RsaPrivateKey, rsa::RsaPublicKey) {
597597 // 2048-bit generation is slow for a unit test; 1024 is the smallest
598- // rsa 0.9 accepts and the signature math under test is identical.
599- let private = rsa::RsaPrivateKey::new(&mut rand_core06::OsRng, 1024).unwrap();
598+ // rsa accepts and the signature math under test is identical.
599+ let private = rsa::RsaPrivateKey::new(&mut rand::rng(), 1024).unwrap();
600600 let public = private.to_public_key();
601601 (private, public)
602602 }
@@ -606,7 +606,7 @@ mod tests {
606606 let mut out = b64url.encode(header.to_string());
607607 out.push('.');
608608 out.push_str(&b64url.encode(claims.to_string()));
609- let signing = rsa::pkcs1v15::SigningKey::<sha2_for_rsa::Sha256>::new(key.clone());
609+ let signing = rsa::pkcs1v15::SigningKey::<sha2::Sha256>::new(key.clone());
610610 let signature = signing.sign(out.as_bytes());
611611 format!("{}.{}", out, b64url.encode(signature.to_bytes()))
612612 }
crates/im-core/Cargo.tomlmodified+4 -7
@@ -22,7 +22,6 @@ server = [
2222 "dep:rsa",
2323 "dep:sha1",
2424 "dep:sha2",
25- "dep:sha2-for-rsa",
2625 "dep:subtle",
2726 "dep:tokio",
2827 "dep:turso",
@@ -36,14 +35,12 @@ chacha20poly1305 = { workspace = true, optional = true }
3635 data-encoding = { version = "2.11.1", optional = true }
3736 hmac = { version = "0.13.0", optional = true }
3837 rand = { workspace = true, optional = true }
39-# rsa 0.9 sits on the rand_core 0.6 / digest 0.10 trait lines, so its RNG
40-# and its hasher come from those lines, not the workspace's rand 0.10 /
41-# sha2 0.11. sha2 0.11 stays for token digests.
42-rand_core = { version = "0.6.4", features = ["getrandom"], optional = true }
43-rsa = { version = "0.9.10", optional = true }
38+# rsa 0.10 sits on the rand_core 0.10 / digest 0.11 trait lines, so its RNG
39+# and its hasher come from those lines: the workspace rand 0.10 / sha2 0.11.
40+rand_core = { version = "0.10.1", optional = true }
41+rsa = { version = "0.10.0-rc.18", optional = true }
4442 sha1 = { version = "0.11.0", optional = true }
4543 sha2 = { workspace = true, optional = true }
46-sha2-for-rsa = { package = "sha2", version = "0.10", features = ["oid"], optional = true }
4744 subtle = { workspace = true, optional = true }
4845 serde.workspace = true
4946 serde_json.workspace = true
crates/im-core/src/accounts.rsmodified+19 -19
@@ -909,10 +909,10 @@ fn normalize_email(email: &str) -> std::result::Result<String, AccountError> {
909909 /// address the account already carries quietly succeeds.
910910 pub async fn set_email(store: &Store, user: &UserId, email: &str) -> std::result::Result<(), AccountError> {
911911 let email = normalize_email(email)?;
912- if let Some(other) = user_by_email(store, &email).await? {
913- if other.id != *user {
914- return Err(AccountError::EmailTaken);
915- }
912+ if let Some(other) = user_by_email(store, &email).await?
913+ && other.id != *user
914+ {
915+ return Err(AccountError::EmailTaken);
916916 }
917917 let conn = store.conn.lock().await;
918918 conn.execute(
@@ -953,10 +953,10 @@ pub async fn request_email_change(
953953 if new_email == old_email {
954954 return Err(AccountError::SameEmail);
955955 }
956- if let Some(other) = user_by_email(store, &new_email).await? {
957- if other.id != *user {
958- return Err(AccountError::EmailTaken);
959- }
956+ if let Some(other) = user_by_email(store, &new_email).await?
957+ && other.id != *user
958+ {
959+ return Err(AccountError::EmailTaken);
960960 }
961961 let old_token = Token::mint();
962962 let new_token = Token::mint();
@@ -1040,17 +1040,17 @@ pub async fn confirm_email_change(
10401040 }
10411041 let completes = (clicked_old && new_done) || (!clicked_old && old_done);
10421042 if completes {
1043- if let Some(other) = user_by_email(store, &new_email).await? {
1044- if other.id != user_id {
1045- let conn = store.conn.lock().await;
1046- conn.execute(
1047- "DELETE FROM email_changes WHERE old_token_hash = ?1 OR new_token_hash = ?1",
1048- turso::params![hash],
1049- )
1050- .await
1051- .map_err(backend)?;
1052- return Err(AccountError::EmailTaken);
1053- }
1043+ if let Some(other) = user_by_email(store, &new_email).await?
1044+ && other.id != user_id
1045+ {
1046+ let conn = store.conn.lock().await;
1047+ conn.execute(
1048+ "DELETE FROM email_changes WHERE old_token_hash = ?1 OR new_token_hash = ?1",
1049+ turso::params![hash],
1050+ )
1051+ .await
1052+ .map_err(backend)?;
1053+ return Err(AccountError::EmailTaken);
10541054 }
10551055 set_email(store, &user_id, &new_email).await?;
10561056 let stamp = store::stamp(store::now())?;
crates/im-core/src/events.rsmodified+1 -1
@@ -22,7 +22,7 @@ pub async fn log(store: &Store, kind: &str, actor: Option<&str>, detail: Option<
2222 .execute(
2323 "INSERT INTO events (id, at, kind, actor, detail) VALUES (?1, ?2, ?3, ?4, ?5)",
2424 turso::params![
25- ulid::Ulid::new().to_string(),
25+ ulid::Ulid::generate().to_string(),
2626 store::stamp(store::now()).expect("rfc3339 of now"),
2727 kind,
2828 actor,
crates/im-core/src/keys.rsmodified+4 -3
@@ -5,6 +5,7 @@
55 //! XChaCha20-Poly1305 envelope of its PKCS#8 DER under `im.key`, and only
66 //! `active_signing_key` (signing) and `jwks` (the public half) cross the
77 //! boundary.
8+use rand::SeedableRng as _;
89 use rsa::pkcs8::{DecodePrivateKey, DecodePublicKey, EncodePrivateKey, EncodePublicKey};
910 use rsa::traits::PublicKeyParts;
1011 use rsa::{RsaPrivateKey, RsaPublicKey};
@@ -38,7 +39,7 @@ pub async fn active_signing_key(store: &Store) -> Result<(String, RsaPrivateKey)
3839 return Ok((kid, key));
3940 }
4041
41- let mut rng = rand_core::OsRng;
42+ let mut rng = rand::rngs::StdRng::from_rng(&mut rand::rng());
4243 let key = RsaPrivateKey::new(&mut rng, 2048)
4344 .map_err(|e| StoreError::Backend(format!("key generation: {e}")))?;
4445 let public_der = key
@@ -96,8 +97,8 @@ pub async fn jwks(store: &Store) -> Result<serde_json::Value> {
9697 "use": "sig",
9798 "alg": "RS256",
9899 "kid": kid,
99- "n": b64.encode(public.n().to_bytes_be()),
100- "e": b64.encode(public.e().to_bytes_be()),
100+ "n": b64.encode(public.n().to_be_bytes_trimmed_vartime()),
101+ "e": b64.encode(public.e().to_be_bytes_trimmed_vartime()),
101102 }));
102103 }
103104 Ok(serde_json::json!({ "keys": keys }))
crates/im-core/src/model.rsmodified+1 -1
@@ -23,7 +23,7 @@ macro_rules! id_wrapper {
2323 /// A fresh ULID — sortable, URL-safe, unguessable enough for an id.
2424 #[cfg(feature = "server")]
2525 pub fn mint() -> Self {
26- Self(ulid::Ulid::new().to_string())
26+ Self(ulid::Ulid::generate().to_string())
2727 }
2828
2929 pub fn as_str(&self) -> &str {
crates/im-core/src/oidc.rsmodified+5 -7
@@ -43,7 +43,7 @@ pub fn sign_jwt(claims: &serde_json::Value, kid: &str, key: &RsaPrivateKey) -> S
4343 let mut out = b64url.encode(header.to_string());
4444 out.push('.');
4545 out.push_str(&b64url.encode(claims.to_string()));
46- let signing = rsa::pkcs1v15::SigningKey::<sha2_for_rsa::Sha256>::new(key.clone());
46+ let signing = rsa::pkcs1v15::SigningKey::<sha2::Sha256>::new(key.clone());
4747 let signature = signing.sign(out.as_bytes());
4848 out.push('.');
4949 out.push_str(&b64url.encode(signature.to_bytes()));
@@ -474,7 +474,7 @@ pub async fn verify_jwt(
474474 let Ok(signature) = rsa::pkcs1v15::Signature::try_from(signature_bytes.as_slice()) else {
475475 return Ok(None);
476476 };
477- let verifying = rsa::pkcs1v15::VerifyingKey::<sha2_for_rsa::Sha256>::new(public);
477+ let verifying = rsa::pkcs1v15::VerifyingKey::<sha2::Sha256>::new(public);
478478 if verifying
479479 .verify(format!("{}.{}", parts[0], parts[1]).as_bytes(), &signature)
480480 .is_err()
@@ -487,10 +487,8 @@ pub async fn verify_jwt(
487487 let Ok(claims) = serde_json::from_slice::<serde_json::Value>(&claims_bytes) else {
488488 return Ok(None);
489489 };
490- if let Some(audience) = audience {
491- if claims["aud"].as_str() != Some(audience) {
492- return Ok(None);
493- }
490+ if let Some(audience) = audience && claims["aud"].as_str() != Some(audience) {
491+ return Ok(None);
494492 }
495493 let Some(exp) = claims["exp"].as_i64() else {
496494 return Ok(None);
@@ -771,7 +769,7 @@ mod tests {
771769 assert_eq!(claims["sub"], "u1");
772770
773771 let verifying =
774- rsa::pkcs1v15::VerifyingKey::<sha2_for_rsa::Sha256>::new(key.to_public_key());
772+ rsa::pkcs1v15::VerifyingKey::<sha2::Sha256>::new(key.to_public_key());
775773 let signature =
776774 rsa::pkcs1v15::Signature::try_from(b64url.decode(parts[2]).unwrap().as_slice())
777775 .unwrap();
crates/im-core/src/photos.rsmodified+2 -2
@@ -26,7 +26,7 @@ fn photo_file(store: &Store, user_id: &str) -> std::path::PathBuf {
2626 /// there before intact, never a truncated one under the real name.
2727 fn write_file_atomic(path: &std::path::Path, bytes: &[u8]) -> std::io::Result<()> {
2828 use std::io::Write as _;
29- let tmp = path.with_extension(format!("{}.tmp", ulid::Ulid::new()));
29+ let tmp = path.with_extension(format!("{}.tmp", ulid::Ulid::generate()));
3030 let mut file = std::fs::File::create(&tmp)?;
3131 file.write_all(bytes)?;
3232 file.sync_all()?;
@@ -42,7 +42,7 @@ pub async fn set_photo(store: &Store, user: &UserId, bytes: &[u8], mime: &str) -
4242 // leaves the committed photo exactly as it was, and a crash between
4343 // commit and rename serves the old bytes next to a staged file the boot
4444 // sweep collects — stale, never destroyed.
45- let staged = path.with_extension(format!("incoming-{}", ulid::Ulid::new()));
45+ let staged = path.with_extension(format!("incoming-{}", ulid::Ulid::generate()));
4646 write_file_atomic(&staged, bytes).map_err(|e| StoreError::Backend(e.to_string()))?;
4747 let written = {
4848 let conn = store.conn.lock().await;
crates/im-core/src/secret.rsmodified+3 -3
@@ -42,9 +42,9 @@ pub fn seal(key: &Key, plaintext: &[u8]) -> String {
4242 let cipher = XChaCha20Poly1305::new(key.into());
4343 let mut nonce_bytes = [0u8; NONCE_BYTES];
4444 rand::rng().fill_bytes(&mut nonce_bytes);
45- let nonce = XNonce::from_slice(&nonce_bytes);
45+ let nonce = XNonce::from(nonce_bytes);
4646 let ciphertext = cipher
47- .encrypt(nonce, plaintext)
47+ .encrypt(&nonce, plaintext)
4848 .expect("XChaCha20-Poly1305 cannot fail to encrypt a plaintext this small");
4949 let mut payload = Vec::with_capacity(NONCE_BYTES + ciphertext.len());
5050 payload.extend_from_slice(&nonce_bytes);
@@ -63,7 +63,7 @@ pub fn open(key: &Key, sealed: &str) -> Option<Vec<u8>> {
6363 }
6464 let (nonce_bytes, ciphertext) = payload.split_at(NONCE_BYTES);
6565 let cipher = XChaCha20Poly1305::new(key.into());
66- let nonce = XNonce::from_slice(nonce_bytes);
66+ let nonce: &XNonce = nonce_bytes.try_into().ok()?;
6767 cipher.decrypt(nonce, ciphertext).ok()
6868 }
6969
crates/im-core/src/settings.rsmodified+12 -13
@@ -218,15 +218,15 @@ pub async fn set_smtp(store: &Store, smtp: &Smtp, password: Option<&str>) -> Res
218218 set(store, "smtp_username", &smtp.username).await?;
219219 set(store, "smtp_from", &smtp.from).await?;
220220 set(store, "smtp_from_name", &smtp.from_name).await?;
221- if let Some(password) = password {
222- if !password.is_empty() {
223- set(
224- store,
225- "smtp_password",
226- &secret::seal(store.key(), password.as_bytes()),
227- )
228- .await?;
229- }
221+ if let Some(password) = password
222+ && !password.is_empty()
223+ {
224+ set(
225+ store,
226+ "smtp_password",
227+ &secret::seal(store.key(), password.as_bytes()),
228+ )
229+ .await?;
230230 }
231231 Ok(())
232232 }
@@ -480,17 +480,16 @@ mod tests {
480480 assert_eq!(policy(&store).await.unwrap().max_sessions, 5);
481481
482482 // A written value comes back...
483- let mut value = Policy::default();
484- value.max_sessions = 2;
483+ let value = Policy { max_sessions: 2, ..Policy::default() };
485484 set_policy(&store, &value).await.unwrap();
486485 assert_eq!(policy(&store).await.unwrap().max_sessions, 2);
487486
488487 // ...and zero or negative — a cap that would lock every user out
489488 // of their own account — clamps back to the default, unstored.
490- value.max_sessions = 0;
489+ let value = Policy { max_sessions: 0, ..Policy::default() };
491490 set_policy(&store, &value).await.unwrap();
492491 assert_eq!(policy(&store).await.unwrap().max_sessions, 5);
493- value.max_sessions = -3;
492+ let value = Policy { max_sessions: -3, ..Policy::default() };
494493 set_policy(&store, &value).await.unwrap();
495494 assert_eq!(policy(&store).await.unwrap().max_sessions, 5);
496495 }
crates/im-core/src/store.rsmodified+1 -1
@@ -351,7 +351,7 @@ impl Store {
351351 /// is a fresh tempdir, as throwaway as the database itself.
352352 fn photos_dir(path: &Path) -> std::path::PathBuf {
353353 if path.as_os_str() == ":memory:" {
354- return std::env::temp_dir().join(format!("im-storage-{}", ulid::Ulid::new()));
354+ return std::env::temp_dir().join(format!("im-storage-{}", ulid::Ulid::generate()));
355355 }
356356 path.parent()
357357 .filter(|d| !d.as_os_str().is_empty())
crates/im-migrate/src/main.rsmodified+1 -1
@@ -269,7 +269,7 @@ async fn run(args: &Args) -> Result<Report> {
269269 mapping.push_str(&format!("{},{sub}\n", user.id));
270270 continue;
271271 }
272- let sub = ulid::Ulid::new().to_string();
272+ let sub = ulid::Ulid::generate().to_string();
273273 conn.execute(
274274 "INSERT INTO users (id, email, name, password_hash, created_at) \
275275 VALUES (?1, ?2, ?3, ?4, ?5)",
crates/im-web/Cargo.tomlmodified+1 -1
@@ -8,7 +8,7 @@ description = "im web app: topcoat UI, OIDC endpoints and the server"
88 build = "build.rs"
99
1010 [dependencies]
11-topcoat = { version = "0.6.2", default-features = false, features = [
11+topcoat = { version = "0.8.0", default-features = false, features = [
1212 "router",
1313 "view",
1414 "runtime",
crates/im-web/src/admin.rsmodified+136 -117
@@ -13,7 +13,7 @@ use topcoat::cookie::Cookies;
1313 use topcoat::router::content::Form;
1414 use topcoat::router::response::{IntoResponse, Response};
1515 use topcoat::router::{HeaderValue, StatusCode, header, route};
16-use topcoat::view::view;
16+use topcoat::view::{Child, ViewExt, view};
1717
1818 use crate::i18n::{self, Key, lang_of, t};
1919 use crate::layout::shell;
@@ -26,15 +26,17 @@ fn app(cx: &Cx) -> &App {
2626 }
2727
2828 /// The admin behind this request, or the redirect the request gets instead.
29-async fn require_admin(cx: &Cx) -> std::result::Result<User, Response> {
29+async fn require_admin(cx: &Cx) -> std::result::Result<User, Box<Response>> {
3030 match server::current_user(cx).await {
3131 Some(user) if user.admin => Ok(user),
32- _ => Err((
33- StatusCode::SEE_OTHER,
34- [(header::LOCATION, HeaderValue::from_static("/"))],
35- )
36- .into_response(cx)
37- .expect("a redirect can always be built")),
32+ _ => Err(Box::new(
33+ (
34+ StatusCode::SEE_OTHER,
35+ [(header::LOCATION, HeaderValue::from_static("/"))],
36+ )
37+ .into_response(cx)
38+ .expect("a redirect can always be built"),
39+ )),
3840 }
3941 }
4042
@@ -49,18 +51,30 @@ fn escape(raw: &str) -> String {
4951
5052 /// One row action as a two-step disclosure — iz's `confirm-details` idiom:
5153 /// the summary is the word ("Delete"), the opened panel says what it costs
52-/// and holds the button that actually does it. Works with no script at all;
53-/// the live script adds outside-click closing.
54-fn confirm_action(
55- field: &str,
56- id: &str,
57- action: &str,
58- word: &str,
59- extra_class: &str,
60- title: &str,
61- cost: &str,
62- confirm: &str,
63-) -> String {
54+/// and holds the button that actually does it. The eight `&str`s travel as
55+/// named fields: eight positional parameters tripped the too-many-arguments
56+/// lint, and the names read better at the call sites anyway.
57+struct ConfirmAction<'a> {
58+ field: &'a str,
59+ id: &'a str,
60+ action: &'a str,
61+ word: &'a str,
62+ extra_class: &'a str,
63+ title: &'a str,
64+ cost: &'a str,
65+ confirm: &'a str,
66+}
67+fn confirm_action(ask: ConfirmAction<'_>) -> String {
68+ let ConfirmAction {
69+ field,
70+ id,
71+ action,
72+ word,
73+ extra_class,
74+ title,
75+ cost,
76+ confirm,
77+ } = ask;
6478 format!(
6579 r#"<details class="admin-confirm"><summary class="admin-action{extra_class}">{word}</summary><div class="admin-confirm-pop"><div class="admin-confirm-title">{title}</div><div class="muted">{cost}</div><form method="post" action="{action}"><input type="hidden" name="{field}" value="{id}"><button class="admin-action{extra_class}" type="submit">{confirm}</button></form></div></details>"#
6680 )
@@ -110,7 +124,7 @@ fn back(cx: &Cx, section: &str, extra: &str) -> Result<Response> {
110124 async fn admin_page(cx: &Cx) -> Result<Response> {
111125 let me = match require_admin(cx).await {
112126 Ok(me) => me,
113- Err(redirect) => return Ok(redirect),
127+ Err(redirect) => return Ok(*redirect),
114128 };
115129 let lang = lang_of(Some(&me));
116130 let query = topcoat::router::request::uri(cx)
@@ -188,6 +202,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
188202 _ => None,
189203 };
190204
205+ let my_email = escape(&me.email);
191206 let stage = view! {
192207 cx =>
193208 <main class="admin-shell">
@@ -197,7 +212,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
197212 // topbar; the address stays a link too.
198213 <a class="wordmark-text wordmark-home" href="/">"im"</a>
199214 <nav class="admin-tabs">(topcoat::view::Unescaped::new_unchecked(nav(&section)))</nav>
200- <a class="auth-alt" href="/">(escape(&me.email))</a>
215+ <a class="auth-alt" href="/">(my_email)</a>
201216 </div>
202217 if let Some(banner) = banner {
203218 (topcoat::view::Unescaped::new_unchecked(banner))
@@ -207,7 +222,9 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
207222 </div>
208223 </main>
209224 };
210- shell(cx, t(lang, Key::TitleAdmin), Some(&me), stage)
225+ shell(cx, t(lang, Key::TitleAdmin), Some(me), Child::new(stage))
226+ .await?
227+ .first()
211228 .await?
212229 .into_response(cx)
213230 }
@@ -330,38 +347,38 @@ async fn users_section(
330347 // the button that actually does it. No script required; the live
331348 // script adds outside-click closing on top.
332349 let toggle = if user.disabled {
333- confirm_action(
334- "user",
335- &id,
336- "/admin/enable",
337- t(lang, Key::EnableWord),
338- "",
339- &i18n::enable_title(lang, &email),
340- t(lang, Key::EnableCost),
341- t(lang, Key::ConfirmEnable),
342- )
350+ confirm_action(ConfirmAction {
351+ field: "user",
352+ id: &id,
353+ action: "/admin/enable",
354+ word: t(lang, Key::EnableWord),
355+ extra_class: "",
356+ title: &i18n::enable_title(lang, &email),
357+ cost: t(lang, Key::EnableCost),
358+ confirm: t(lang, Key::ConfirmEnable),
359+ })
343360 } else {
344- confirm_action(
345- "user",
346- &id,
347- "/admin/disable",
348- t(lang, Key::DisableWord),
349- "",
350- &i18n::disable_title(lang, &email),
351- t(lang, Key::DisableCost),
352- t(lang, Key::ConfirmDisable),
353- )
361+ confirm_action(ConfirmAction {
362+ field: "user",
363+ id: &id,
364+ action: "/admin/disable",
365+ word: t(lang, Key::DisableWord),
366+ extra_class: "",
367+ title: &i18n::disable_title(lang, &email),
368+ cost: t(lang, Key::DisableCost),
369+ confirm: t(lang, Key::ConfirmDisable),
370+ })
354371 };
355- let remove = confirm_action(
356- "user",
357- &id,
358- "/admin/delete",
359- t(lang, Key::DeleteWord),
360- " admin-danger",
361- &i18n::delete_title(lang, &email),
362- t(lang, Key::DeleteCost),
363- t(lang, Key::ConfirmDelete),
364- );
372+ let remove = confirm_action(ConfirmAction {
373+ field: "user",
374+ id: &id,
375+ action: "/admin/delete",
376+ word: t(lang, Key::DeleteWord),
377+ extra_class: " admin-danger",
378+ title: &i18n::delete_title(lang, &email),
379+ cost: t(lang, Key::DeleteCost),
380+ confirm: t(lang, Key::ConfirmDelete),
381+ });
365382 format!(
366383 r#"{toggle}<form method="post" action="/admin/revoke"><input type="hidden" name="user" value="{id}"><button class="admin-action" type="submit">{sign_out}</button></form>{remove}"#,
367384 sign_out = t(lang, Key::SignOutEverywhere),
@@ -524,16 +541,16 @@ async fn services_section(
524541 kept_word = t(lang, Key::ServiceKept),
525542 )
526543 } else {
527- confirm_action(
528- "key",
529- &key,
530- "/admin/services_remove",
531- t(lang, Key::Remove),
532- " admin-danger",
533- &i18n::remove_service_title(lang, &name),
534- t(lang, Key::RemoveCost),
535- t(lang, Key::ConfirmRemove),
536- )
544+ confirm_action(ConfirmAction {
545+ field: "key",
546+ id: &key,
547+ action: "/admin/services_remove",
548+ word: t(lang, Key::Remove),
549+ extra_class: " admin-danger",
550+ title: &i18n::remove_service_title(lang, &name),
551+ cost: t(lang, Key::RemoveCost),
552+ confirm: t(lang, Key::ConfirmRemove),
553+ })
537554 };
538555 let (client_cell, uris_cell, registered_cell, client_actions) =
539556 match linked(service.client_id.as_ref()) {
@@ -647,26 +664,26 @@ async fn services_section(
647664 /// A client's Rotate/Revoke pair, as the two-step disclosures — the same
648665 /// controls on a linked service row and on a credential-only row.
649666 fn client_controls(client_id: &str, name_html: &str, lang: i18n::Lang) -> String {
650- let rotate = confirm_action(
651- "client",
652- client_id,
653- "/admin/clients_rotate",
654- t(lang, Key::RotateWord),
655- "",
656- &i18n::rotate_client_title(lang, name_html),
657- t(lang, Key::RotateCost),
658- t(lang, Key::ConfirmRotate),
659- );
660- let revoke_action = confirm_action(
661- "client",
662- client_id,
663- "/admin/clients_revoke",
664- t(lang, Key::RevokeWord),
665- " admin-danger",
666- &i18n::revoke_client_title(lang, name_html),
667- t(lang, Key::RevokeCost),
668- t(lang, Key::ConfirmRevoke),
669- );
667+ let rotate = confirm_action(ConfirmAction {
668+ field: "client",
669+ id: client_id,
670+ action: "/admin/clients_rotate",
671+ word: t(lang, Key::RotateWord),
672+ extra_class: "",
673+ title: &i18n::rotate_client_title(lang, name_html),
674+ cost: t(lang, Key::RotateCost),
675+ confirm: t(lang, Key::ConfirmRotate),
676+ });
677+ let revoke_action = confirm_action(ConfirmAction {
678+ field: "client",
679+ id: client_id,
680+ action: "/admin/clients_revoke",
681+ word: t(lang, Key::RevokeWord),
682+ extra_class: " admin-danger",
683+ title: &i18n::revoke_client_title(lang, name_html),
684+ cost: t(lang, Key::RevokeCost),
685+ confirm: t(lang, Key::ConfirmRevoke),
686+ });
670687 format!("{rotate}{revoke_action}")
671688 }
672689
@@ -749,7 +766,7 @@ struct ServiceForm {
749766 async fn services_add(cx: &Cx, Form(input): Form<ServiceForm>) -> Result<Response> {
750767 let me = match require_admin(cx).await {
751768 Ok(me) => me,
752- Err(redirect) => return Ok(redirect),
769+ Err(redirect) => return Ok(*redirect),
753770 };
754771 let limit = match posted_limit(&input.limit_amount, &input.limit_unit) {
755772 Ok(limit) => limit,
@@ -774,7 +791,7 @@ async fn services_add(cx: &Cx, Form(input): Form<ServiceForm>) -> Result<Respons
774791 async fn services_edit(cx: &Cx, Form(input): Form<ServiceForm>) -> Result<Response> {
775792 let me = match require_admin(cx).await {
776793 Ok(me) => me,
777- Err(redirect) => return Ok(redirect),
794+ Err(redirect) => return Ok(*redirect),
778795 };
779796 let limit = match posted_limit(&input.limit_amount, &input.limit_unit) {
780797 Ok(limit) => limit,
@@ -800,7 +817,7 @@ struct ServiceKeyForm {
800817 async fn services_remove(cx: &Cx, Form(input): Form<ServiceKeyForm>) -> Result<Response> {
801818 let me = match require_admin(cx).await {
802819 Ok(me) => me,
803- Err(redirect) => return Ok(redirect),
820+ Err(redirect) => return Ok(*redirect),
804821 };
805822 let outcome = im_core::services::remove(&app(cx).store, &input.key).await;
806823 service_outcome(cx, &me, outcome).await
@@ -817,7 +834,7 @@ struct ServiceMoveForm {
817834 async fn services_move(cx: &Cx, Form(input): Form<ServiceMoveForm>) -> Result<Response> {
818835 let me = match require_admin(cx).await {
819836 Ok(me) => me,
820- Err(redirect) => return Ok(redirect),
837+ Err(redirect) => return Ok(*redirect),
821838 };
822839 let up = match input.dir.as_str() {
823840 "up" => true,
@@ -862,7 +879,7 @@ struct ClientForm {
862879 async fn clients_add(cx: &Cx, Form(input): Form<ClientForm>) -> Result<Response> {
863880 let me = match require_admin(cx).await {
864881 Ok(me) => me,
865- Err(redirect) => return Ok(redirect),
882+ Err(redirect) => return Ok(*redirect),
866883 };
867884 let name = input.name.trim().to_string();
868885 let uris: Vec<String> = input
@@ -890,7 +907,7 @@ struct ClientAction {
890907 async fn clients_rotate(cx: &Cx, Form(input): Form<ClientAction>) -> Result<Response> {
891908 let me = match require_admin(cx).await {
892909 Ok(me) => me,
893- Err(redirect) => return Ok(redirect),
910+ Err(redirect) => return Ok(*redirect),
894911 };
895912 // The log line names the client like a person, so the name comes off
896913 // the row before the secret under it moves.
@@ -913,7 +930,7 @@ async fn clients_rotate(cx: &Cx, Form(input): Form<ClientAction>) -> Result<Resp
913930 async fn clients_revoke(cx: &Cx, Form(input): Form<ClientAction>) -> Result<Response> {
914931 let me = match require_admin(cx).await {
915932 Ok(me) => me,
916- Err(redirect) => return Ok(redirect),
933+ Err(redirect) => return Ok(*redirect),
917934 };
918935 let name = match im_core::oidc::client_by_id(&app(cx).store, &input.client).await? {
919936 Some(client) => client.name,
@@ -983,7 +1000,7 @@ struct PolicyForm {
9831000 async fn settings_save(cx: &Cx, Form(input): Form<PolicyForm>) -> Result<Response> {
9841001 let me = match require_admin(cx).await {
9851002 Ok(me) => me,
986- Err(redirect) => return Ok(redirect),
1003+ Err(redirect) => return Ok(*redirect),
9871004 };
9881005 let store = &app(cx).store;
9891006 settings::set_policy(
@@ -1361,6 +1378,22 @@ async fn logs_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Erro
13611378 );
13621379 }
13631380
1381+ let dir_options = format!(
1382+ r#"<option value=""{}>{}</option><option value="oldest"{}>{}</option>"#,
1383+ if dir == events::Dir::Newest {
1384+ " selected"
1385+ } else {
1386+ ""
1387+ },
1388+ t(lang, Key::NewestFirst),
1389+ if dir == events::Dir::Oldest {
1390+ " selected"
1391+ } else {
1392+ ""
1393+ },
1394+ t(lang, Key::OldestFirst),
1395+ );
1396+
13641397 Ok(format!(
13651398 r#"<div class="admin-card">
13661399 <div class="auth-title">{title}</div>
@@ -1394,21 +1427,7 @@ async fn logs_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Erro
13941427 q_value = escape(filter.q.as_deref().unwrap_or("")),
13951428 from_value = escape(&pick("from").unwrap_or_default()),
13961429 to_value = escape(&pick("to").unwrap_or_default()),
1397- dir_options = format!(
1398- r#"<option value=""{}>{}</option><option value="oldest"{}>{}</option>"#,
1399- if dir == events::Dir::Newest {
1400- " selected"
1401- } else {
1402- ""
1403- },
1404- t(lang, Key::NewestFirst),
1405- if dir == events::Dir::Oldest {
1406- " selected"
1407- } else {
1408- ""
1409- },
1410- t(lang, Key::OldestFirst),
1411- ),
1430+ dir_options = dir_options,
14121431 ))
14131432 .map(|card| card + LOG_FIT_SCRIPT)
14141433 }
@@ -1491,7 +1510,7 @@ struct InviteForm {
14911510 async fn invite(cx: &Cx, Form(input): Form<InviteForm>) -> Result<Response> {
14921511 let me = match require_admin(cx).await {
14931512 Ok(me) => me,
1494- Err(redirect) => return Ok(redirect),
1513+ Err(redirect) => return Ok(*redirect),
14951514 };
14961515 let store = &app(cx).store;
14971516 let email = input.email.trim().to_string();
@@ -1543,7 +1562,7 @@ struct UserEmailForm {
15431562 async fn user_email(cx: &Cx, Form(input): Form<UserEmailForm>) -> Result<Response> {
15441563 let me = match require_admin(cx).await {
15451564 Ok(me) => me,
1546- Err(redirect) => return Ok(redirect),
1565+ Err(redirect) => return Ok(*redirect),
15471566 };
15481567 let store = &app(cx).store;
15491568 let user_id = UserId::from(input.user);
@@ -1568,7 +1587,7 @@ struct InviteAction {
15681587 async fn uninvite(cx: &Cx, Form(input): Form<InviteAction>) -> Result<Response> {
15691588 let me = match require_admin(cx).await {
15701589 Ok(me) => me,
1571- Err(redirect) => return Ok(redirect),
1590+ Err(redirect) => return Ok(*redirect),
15721591 };
15731592 let store = &app(cx).store;
15741593 let email = accounts::revoke_invite(store, &input.invite).await?;
@@ -1583,7 +1602,7 @@ async fn uninvite(cx: &Cx, Form(input): Form<InviteAction>) -> Result<Response>
15831602 async fn delete(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {
15841603 let me = match require_admin(cx).await {
15851604 Ok(me) => me,
1586- Err(redirect) => return Ok(redirect),
1605+ Err(redirect) => return Ok(*redirect),
15871606 };
15881607 let store = &app(cx).store;
15891608 let user_id = UserId::from(input.user);
@@ -1603,7 +1622,7 @@ struct UserAction {
16031622 async fn revoke(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {
16041623 let me = match require_admin(cx).await {
16051624 Ok(me) => me,
1606- Err(redirect) => return Ok(redirect),
1625+ Err(redirect) => return Ok(*redirect),
16071626 };
16081627 let store = &app(cx).store;
16091628 let user_id = UserId::from(input.user);
@@ -1636,7 +1655,7 @@ struct SessionRevokeForm {
16361655 async fn session_revoke(cx: &Cx, Form(input): Form<SessionRevokeForm>) -> Result<Response> {
16371656 let me = match require_admin(cx).await {
16381657 Ok(me) => me,
1639- Err(redirect) => return Ok(redirect),
1658+ Err(redirect) => return Ok(*redirect),
16401659 };
16411660 let user_id = UserId::from(input.user.clone());
16421661 if !im_core::sessions::revoke_owned_session(&app(cx).store, &user_id, &input.session).await? {
@@ -1659,7 +1678,7 @@ async fn enable(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {
16591678 async fn set_disabled(cx: &Cx, input: UserAction, disabled: bool) -> Result<Response> {
16601679 let me = match require_admin(cx).await {
16611680 Ok(me) => me,
1662- Err(redirect) => return Ok(redirect),
1681+ Err(redirect) => return Ok(*redirect),
16631682 };
16641683 let store = &app(cx).store;
16651684 let user_id = UserId::from(input.user);
@@ -1710,7 +1729,7 @@ struct SmtpForm {
17101729 async fn smtp_save(cx: &Cx, Form(input): Form<SmtpForm>) -> Result<Response> {
17111730 let me = match require_admin(cx).await {
17121731 Ok(me) => me,
1713- Err(redirect) => return Ok(redirect),
1732+ Err(redirect) => return Ok(*redirect),
17141733 };
17151734 let store = &app(cx).store;
17161735 let value = Smtp {
@@ -1733,7 +1752,7 @@ async fn smtp_save(cx: &Cx, Form(input): Form<SmtpForm>) -> Result<Response> {
17331752 async fn smtp_test(cx: &Cx) -> Result<Response> {
17341753 let me = match require_admin(cx).await {
17351754 Ok(me) => me,
1736- Err(redirect) => return Ok(redirect),
1755+ Err(redirect) => return Ok(*redirect),
17371756 };
17381757 if !settings::smtp(&app(cx).store).await?.configured() {
17391758 return back(cx, "mail", "&error=sender_unset");
@@ -1778,7 +1797,7 @@ struct MessageForm {
17781797 async fn message(cx: &Cx, Form(input): Form<MessageForm>) -> Result<Response> {
17791798 let me = match require_admin(cx).await {
17801799 Ok(me) => me,
1781- Err(redirect) => return Ok(redirect),
1800+ Err(redirect) => return Ok(*redirect),
17821801 };
17831802 let store = &app(cx).store;
17841803 if !settings::smtp(store).await?.configured() {
@@ -1834,7 +1853,7 @@ async fn message(cx: &Cx, Form(input): Form<MessageForm>) -> Result<Response> {
18341853 async fn smtp_check(cx: &Cx) -> Result<Response> {
18351854 let me = match require_admin(cx).await {
18361855 Ok(me) => me,
1837- Err(redirect) => return Ok(redirect),
1856+ Err(redirect) => return Ok(*redirect),
18381857 };
18391858 if !settings::smtp(&app(cx).store).await?.configured() {
18401859 return back(cx, "mail", "&error=sender_unset");
crates/im-web/src/auth.rsmodified+10 -11
@@ -55,13 +55,12 @@ fn logout_target(raw: Option<&str>, services: &[im_core::services::Service]) ->
5555 if raw.starts_with('/') && !raw.starts_with("//") {
5656 return raw.to_string();
5757 }
58- if let Some(origin) = url_origin(raw) {
59- if services
58+ if let Some(origin) = url_origin(raw)
59+ && services
6060 .iter()
6161 .any(|s| url_origin(&s.url).is_some_and(|known| known == origin))
62- {
63- return raw.to_string();
64- }
62+ {
63+ return raw.to_string();
6564 }
6665 "/".to_string()
6766 }
@@ -519,12 +518,12 @@ async fn revoke_session(cx: &Cx, Form(input): Form<SessionRevokeForm>) -> Redire
519518 return see("/".to_string());
520519 };
521520 let store = &server::app(cx).store;
522- if let Some(presented) = server::presented_session(cx) {
523- if im_core::accounts::hash_token(&presented) == input.session {
524- im_core::sessions::revoke_session(store, &presented).await?;
525- server::clear_session_cookie(cx);
526- return see("/".to_string());
527- }
521+ if let Some(presented) = server::presented_session(cx)
522+ && im_core::accounts::hash_token(&presented) == input.session
523+ {
524+ im_core::sessions::revoke_session(store, &presented).await?;
525+ server::clear_session_cookie(cx);
526+ return see("/".to_string());
528527 }
529528 // The row's address, when it is still there, is the useful half of the
530529 // log line — which of their devices they just killed.
crates/im-web/src/dropdown.rsmodified+3 -3
@@ -15,9 +15,9 @@
1515
1616 use topcoat::Result;
1717 use topcoat::context::Cx;
18-use topcoat::view::{Unescaped, view};
18+use topcoat::view::{Unescaped, View, view};
1919
20-pub async fn dropdown_script(cx: &Cx) -> Result {
20+pub async fn dropdown_script(cx: &Cx) -> Result<impl View + '_> {
2121 const JS: &str = "\
2222 (function () {\
2323 function enhanceAll() { document.querySelectorAll('select.auth-input').forEach(enhance); }\
@@ -242,5 +242,5 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
242242 }, true);\
243243 enhanceAll();\
244244 })();";
245- view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }
245+ Ok(view! { cx => <script>(Unescaped::new_unchecked(JS))</script> })
246246 }
crates/im-web/src/layout.rsmodified+40 -27
@@ -5,7 +5,7 @@ use im_core::model::User;
55 use topcoat::Result;
66 use topcoat::asset::{Asset, asset};
77 use topcoat::context::Cx;
8-use topcoat::view::view;
8+use topcoat::view::{BoxView, Child, View, ViewExt, view};
99
1010 use crate::i18n::{Key, Lang, lang_of, t};
1111 use crate::server;
@@ -15,13 +15,13 @@ pub(crate) const STYLE: Asset = asset!("assets/main.css");
1515
1616 /// The mark, in the word as it is in the name: lower case, the Turkish
1717 /// tittle. Text-only here — the auth card is the whole chrome.
18-pub async fn wordmark(cx: &Cx) -> Result {
19- view! {
18+pub async fn wordmark(cx: &Cx) -> Result<impl View + '_> {
19+ Ok(view! {
2020 cx =>
2121 <span class="wordmark">
2222 <span class="wordmark-text">"im"</span>
2323 </span>
24- }
24+ })
2525 }
2626
2727 /// The signed-in chrome's wordmark with the family behind it: the `im`
@@ -31,7 +31,7 @@ pub async fn wordmark(cx: &Cx) -> Result {
3131 /// is CSS on `:hover` / `:focus-within`. A family with no siblings renders
3232 /// the bare mark — nothing to reveal. The list is the stored one, the same
3333 /// rows `/family` serves, minus im's own row.
34-pub async fn family_wordmark(cx: &Cx) -> Result {
34+pub async fn family_wordmark(cx: &Cx) -> Result<BoxView<'_>> {
3535 let services = im_core::services::list(&server::app(cx).store).await?;
3636 let siblings = services
3737 .iter()
@@ -43,10 +43,10 @@ pub async fn family_wordmark(cx: &Cx) -> Result {
4343 })
4444 .collect::<Vec<_>>();
4545 if siblings.is_empty() {
46- return wordmark(cx).await;
46+ return wordmark(cx).await.map(ViewExt::boxed);
4747 }
4848 let marks = siblings.join(r#"<span class="trio-sep">·</span>"#);
49- view! {
49+ Ok(view! {
5050 cx =>
5151 <div class="wordmark-family">
5252 <span class="wordmark" tabindex="0">
@@ -55,19 +55,21 @@ pub async fn family_wordmark(cx: &Cx) -> Result {
5555 <nav class="service-trio">(topcoat::view::Unescaped::new_unchecked(marks))</nav>
5656 </div>
5757 }
58+ .boxed())
5859 }
5960
6061 /// The profile card's face: the photo when the account has one, the name's
6162 /// first letter on a quiet tile when it does not. The URL's `?v=` is the
6263 /// row's `photo_version` — the same number `/directory` answers with — so
6364 /// a changed photo is a changed URL, in this process and in every sibling.
64-pub async fn avatar(cx: &Cx, user: &im_core::model::User) -> Result {
65+pub async fn avatar<'a>(cx: &'a Cx, user: &'a im_core::model::User) -> Result<BoxView<'a>> {
6566 if user.has_photo {
6667 let src = format!("/photo/{}?v={}", user.id, user.photo_version);
67- view! {
68+ Ok(view! {
6869 cx =>
6970 <img class="profile-avatar" src=(src) alt=(user.name.clone())>
7071 }
72+ .boxed())
7173 } else {
7274 let initial = user
7375 .name
@@ -76,11 +78,13 @@ pub async fn avatar(cx: &Cx, user: &im_core::model::User) -> Result {
7678 .unwrap_or('?')
7779 .to_uppercase()
7880 .to_string();
79- view! {
81+ Ok(view! {
8082 cx =>
8183 <span class="profile-avatar profile-avatar-initial">(initial)</span>
8284 }
85+ .boxed())
8386 }
87+
8488 }
8589
8690 /// The one script im serves, and the only behavior it carries: the avatar
@@ -94,7 +98,7 @@ pub async fn avatar(cx: &Cx, user: &im_core::model::User) -> Result {
9498 /// document listeners, so the hard-post re-render never needs rewiring.
9599 /// Emitted by the landing and the person page — every surface that draws a
96100 /// clickable face.
97-pub async fn avatar_script(cx: &Cx, lang: Lang) -> Result {
101+pub async fn avatar_script(cx: &Cx, lang: Lang) -> Result<impl View + '_> {
98102 use topcoat::view::Unescaped;
99103 /// Single-quoted into the script below; the staged strings carry no
100104 /// quoting of their own, and this keeps it true if one ever does.
@@ -212,7 +216,7 @@ pub async fn avatar_script(cx: &Cx, lang: Lang) -> Result {
212216 "__IM_CANCEL_UPLOAD__",
213217 &js_escape(t(lang, Key::CancelUploadLabel)),
214218 );
215- view! { cx => <script>(Unescaped::new_unchecked(js))</script> }
219+ Ok(view! { cx => <script>(Unescaped::new_unchecked(js))</script> })
216220 }
217221
218222 /// Soft navigation, iz's model cut to im's shape: same-app links and form
@@ -222,7 +226,7 @@ pub async fn avatar_script(cx: &Cx, lang: Lang) -> Result {
222226 /// belong to the avatar script above and are left to it. Global listeners
223227 /// live on document/window and survive every swap; the guard makes the
224228 /// re-created script a no-op.
225-pub async fn soft_nav_script(cx: &Cx) -> Result {
229+pub async fn soft_nav_script(cx: &Cx) -> Result<impl View + '_> {
226230 use topcoat::view::Unescaped;
227231 const JS: &str = r#"(function () {
228232 if (window.__imSoft) { return; }
@@ -410,7 +414,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
410414 .catch(function () {});
411415 };
412416 })();"#;
413- view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }
417+ Ok(view! { cx => <script>(Unescaped::new_unchecked(JS))</script> })
414418 }
415419
416420 /// The live channel's client, iz's shape: a bare tick says *something*
@@ -418,7 +422,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
418422 /// ordinary gate answers — and morphs with fields and scroll intact. A
419423 /// focused field freezes the refresh mid-typing. Mounted only for a signed-in
420424 /// viewer, so auth screens never reconnect against a 401.
421-pub async fn live_script(cx: &Cx) -> Result {
425+pub async fn live_script(cx: &Cx) -> Result<impl View + '_> {
422426 use topcoat::view::Unescaped;
423427 const JS: &str = r#"(function () {
424428 if (window.__imLive) { return; }
@@ -433,19 +437,28 @@ pub async fn live_script(cx: &Cx) -> Result {
433437 src.onmessage = function () { schedule(); };
434438 } catch (err) {}
435439 })();"#;
436- view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }
440+ Ok(view! { cx => <script>(Unescaped::new_unchecked(JS))</script> })
437441 }
438442
439443 /// A full document around an already-rendered stage — the same way
440444 /// izlek-web's `#[layout]` receives its slot. The viewer stamps the chrome:
441445 /// their theme/language/ui when signed in, English/light/instrument when
442446 /// not — mirroring iz's root_layout, minus its build stamp.
443-pub async fn shell(cx: &Cx, title: &str, viewer: Option<&User>, stage: Result) -> Result {
444- let stage = stage?;
445- let lang = lang_of(viewer);
446- let dark = viewer.is_some_and(|user| user.theme == "dark");
447- let ui = viewer.map_or("instrument", |user| user.ui.as_str());
448- view! {
447+pub async fn shell<'a>(
448+ cx: &'a Cx,
449+ title: impl Into<String>,
450+ viewer: Option<User>,
451+ stage: Child<'a>,
452+) -> Result<impl View + 'a> {
453+ let title = title.into();
454+ let lang = lang_of(viewer.as_ref());
455+ let dark = viewer.as_ref().is_some_and(|user| user.theme == "dark");
456+ let ui = viewer
457+ .as_ref()
458+ .map_or("instrument", |user| user.ui.as_str())
459+ .to_string();
460+ let live = viewer.is_some();
461+ Ok(view! {
449462 cx =>
450463 <!DOCTYPE html>
451464 <html lang=(lang.code()) data-theme=(dark.then_some("dark")) data-ui=(ui)>
@@ -463,12 +476,12 @@ pub async fn shell(cx: &Cx, title: &str, viewer: Option<&User>, stage: Result) -
463476 </head>
464477 <body>
465478 (stage)
466- (soft_nav_script(cx).await?)
467- if viewer.is_some() {
468- (live_script(cx).await?)
469- (crate::dropdown::dropdown_script(cx).await?)
479+ (soft_nav_script(cx).await?.first().await?)
480+ if live {
481+ (live_script(cx).await?.first().await?)
482+ (crate::dropdown::dropdown_script(cx).await?.first().await?)
470483 }
471484 </body>
472485 </html>
473- }
486+ })
474487 }
crates/im-web/src/live.rsmodified+50 -52
@@ -49,61 +49,59 @@ async fn live(cx: &Cx) -> topcoat::Result<Response> {
4949 let events = futures_util::stream::unfold(
5050 (rx, deadline, stopping),
5151 |(mut rx, deadline, mut stopping)| async move {
52- loop {
53- // Already going down: end, so this connection is not one the
54- // shutdown has to sit and wait out.
55- if stopping.as_ref().is_some_and(|watch| *watch.borrow()) {
56- return None;
57- }
58- let left = deadline.saturating_duration_since(Instant::now());
59- if left.is_zero() {
60- return None;
52+ // Already going down: end, so this connection is not one the
53+ // shutdown has to sit and wait out.
54+ if stopping.as_ref().is_some_and(|watch| *watch.borrow()) {
55+ return None;
56+ }
57+ let left = deadline.saturating_duration_since(Instant::now());
58+ if left.is_zero() {
59+ return None;
60+ }
61+ // Three things end the wait: an announcement, the window
62+ // running out, and the server being told to stop. The third
63+ // is watched rather than polled, so SIGTERM is felt at once.
64+ let heard = tokio::time::timeout(left, async {
65+ match stopping.as_mut() {
66+ Some(watch) => tokio::select! {
67+ _ = watch.changed() => None,
68+ got = rx.recv() => Some(got),
69+ },
70+ None => Some(rx.recv().await),
6171 }
62- // Three things end the wait: an announcement, the window
63- // running out, and the server being told to stop. The third
64- // is watched rather than polled, so SIGTERM is felt at once.
65- let heard = tokio::time::timeout(left, async {
66- match stopping.as_mut() {
67- Some(watch) => tokio::select! {
68- _ = watch.changed() => None,
69- got = rx.recv() => Some(got),
70- },
71- None => Some(rx.recv().await),
72- }
73- })
74- .await;
75- match heard {
76- // The window closed, or the server is stopping. Ending
77- // the stream is the point: the browser reconnects by
78- // itself and authenticates again.
79- Err(_) | Ok(None) => return None,
80- // The broadcaster is gone, which means the process is
81- // going with it.
82- Ok(Some(Err(RecvError::Closed))) => return None,
83- // This reader fell behind and announcements were dropped.
84- // Which ones is unknowable, so the tick says "re-read
85- // everything" — the client refetches the whole page, so
86- // a lagged tick and a plain tick are the same frame.
87- Ok(Some(Err(RecvError::Lagged(_)))) | Ok(Some(Ok(server::LiveEvent::Tick))) => {}
88- // One member's row changed. The frame names which one —
89- // im's own client still just re-fetches the page it is
90- // on, so the payload is forward-compatibility for a
91- // future page that can react to its own subject alone.
92- Ok(Some(Ok(server::LiveEvent::Profile(member)))) => {
93- return Some((
94- Ok::<_, std::convert::Infallible>(Event::new().data(
95- serde_json::json!({ "kind": "profile", "sub": member.sub })
96- .to_string(),
97- )),
98- (rx, deadline, stopping),
99- ));
100- }
72+ })
73+ .await;
74+ match heard {
75+ // The window closed, or the server is stopping. Ending
76+ // the stream is the point: the browser reconnects by
77+ // itself and authenticates again.
78+ Err(_) | Ok(None) => return None,
79+ // The broadcaster is gone, which means the process is
80+ // going with it.
81+ Ok(Some(Err(RecvError::Closed))) => return None,
82+ // This reader fell behind and announcements were dropped.
83+ // Which ones is unknowable, so the tick says "re-read
84+ // everything" — the client refetches the whole page, so
85+ // a lagged tick and a plain tick are the same frame.
86+ Ok(Some(Err(RecvError::Lagged(_)))) | Ok(Some(Ok(server::LiveEvent::Tick))) => {}
87+ // One member's row changed. The frame names which one —
88+ // im's own client still just re-fetches the page it is
89+ // on, so the payload is forward-compatibility for a
90+ // future page that can react to its own subject alone.
91+ Ok(Some(Ok(server::LiveEvent::Profile(member)))) => {
92+ return Some((
93+ Ok::<_, std::convert::Infallible>(Event::new().data(
94+ serde_json::json!({ "kind": "profile", "sub": member.sub })
95+ .to_string(),
96+ )),
97+ (rx, deadline, stopping),
98+ ));
10199 }
102- return Some((
103- Ok::<_, std::convert::Infallible>(Event::new().data("{}")),
104- (rx, deadline, stopping),
105- ));
106100 }
101+ Some((
102+ Ok::<_, std::convert::Infallible>(Event::new().data("{}")),
103+ (rx, deadline, stopping),
104+ ))
107105 },
108106 );
109107
crates/im-web/src/pages.rsmodified+83 -56
@@ -9,7 +9,7 @@ use topcoat::context::Cx;
99 use topcoat::router::error::see_other;
1010 use topcoat::router::response::{IntoResponse, Response};
1111 use topcoat::router::{page, path_param, route};
12-use topcoat::view::view;
12+use topcoat::view::{BoxView, Child, View, ViewExt, view};
1313
1414 use crate::i18n::{Key, Lang, lang_of, t};
1515 use crate::layout::{avatar, family_wordmark, shell, wordmark};
@@ -161,21 +161,21 @@ fn current_query(cx: &Cx) -> String {
161161 /// The front door: the sign-in card, or the signed-in landing when the
162162 /// browser already holds a session.
163163 #[page("/")]
164-async fn landing(cx: &Cx) -> Result {
164+async fn landing(cx: &Cx) -> Result<BoxView<'_>> {
165165 match server::current_user(cx).await {
166- Some(user) => signed_in(cx, &user).await,
167- None => login_card(cx).await,
166+ Some(user) => signed_in(cx, user).await.map(ViewExt::boxed),
167+ None => login_card(cx).await.map(ViewExt::boxed),
168168 }
169169 }
170170
171171 /// `/login` is the same card with a `back` it must keep: the `/authorize`
172172 /// call the browser was in the middle of.
173173 #[page("/login")]
174-async fn login(cx: &Cx) -> Result {
174+async fn login(cx: &Cx) -> Result<BoxView<'_>> {
175175 login_card(cx).await
176176 }
177177
178-async fn login_card(cx: &Cx) -> Result {
178+async fn login_card(cx: &Cx) -> Result<BoxView<'_>> {
179179 // No session to read a preference from — mirroring iz's auth pages.
180180 let lang = Lang::En;
181181 let query = current_query(cx);
@@ -186,7 +186,7 @@ async fn login_card(cx: &Cx) -> Result {
186186 cx =>
187187 <main class="auth-stage">
188188 <div class="auth-column">
189- (wordmark(cx).await?)
189+ (wordmark(cx).await?.first().await?)
190190 <div class="auth-card">
191191 <div class="auth-head">
192192 <div class="auth-title">(t(lang, Key::SignInTitle))</div>
@@ -230,7 +230,7 @@ async fn login_card(cx: &Cx) -> Result {
230230 </div>
231231 </main>
232232 };
233- shell(cx, t(lang, Key::TitleSignIn), None, stage).await
233+ shell(cx, t(lang, Key::TitleSignIn), None, Child::new(stage)).await.map(ViewExt::boxed)
234234 }
235235
236236 /// The second factor. Reached only with a pending-login cookie; without one
@@ -246,7 +246,7 @@ async fn totp(cx: &Cx) -> Result<Response> {
246246 cx =>
247247 <main class="auth-stage">
248248 <div class="auth-column">
249- (wordmark(cx).await?)
249+ (wordmark(cx).await?.first().await?)
250250 <div class="auth-card">
251251 <div class="auth-head">
252252 <div class="auth-title">(t(lang, Key::TotpTitle))</div>
@@ -277,9 +277,11 @@ async fn totp(cx: &Cx) -> Result<Response> {
277277 </div>
278278 </main>
279279 };
280- shell(cx, t(lang, Key::TitleTotp), None, stage)
281- .await?
282- .into_response(cx)
280+ shell(cx, t(lang, Key::TitleTotp), None, Child::new(stage))
281+ .await?
282+ .first()
283+ .await?
284+ .into_response(cx)
283285 }
284286 _ => see_other("/login").into_response(cx),
285287 }
@@ -305,7 +307,7 @@ async fn invite(cx: &Cx) -> Result<Response> {
305307 cx =>
306308 <main class="auth-stage">
307309 <div class="auth-column">
308- (wordmark(cx).await?)
310+ (wordmark(cx).await?.first().await?)
309311 <div class="auth-card">
310312 <div class="auth-head">
311313 <div class="auth-title">(t(lang, Key::InviteTitle))</div>
@@ -363,6 +365,7 @@ async fn invite(cx: &Cx) -> Result<Response> {
363365 </div>
364366 </main>
365367 }
368+ .boxed()
366369 } else {
367370 let code = match &invite {
368371 None => "invite_invalid",
@@ -373,7 +376,7 @@ async fn invite(cx: &Cx) -> Result<Response> {
373376 cx =>
374377 <main class="auth-stage">
375378 <div class="auth-column">
376- (wordmark(cx).await?)
379+ (wordmark(cx).await?.first().await?)
377380 <div class="auth-card">
378381 <div class="auth-head">
379382 <div class="auth-title">(t(lang, Key::InviteDeadTitle))</div>
@@ -384,8 +387,11 @@ async fn invite(cx: &Cx) -> Result<Response> {
384387 </div>
385388 </main>
386389 }
390+ .boxed()
387391 };
388- shell(cx, t(lang, Key::TitleInvited), None, stage)
392+ shell(cx, t(lang, Key::TitleInvited), None, Child::new(stage))
393+ .await?
394+ .first()
389395 .await?
390396 .into_response(cx)
391397 }
@@ -414,12 +420,10 @@ async fn enroll(cx: &Cx) -> Result<Response> {
414420 let issuer = &server::app(cx).config.issuer;
415421 let uri = im_core::totp::totp_uri("im", &user.email, &secret);
416422 let qr = qrcode::QrCode::new(uri.as_bytes())
417- .and_then(|code| {
418- Ok::<_, qrcode::types::QrError>(
419- code.render::<qrcode::render::svg::Color>()
420- .min_dimensions(200, 200)
421- .build(),
422- )
423+ .map(|code| {
424+ code.render::<qrcode::render::svg::Color>()
425+ .min_dimensions(200, 200)
426+ .build()
423427 })
424428 .map_err(|e| topcoat::Error::from(std::io::Error::other(format!("qr: {e}"))))?;
425429 let manual = im_core::totp::display_secret(&secret);
@@ -432,7 +436,7 @@ async fn enroll(cx: &Cx) -> Result<Response> {
432436 cx =>
433437 <main class="auth-stage">
434438 <div class="auth-column">
435- (wordmark(cx).await?)
439+ (wordmark(cx).await?.first().await?)
436440 <div class="auth-card">
437441 <div class="auth-head">
438442 <div class="auth-title">(t(lang, Key::EnrollTitle))</div>
@@ -465,7 +469,9 @@ async fn enroll(cx: &Cx) -> Result<Response> {
465469 </div>
466470 </main>
467471 };
468- shell(cx, t(lang, Key::TitleEnroll), Some(&user), stage)
472+ shell(cx, t(lang, Key::TitleEnroll), Some(user), Child::new(stage))
473+ .await?
474+ .first()
469475 .await?
470476 .into_response(cx)
471477 }
@@ -648,16 +654,14 @@ fn apps_html(apps: &[im_core::oidc::ConnectedApp], lang: Lang) -> String {
648654 }
649655 rows
650656 }
651-
652-/// The signed-in landing. im is an auth service, not an app: this page is
653657 /// the proof of session, the person's profile — photo and the counts their
654658 /// identity has earned — and the way out. izlek gives a profile its own
655659 /// page under `/people`; im has exactly one signed-in screen, so the
656660 /// profile is a section of it. Six cards in one column ran twice the height
657661 /// of a window, so the landing is sectioned like the admin panel: a tab row
658662 /// under the wordmark, one section's cards at a time.
659-async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
660- let lang = lang_of(Some(user));
663+async fn signed_in<'a>(cx: &'a Cx, user: im_core::model::User) -> Result<BoxView<'a>> {
664+ let lang = lang_of(Some(&user));
661665 let query = current_query(cx);
662666 let section = query_value(&query, "section").unwrap_or_else(|| "profile".to_string());
663667 let ok = query_value(&query, "ok");
@@ -692,6 +696,25 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
692696 )
693697 })
694698 .collect::<String>();
699+ // The stage template moves every value it mentions, so the account's
700+ // template data is staged here as owned values first; the markup below
701+ // never names `user` itself.
702+ let face_button = avatar(cx, &user).await?.first().await?;
703+ let face_plain = avatar(cx, &user).await?.first().await?;
704+ let theme_light = user.theme == "light";
705+ let theme_dark = user.theme == "dark";
706+ let ui_instrument = user.ui == "instrument";
707+ let ui_ledger = user.ui == "ledger";
708+ let lang_en = user.language == "en";
709+ let lang_tr = user.language == "tr";
710+ let timezone_options = timezone_select(&user.timezone);
711+ let email_form = user.email.clone();
712+ let email_shown = user.email.clone();
713+ let display_name = user.name.clone();
714+ let has_photo = user.has_photo;
715+ let totp_on = user.totp_confirmed;
716+ let is_admin = user.admin;
717+ let public_href = format!("/people/{}", user.id);
695718 // The family lives in the chrome — the siblings' flyout under the
696719 // wordmark — and its editing in the admin panel; the landing is the
697720 // account's own page and carries no directory of its own.
@@ -699,7 +722,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
699722 cx =>
700723 <main class="auth-stage landing-stage">
701724 <div class="auth-column">
702- (family_wordmark(cx).await?)
725+ (family_wordmark(cx).await?.first().await?)
703726 <nav class="admin-tabs landing-nav">(topcoat::view::Unescaped::new_unchecked(nav))</nav>
704727 if let Some(code) = ok {
705728 <div class="auth-ok">(ok_text(&code, lang))</div>
@@ -733,28 +756,28 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
733756 <label class="auth-field">
734757 <span class="auth-label">(t(lang, Key::ThemeLabel))</span>
735758 <select class="auth-input" name="theme">
736- <option value="light" selected=(user.theme == "light")>(t(lang, Key::LightOption))</option>
737- <option value="dark" selected=(user.theme == "dark")>(t(lang, Key::DarkOption))</option>
759+ <option value="light" selected=(theme_light)>(t(lang, Key::LightOption))</option>
760+ <option value="dark" selected=(theme_dark)>(t(lang, Key::DarkOption))</option>
738761 </select>
739762 </label>
740763 <label class="auth-field">
741764 <span class="auth-label">(t(lang, Key::UiLabel))</span>
742765 <select class="auth-input" name="ui">
743- <option value="instrument" selected=(user.ui == "instrument")>(t(lang, Key::InstrumentOption))</option>
744- <option value="ledger" selected=(user.ui == "ledger")>(t(lang, Key::LedgerOption))</option>
766+ <option value="instrument" selected=(ui_instrument)>(t(lang, Key::InstrumentOption))</option>
767+ <option value="ledger" selected=(ui_ledger)>(t(lang, Key::LedgerOption))</option>
745768 </select>
746769 </label>
747770 <label class="auth-field">
748771 <span class="auth-label">(t(lang, Key::LanguageLabel))</span>
749772 <select class="auth-input" name="language">
750- <option value="en" selected=(user.language == "en")>"English"</option>
751- <option value="tr" selected=(user.language == "tr")>"Türkçe"</option>
773+ <option value="en" selected=(lang_en)>"English"</option>
774+ <option value="tr" selected=(lang_tr)>"Türkçe"</option>
752775 </select>
753776 </label>
754777 <label class="auth-field">
755778 <span class="auth-label">(t(lang, Key::TimeZoneLabel))</span>
756779 <select class="auth-input" name="timezone">
757- (topcoat::view::Unescaped::new_unchecked(timezone_select(&user.timezone)))
780+ (topcoat::view::Unescaped::new_unchecked(timezone_options))
758781 </select>
759782 </label>
760783 <button class="auth-submit" type="submit">
@@ -823,7 +846,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
823846 type="email"
824847 name="email"
825848 autocomplete="email"
826- value=(user.email.clone())
849+ value=(email_form)
827850 required=""
828851 >
829852 </label>
@@ -837,7 +860,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
837860 if section != "sessions" && section != "preferences" && section != "password" && section != "apps" {
838861 <div class="auth-card">
839862 <div class="profile-head">
840- if user.has_photo {
863+ if has_photo {
841864 // The face is the whole control surface: it opens
842865 // the viewer, and the viewer carries Change/Remove
843866 // (avatar_script builds them for a `data-own`
@@ -850,7 +873,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
850873 aria-label=(t(lang, Key::ViewPhotoAria))
851874 data-own=""
852875 >
853- (avatar(cx, user).await?)
876+ (face_button)
854877 </button>
855878 <input
856879 id="profile-photo-input"
@@ -866,7 +889,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
866889 // label wraps the hidden input, which autosubmits
867890 // on change (avatar_script) — no buttons at all.
868891 <label class="profile-avatar-upload">
869- (avatar(cx, user).await?)
892+ (face_plain)
870893 <input
871894 class="profile-file-hidden"
872895 type="file"
@@ -878,14 +901,14 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
878901 </label>
879902 }
880903 <div class="profile-heading">
881- <div class="auth-title">(user.name.clone())</div>
904+ <div class="auth-title">(display_name)</div>
882905 <div class="profile-marks">
883- if user.totp_confirmed {
906+ if totp_on {
884907 <span class="chip chip-connected">(t(lang, Key::TwoFaOn))</span>
885908 } else {
886909 <span class="chip chip-muted">(t(lang, Key::TwoFaOff))</span>
887910 }
888- if user.admin {
911+ if is_admin {
889912 <span class="chip chip-accent">(t(lang, Key::AdminChip))</span>
890913 }
891914 </div>
@@ -894,18 +917,18 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
894917 <dl class="profile-fields">
895918 <div class="profile-field">
896919 <dt class="auth-label">(t(lang, Key::EmailLabel))</dt>
897- <dd class="profile-value mono">(user.email.clone())</dd>
920+ <dd class="profile-value mono">(email_shown)</dd>
898921 </div>
899922 <div class="profile-field">
900923 <dt class="auth-label">(t(lang, Key::MemberSinceLabel))</dt>
901924 <dd class="profile-value">(joined)</dd>
902925 </div>
903926 </dl>
904- <a class="auth-alt" href=(format!("/people/{}", user.id))>(t(lang, Key::PublicProfileLink))</a>
905- if !user.totp_confirmed {
927+ <a class="auth-alt" href=(public_href)>(t(lang, Key::PublicProfileLink))</a>
928+ if !totp_on {
906929 <a class="auth-alt" href="/enroll">(t(lang, Key::Activate2fa))</a>
907930 }
908- if user.admin {
931+ if is_admin {
909932 <a class="auth-alt" href="/admin">(t(lang, Key::AdminPanelLink))</a>
910933 }
911934 // Both forms carry no visible chrome of their own: the
@@ -917,7 +940,7 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
917940 action="/api/profile_photo"
918941 enctype="multipart/form-data"
919942 ></form>
920- if user.has_photo {
943+ if has_photo {
921944 <form
922945 id="profile-photo-remove"
923946 method="post"
@@ -945,15 +968,15 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
945968 <div class="auth-footer">(t(lang, Key::BrandFooter))</div>
946969 </div>
947970 </main>
948- (crate::layout::avatar_script(cx, lang).await?)
971+ (crate::layout::avatar_script(cx, lang).await?.first().await?)
949972 };
950- shell(cx, "im", Some(user), stage).await
973+ shell(cx, "im", Some(user), Child::new(stage)).await.map(ViewExt::boxed)
951974 }
952975
953976 /// "Forgot it?" — the self-serve reset ask. It answers the same whether the
954977 /// address has an account: one quiet note, the same one for every address.
955978 #[page("/forgot")]
956-async fn forgot(cx: &Cx) -> Result {
979+async fn forgot(cx: &Cx) -> Result<impl View + '_> {
957980 let lang = Lang::En;
958981 let query = current_query(cx);
959982 let error = query_value(&query, "error");
@@ -962,7 +985,7 @@ async fn forgot(cx: &Cx) -> Result {
962985 cx =>
963986 <main class="auth-stage">
964987 <div class="auth-column">
965- (wordmark(cx).await?)
988+ (wordmark(cx).await?.first().await?)
966989 <div class="auth-card">
967990 <div class="auth-head">
968991 <div class="auth-title">(t(lang, Key::ForgotTitle))</div>
@@ -995,7 +1018,7 @@ async fn forgot(cx: &Cx) -> Result {
9951018 </div>
9961019 </main>
9971020 };
998- shell(cx, t(lang, Key::TitleForgot), None, stage).await
1021+ shell(cx, t(lang, Key::TitleForgot), None, Child::new(stage)).await
9991022 }
10001023
10011024 /// The reset link's destination: a new password, twice. A dead link never
@@ -1013,7 +1036,7 @@ async fn reset_page(cx: &Cx) -> Result<Response> {
10131036 cx =>
10141037 <main class="auth-stage">
10151038 <div class="auth-column">
1016- (wordmark(cx).await?)
1039+ (wordmark(cx).await?.first().await?)
10171040 <div class="auth-card">
10181041 <div class="auth-head">
10191042 <div class="auth-title">(t(lang, Key::ResetTitle))</div>
@@ -1055,7 +1078,9 @@ async fn reset_page(cx: &Cx) -> Result<Response> {
10551078 </div>
10561079 </main>
10571080 };
1058- shell(cx, t(lang, Key::TitleReset), None, stage)
1081+ shell(cx, t(lang, Key::TitleReset), None, Child::new(stage))
1082+ .await?
1083+ .first()
10591084 .await?
10601085 .into_response(cx)
10611086 }
@@ -1075,7 +1100,7 @@ async fn email_change_page(cx: &Cx) -> Result<Response> {
10751100 cx =>
10761101 <main class="auth-stage">
10771102 <div class="auth-column">
1078- (wordmark(cx).await?)
1103+ (wordmark(cx).await?.first().await?)
10791104 <div class="auth-card">
10801105 <div class="auth-head">
10811106 <div class="auth-title">(t(lang, Key::EmailConfirmTitle))</div>
@@ -1094,7 +1119,9 @@ async fn email_change_page(cx: &Cx) -> Result<Response> {
10941119 </div>
10951120 </main>
10961121 };
1097- shell(cx, t(lang, Key::EmailConfirmTitle), None, stage)
1122+ shell(cx, t(lang, Key::EmailConfirmTitle), None, Child::new(stage))
1123+ .await?
1124+ .first()
10981125 .await?
10991126 .into_response(cx)
11001127 }
crates/im-web/src/people.rsmodified+23 -12
@@ -9,7 +9,7 @@ use topcoat::Result;
99 use topcoat::context::Cx;
1010 use topcoat::router::error::not_found;
1111 use topcoat::router::{page, path_param};
12-use topcoat::view::view;
12+use topcoat::view::{Child, View, ViewExt, view};
1313
1414 use im_core::accounts;
1515
@@ -21,7 +21,7 @@ path_param!(user_id);
2121
2222 /// A person's page. `/people/{user_id}`.
2323 #[page("/people/{user_id}")]
24-async fn people_page(cx: &Cx) -> Result {
24+async fn people_page(cx: &Cx) -> Result<impl View + '_> {
2525 let Some(viewer) = server::current_user(cx).await else {
2626 return Err(not_found().into());
2727 };
@@ -35,31 +35,42 @@ async fn people_page(cx: &Cx) -> Result {
3535 let mine = person.id == viewer.id;
3636 let stats = im_core::stats::profile_stats(&store, &person.id).await?;
3737 let joined = person.created_at.date().to_string();
38+ // The stage template moves every value it mentions, so the account's
39+ // template data is staged here as owned values first; the markup below
40+ // never names `person` itself.
41+ let face_button = avatar(cx, &person).await?.first().await?;
42+ let face_plain = avatar(cx, &person).await?.first().await?;
43+ let display_name = person.name.clone();
44+ let email_shown = person.email.clone();
45+ let has_photo = person.has_photo;
46+ let totp_on = person.totp_confirmed;
47+ let is_admin = person.admin;
48+ let profile_title = format!("{} · im", person.name);
3849 let stage = view! {
3950 cx =>
4051 <main class="auth-stage">
4152 <div class="auth-column">
42- (family_wordmark(cx).await?)
53+ (family_wordmark(cx).await?.first().await?)
4354 <div class="auth-card">
4455 <div class="profile-head">
45- if person.has_photo {
56+ if has_photo {
4657 // The face opens the viewer here too — same as
4758 // the landing, same as iz's person page.
4859 <button class="avatar-view" type="button" aria-label=(t(lang, Key::ViewPhotoAria))>
49- (avatar(cx, &person).await?)
60+ (face_button)
5061 </button>
5162 } else {
52- (avatar(cx, &person).await?)
63+ (face_plain)
5364 }
5465 <div class="profile-heading">
55- <div class="auth-title">(person.name.clone())</div>
66+ <div class="auth-title">(display_name)</div>
5667 <div class="profile-marks">
57- if person.totp_confirmed {
68+ if totp_on {
5869 <span class="chip chip-connected">(t(lang, Key::TwoFaOn))</span>
5970 } else {
6071 <span class="chip chip-muted">(t(lang, Key::TwoFaOff))</span>
6172 }
62- if person.admin {
73+ if is_admin {
6374 <span class="chip chip-accent">(t(lang, Key::AdminChip))</span>
6475 }
6576 </div>
@@ -68,7 +79,7 @@ async fn people_page(cx: &Cx) -> Result {
6879 <dl class="profile-fields">
6980 <div class="profile-field">
7081 <dt class="auth-label">(t(lang, Key::EmailLabel))</dt>
71- <dd class="profile-value mono">(person.email.clone())</dd>
82+ <dd class="profile-value mono">(email_shown)</dd>
7283 </div>
7384 <div class="profile-field">
7485 <dt class="auth-label">(t(lang, Key::MemberSinceLabel))</dt>
@@ -98,7 +109,7 @@ async fn people_page(cx: &Cx) -> Result {
98109 <div class="auth-footer">(t(lang, Key::BrandFooter))</div>
99110 </div>
100111 </main>
101- (crate::layout::avatar_script(cx, lang).await?)
112+ (crate::layout::avatar_script(cx, lang).await?.first().await?)
102113 };
103- shell(cx, &format!("{} · im", person.name), Some(&viewer), stage).await
114+ shell(cx, profile_title, Some(viewer), Child::new(stage)).await
104115 }
crates/im-web/src/server.rsmodified+2 -2
@@ -86,8 +86,8 @@ const SHOWN_TTL: Duration = Duration::from_secs(10 * 60);
8686 /// page's read takes it out (`take_shown_secret`), and a replayed or
8787 /// reloaded URL finds the shelf empty and renders no secret at all. A
8888 /// restart drops the shelf — the admin mints another, as with the CLI.
89-static SHOWN_SECRETS: LazyLock<Mutex<HashMap<String, ((String, String), Instant)>>> =
90- LazyLock::new(|| Mutex::new(HashMap::new()));
89+type ShownShelf = HashMap<String, ((String, String), Instant)>;
90+static SHOWN_SECRETS: LazyLock<Mutex<ShownShelf>> = LazyLock::new(|| Mutex::new(HashMap::new()));
9191
9292 /// Parks a client's fresh pair on the shelf and returns the claim ticket
9393 /// for its URL. The id travels too — it is the public half of the pair and