diff --git a/Cargo.lock b/Cargo.lock index b16fa21..8464c35 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,7 +50,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom", + "getrandom 0.2.8", "once_cell", "version_check", ] @@ -62,7 +62,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if 1.0.0", - "getrandom", + "getrandom 0.2.8", "once_cell", "version_check", ] @@ -149,6 +149,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -173,6 +179,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bitfield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" + [[package]] name = "bitflags" version = "1.3.2" @@ -194,6 +206,45 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blowfish" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" +dependencies = [ + "byteorder", + "cipher", +] + +[[package]] +name = "bstr" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +dependencies = [ + "memchr 2.5.0", + "serde", +] + +[[package]] +name = "buffer-redux" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2886ea01509598caac116942abd33ab5a88fa32acdf7e4abfa0fc489ca520c9" +dependencies = [ + "memchr 2.5.0", + "safemem", +] + [[package]] name = "bufstream" version = "0.1.4" @@ -239,6 +290,25 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "camellia" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3264e2574e9ef2b53ce6f536dea83a69ac0bc600b762d1523ff83fe07230ce30" +dependencies = [ + "byteorder", + "cipher", +] + +[[package]] +name = "cast5" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b07d673db1ccf000e90f54b819db9e75a8348d6eb056e9b8ab53231b7a9911" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.0.77" @@ -248,6 +318,15 @@ dependencies = [ "jobserver", ] +[[package]] +name = "cfb-mode" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "738b8d467867f80a71351933f70461f5b56f24d5c93e0cf216e59229c968d330" +dependencies = [ + "cipher", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -389,6 +468,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "const-oid" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" + [[package]] name = "const-random" version = "0.1.15" @@ -405,7 +490,7 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb" dependencies = [ - "getrandom", + "getrandom 0.2.8", "once_cell", "proc-macro-hack", "tiny-keccak", @@ -457,6 +542,12 @@ dependencies = [ "libc", ] +[[package]] +name = "crc24" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd121741cf3eb82c08dd3023eb55bf2665e5f60ec20f89760cf836ae4562e6a0" + [[package]] name = "crc32fast" version = "1.3.2" @@ -515,6 +606,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -525,6 +628,47 @@ dependencies = [ "typenum", ] +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436ace70fc06e06f7f689d2624dc4e2f0ea666efb5aa704215f7249ae6e047a7" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.6", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "cxx" version = "1.0.82" @@ -575,8 +719,18 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.10.2", + "darling_macro 0.10.2", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", ] [[package]] @@ -593,13 +747,38 @@ dependencies = [ "syn 1.0.104", ] +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.104", +] + [[package]] name = "darling_macro" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ - "darling_core", + "darling_core 0.10.2", + "quote", + "syn 1.0.104", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", "quote", "syn 1.0.104", ] @@ -610,6 +789,57 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "derive_builder" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.104", +] + +[[package]] +name = "derive_builder_macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" +dependencies = [ + "derive_builder_core", + "syn 1.0.104", +] + +[[package]] +name = "des" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" +dependencies = [ + "cipher", +] + [[package]] name = "dialoguer" version = "0.10.2" @@ -621,6 +851,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.6" @@ -628,6 +867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -652,12 +892,70 @@ dependencies = [ "winapi", ] +[[package]] +name = "ecdsa" +version = "0.16.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +dependencies = [ + "der", + "digest 0.10.6", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb04eee5d9d907f29e80ee6b0e78f7e2c82342c63e3580d8c4f69d9d5aad963" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa8e9049d5d72bfc12acbc05914731b5322f79b5e2f195e9f2d705fca22ab4c" +dependencies = [ + "curve25519-dalek 4.0.0-rc.3", + "ed25519", + "serde", + "sha2", + "zeroize", +] + [[package]] name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.6", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "email_address" version = "0.2.4" @@ -758,6 +1056,22 @@ dependencies = [ "instant", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" + [[package]] name = "fixedbitset" version = "0.2.0" @@ -804,7 +1118,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e08079fa3c89edec9160ceaa9e7172785468c26c053d12924cce0d5a55c241a" dependencies = [ - "darling", + "darling 0.10.2", "proc-macro2", "quote", "syn 1.0.104", @@ -917,6 +1231,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -929,6 +1244,17 @@ dependencies = [ "windows", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.8" @@ -942,6 +1268,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.3.18" @@ -1003,9 +1340,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "himalaya" -version = "0.8.4" +version = "0.8.4-beta" dependencies = [ "anyhow", "async-trait", @@ -1045,13 +1388,22 @@ dependencies = [ "uuid", ] +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.6", ] [[package]] @@ -1189,6 +1541,15 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "idea" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "075557004419d7f2031b8bb7f44bb43e55a83ca7b63076a8fb8fe75753836477" +dependencies = [ + "cipher", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1346,6 +1707,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + [[package]] name = "keyring" version = "2.0.4" @@ -1364,6 +1734,9 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] [[package]] name = "libc" @@ -1371,6 +1744,12 @@ version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + [[package]] name = "libsqlite3-sys" version = "0.26.0" @@ -1557,6 +1936,15 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "md5" version = "0.7.0" @@ -1661,6 +2049,35 @@ dependencies = [ "libc", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "serde", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.104", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1671,6 +2088,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -1678,6 +2106,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -1704,7 +2133,7 @@ checksum = "eeaf26a72311c087f8c5ba617c96fac67a5c04f430e716ac8d8ab2de62e23368" dependencies = [ "base64 0.13.1", "chrono", - "getrandom", + "getrandom 0.2.8", "http", "rand", "reqwest", @@ -1757,6 +2186,30 @@ dependencies = [ "syn 1.0.104", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parking_lot" version = "0.10.2" @@ -1811,7 +2264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1821,12 +2274,21 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest", + "digest 0.10.6", "hmac", "password-hash", "sha2", ] +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -1843,6 +2305,57 @@ dependencies = [ "indexmap", ] +[[package]] +name = "pgp" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a79d6411154d1a9908e7a2c4bac60a5742f6125823c2c30780c7039aef02f0" +dependencies = [ + "aes", + "base64 0.21.0", + "bitfield", + "block-padding", + "blowfish", + "bstr", + "buffer-redux", + "byteorder", + "camellia", + "cast5", + "cfb-mode", + "chrono", + "cipher", + "crc24", + "derive_builder", + "des", + "digest 0.10.6", + "ed25519-dalek", + "elliptic-curve", + "flate2", + "generic-array", + "hex", + "idea", + "log", + "md-5", + "nom 7.1.1", + "num-bigint-dig", + "num-derive", + "num-traits", + "p256", + "p384", + "rand", + "ripemd", + "rsa", + "sha1", + "sha2", + "sha3", + "signature", + "smallvec", + "thiserror", + "twofish", + "x25519-dalek", + "zeroize", +] + [[package]] name = "phf" version = "0.10.1" @@ -1883,9 +2396,8 @@ dependencies = [ [[package]] name = "pimalaya-email" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac81fe94f90d335e4806a58c23eae2973996a666382deeced57215c0590e30c2" +version = "0.14.1-beta" +source = "git+https://git.sr.ht/~soywod/pimalaya#6c63d026a879276b9c525d78cad9415c7e089b32" dependencies = [ "advisory-lock", "ammonia", @@ -1906,10 +2418,13 @@ dependencies = [ "notmuch", "once_cell", "ouroboros", + "pgp", "pimalaya-email-tpl", + "pimalaya-keyring", "pimalaya-oauth2", "pimalaya-process", "pimalaya-secret", + "rand", "rayon", "regex", "rfc2047-decoder", @@ -1917,6 +2432,7 @@ dependencies = [ "rustls 0.21.1", "rustls-native-certs", "shellexpand", + "smallvec", "thiserror", "tokio", "tokio-rustls 0.24.0", @@ -1958,14 +2474,15 @@ dependencies = [ [[package]] name = "pimalaya-oauth2" -version = "0.0.3" +version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a28b3da9e56304f14bd46f769bfae52de32bd3fc2795946079e66838a178ce8" +checksum = "c47b1326c05b2f2ed610faf2eb03aecd5caaf4b3a78db34cfa97fc102c9b72ca" dependencies = [ "log", "oauth2", "reqwest", "thiserror", + "tokio", "url", ] @@ -2004,12 +2521,39 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +[[package]] +name = "platforms" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" + [[package]] name = "portable-atomic" version = "0.3.19" @@ -2028,6 +2572,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "primeorder" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -2114,7 +2667,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -2124,7 +2677,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -2133,7 +2695,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.8", ] [[package]] @@ -2179,7 +2741,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom", + "getrandom 0.2.8", "redox_syscall 0.2.16", "thiserror", ] @@ -2273,6 +2835,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -2288,12 +2860,42 @@ dependencies = [ "winapi", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "roff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" +[[package]] +name = "rsa" +version = "0.9.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65db0998ad35adcaca498b7358992e088ee16cc783fe6fb899da203e113a63e5" +dependencies = [ + "byteorder", + "const-oid", + "digest 0.10.6", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "signature", + "subtle", + "zeroize", +] + [[package]] name = "rusqlite" version = "0.29.0" @@ -2308,6 +2910,15 @@ dependencies = [ "smallvec", ] +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.36.5" @@ -2395,6 +3006,12 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "schannel" version = "0.1.20" @@ -2427,6 +3044,20 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "2.7.0" @@ -2450,6 +3081,12 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" + [[package]] name = "serde" version = "1.0.160" @@ -2519,7 +3156,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.10.6", ] [[package]] @@ -2530,7 +3167,17 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.10.6", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.6", + "keccak", ] [[package]] @@ -2551,6 +3198,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.6", + "rand_core 0.6.4", +] + [[package]] name = "siphasher" version = "0.3.10" @@ -2594,6 +3251,16 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stacker" version = "0.1.15" @@ -2997,6 +3664,15 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "twofish" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a78e83a30223c757c3947cd144a31014ff04298d8719ae10d03c31c0448c8013" +dependencies = [ + "cipher", +] + [[package]] name = "typenum" version = "1.16.0" @@ -3083,7 +3759,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom", + "getrandom 0.2.8", ] [[package]] @@ -3108,6 +3784,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -3394,11 +4076,36 @@ dependencies = [ "winapi", ] +[[package]] +name = "x25519-dalek" +version = "2.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.6.4", + "zeroize", +] + [[package]] name = "zeroize" version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index 14ffd5d..27bfa98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "himalaya" description = "CLI to manage your emails." -version = "0.8.4" +version = "0.8.4-beta" authors = ["soywod "] edition = "2021" license = "MIT" @@ -45,9 +45,9 @@ indicatif = "0.17" log = "0.4" md5 = "0.7.0" once_cell = "1.16.0" -pimalaya-email = "=0.14.0" +pimalaya-email = { git = "https://git.sr.ht/~soywod/pimalaya", default-features = false } pimalaya-keyring = "=0.0.5" -pimalaya-oauth2 = "=0.0.3" +pimalaya-oauth2 = "=0.0.4" pimalaya-process = "=0.0.5" pimalaya-secret = "=0.0.5" serde = { version = "1.0", features = ["derive"] } diff --git a/src/config/config.rs b/src/config/config.rs index 1949183..1adf3fb 100644 --- a/src/config/config.rs +++ b/src/config/config.rs @@ -84,7 +84,7 @@ pub struct DeserializedConfig { impl DeserializedConfig { /// Tries to create a config from an optional path. - pub fn from_opt_path(path: Option<&str>) -> Result { + pub async fn from_opt_path(path: Option<&str>) -> Result { debug!("path: {:?}", path); let config = if let Some(path) = path.map(PathBuf::from).or_else(Self::path) { @@ -104,7 +104,7 @@ impl DeserializedConfig { process::exit(0); } - wizard::configure()? + wizard::configure().await? }; if config.accounts.is_empty() { @@ -179,15 +179,15 @@ mod tests { use super::*; - fn make_config(config: &str) -> Result { + async fn make_config(config: &str) -> Result { let mut file = NamedTempFile::new().unwrap(); write!(file, "{}", config).unwrap(); - DeserializedConfig::from_opt_path(file.into_temp_path().to_str()) + DeserializedConfig::from_opt_path(file.into_temp_path().to_str()).await } - #[test] - fn empty_config() { - let config = make_config(""); + #[tokio::test] + async fn empty_config() { + let config = make_config("").await; assert_eq!( config.unwrap_err().root_cause().to_string(), @@ -195,9 +195,9 @@ mod tests { ); } - #[test] - fn account_missing_email_field() { - let config = make_config("[account]"); + #[tokio::test] + async fn account_missing_email_field() { + let config = make_config("[account]").await; assert!(config .unwrap_err() @@ -206,12 +206,13 @@ mod tests { .contains("missing field `email`")); } - #[test] - fn account_missing_backend_field() { + #[tokio::test] + async fn account_missing_backend_field() { let config = make_config( "[account] email = \"test@localhost\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -220,13 +221,14 @@ mod tests { .contains("missing field `backend`")); } - #[test] - fn account_invalid_backend_field() { + #[tokio::test] + async fn account_invalid_backend_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"bad\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -235,14 +237,15 @@ mod tests { .contains("unknown variant `bad`")); } - #[test] - fn imap_account_missing_host_field() { + #[tokio::test] + async fn imap_account_missing_host_field() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"imap\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -251,15 +254,16 @@ mod tests { .contains("missing field `imap-host`")); } - #[test] - fn account_backend_imap_missing_port_field() { + #[tokio::test] + async fn account_backend_imap_missing_port_field() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"imap\" imap-host = \"localhost\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -268,8 +272,8 @@ mod tests { .contains("missing field `imap-port`")); } - #[test] - fn account_backend_imap_missing_login_field() { + #[tokio::test] + async fn account_backend_imap_missing_login_field() { let config = make_config( "[account] email = \"test@localhost\" @@ -277,7 +281,8 @@ mod tests { backend = \"imap\" imap-host = \"localhost\" imap-port = 993", - ); + ) + .await; assert!(config .unwrap_err() @@ -286,8 +291,8 @@ mod tests { .contains("missing field `imap-login`")); } - #[test] - fn account_backend_imap_missing_passwd_cmd_field() { + #[tokio::test] + async fn account_backend_imap_missing_passwd_cmd_field() { let config = make_config( "[account] email = \"test@localhost\" @@ -296,7 +301,8 @@ mod tests { imap-host = \"localhost\" imap-port = 993 imap-login = \"login\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -305,14 +311,15 @@ mod tests { .contains("missing field `imap-auth`")); } - #[test] - fn account_backend_maildir_missing_root_dir_field() { + #[tokio::test] + async fn account_backend_maildir_missing_root_dir_field() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"maildir\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -322,14 +329,15 @@ mod tests { } #[cfg(feature = "notmuch-backend")] - #[test] - fn account_backend_notmuch_missing_db_path_field() { + #[tokio::test] + async fn account_backend_notmuch_missing_db_path_field() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"notmuch\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -338,13 +346,14 @@ mod tests { .contains("missing field `notmuch-db-path`")); } - #[test] - fn account_missing_sender_field() { + #[tokio::test] + async fn account_missing_sender_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -353,14 +362,15 @@ mod tests { .contains("missing field `sender`")); } - #[test] - fn account_invalid_sender_field() { + #[tokio::test] + async fn account_invalid_sender_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\" sender = \"bad\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -369,14 +379,15 @@ mod tests { .contains("unknown variant `bad`, expected one of `none`, `smtp`, `sendmail`"),); } - #[test] - fn account_smtp_sender_missing_host_field() { + #[tokio::test] + async fn account_smtp_sender_missing_host_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\" sender = \"smtp\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -385,15 +396,16 @@ mod tests { .contains("missing field `smtp-host`")); } - #[test] - fn account_smtp_sender_missing_port_field() { + #[tokio::test] + async fn account_smtp_sender_missing_port_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\" sender = \"smtp\" smtp-host = \"localhost\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -402,8 +414,8 @@ mod tests { .contains("missing field `smtp-port`")); } - #[test] - fn account_smtp_sender_missing_login_field() { + #[tokio::test] + async fn account_smtp_sender_missing_login_field() { let config = make_config( "[account] email = \"test@localhost\" @@ -411,7 +423,8 @@ mod tests { sender = \"smtp\" smtp-host = \"localhost\" smtp-port = 25", - ); + ) + .await; assert!(config .unwrap_err() @@ -420,8 +433,8 @@ mod tests { .contains("missing field `smtp-login`")); } - #[test] - fn account_smtp_sender_missing_auth_field() { + #[tokio::test] + async fn account_smtp_sender_missing_auth_field() { let config = make_config( "[account] email = \"test@localhost\" @@ -430,7 +443,8 @@ mod tests { smtp-host = \"localhost\" smtp-port = 25 smtp-login = \"login\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -439,14 +453,15 @@ mod tests { .contains("missing field `smtp-auth`")); } - #[test] - fn account_sendmail_sender_missing_cmd_field() { + #[tokio::test] + async fn account_sendmail_sender_missing_cmd_field() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\" sender = \"sendmail\"", - ); + ) + .await; assert!(config .unwrap_err() @@ -456,8 +471,8 @@ mod tests { } #[cfg(feature = "smtp-sender")] - #[test] - fn account_smtp_sender_minimum_config() { + #[tokio::test] + async fn account_smtp_sender_minimum_config() { use pimalaya_email::sender::SenderConfig; let config = make_config( @@ -470,7 +485,8 @@ mod tests { smtp-login = \"login\" smtp-auth = \"passwd\" smtp-passwd = { cmd = \"echo password\" }", - ); + ) + .await; assert_eq!( config.unwrap(), @@ -493,18 +509,19 @@ mod tests { )]), ..DeserializedConfig::default() } - ); + ) } - #[test] - fn account_sendmail_sender_minimum_config() { + #[tokio::test] + async fn account_sendmail_sender_minimum_config() { let config = make_config( "[account] email = \"test@localhost\" backend = \"none\" sender = \"sendmail\" sendmail-cmd = \"echo send\"", - ); + ) + .await; assert_eq!( config.unwrap(), @@ -521,11 +538,11 @@ mod tests { )]), ..DeserializedConfig::default() } - ); + ) } - #[test] - fn account_backend_imap_minimum_config() { + #[tokio::test] + async fn account_backend_imap_minimum_config() { let config = make_config( "[account] email = \"test@localhost\" @@ -536,7 +553,8 @@ mod tests { imap-login = \"login\" imap-auth = \"passwd\" imap-passwd = { cmd = \"echo password\" }", - ); + ) + .await; assert_eq!( config.unwrap(), @@ -559,17 +577,19 @@ mod tests { )]), ..DeserializedConfig::default() } - ); + ) } - #[test] - fn account_backend_maildir_minimum_config() { + + #[tokio::test] + async fn account_backend_maildir_minimum_config() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"maildir\" maildir-root-dir = \"/tmp/maildir\"", - ); + ) + .await; assert_eq!( config.unwrap(), @@ -586,19 +606,20 @@ mod tests { )]), ..DeserializedConfig::default() } - ); + ) } #[cfg(feature = "notmuch-backend")] - #[test] - fn account_backend_notmuch_minimum_config() { + #[tokio::test] + async fn account_backend_notmuch_minimum_config() { let config = make_config( "[account] email = \"test@localhost\" sender = \"none\" backend = \"notmuch\" notmuch-db-path = \"/tmp/notmuch.db\"", - ); + ) + .await; assert_eq!( config.unwrap(), diff --git a/src/config/wizard.rs b/src/config/wizard.rs index 7868ce7..849e2ea 100644 --- a/src/config/wizard.rs +++ b/src/config/wizard.rs @@ -30,12 +30,12 @@ macro_rules! wizard_log { pub(crate) static THEME: Lazy = Lazy::new(ColorfulTheme::default); -pub(crate) fn configure() -> Result { +pub(crate) async fn configure() -> Result { wizard_log!("Configuring your first account:"); let mut config = DeserializedConfig::default(); - while let Some((name, account_config)) = account::wizard::configure()? { + while let Some((name, account_config)) = account::wizard::configure().await? { config.accounts.insert(name, account_config); if !Confirm::new() diff --git a/src/domain/account/config.rs b/src/domain/account/config.rs index 7673891..b942214 100644 --- a/src/domain/account/config.rs +++ b/src/domain/account/config.rs @@ -258,6 +258,7 @@ impl DeserializedAccountConfig { sender }, + pgp: Default::default(), } } } diff --git a/src/domain/account/wizard.rs b/src/domain/account/wizard.rs index 2198e31..306b9fd 100644 --- a/src/domain/account/wizard.rs +++ b/src/domain/account/wizard.rs @@ -6,7 +6,7 @@ use crate::{backend, config::wizard::THEME, sender}; use super::DeserializedAccountConfig; -pub(crate) fn configure() -> Result> { +pub(crate) async fn configure() -> Result> { let mut config = DeserializedAccountConfig::default(); let account_name = Input::with_theme(&*THEME) @@ -31,9 +31,9 @@ pub(crate) fn configure() -> Result> .interact()?, ); - config.backend = backend::wizard::configure(&account_name, &config.email)?; + config.backend = backend::wizard::configure(&account_name, &config.email).await?; - config.sender = sender::wizard::configure(&account_name, &config.email)?; + config.sender = sender::wizard::configure(&account_name, &config.email).await?; Ok(Some((account_name, config))) } diff --git a/src/domain/backend/imap/wizard.rs b/src/domain/backend/imap/wizard.rs index a5f21ee..884a8f7 100644 --- a/src/domain/backend/imap/wizard.rs +++ b/src/domain/backend/imap/wizard.rs @@ -30,7 +30,7 @@ const KEYRING: &str = "Ask my password, then save it in my system's global keyri const RAW: &str = "Ask my password, then save it in the configuration file (not safe)"; const CMD: &str = "Ask me a shell command that exposes my password"; -pub(crate) fn configure(account_name: &str, email: &str) -> Result { +pub(crate) async fn configure(account_name: &str, email: &str) -> Result { let mut config = ImapConfig::default(); config.host = Input::with_theme(&*THEME) @@ -201,8 +201,9 @@ pub(crate) fn configure(account_name: &str, email: &str) -> Result Result { +pub(crate) async fn configure(account_name: &str, email: &str) -> Result { let backend = Select::with_theme(&*THEME) .with_prompt("Email backend") .items(BACKENDS) @@ -35,7 +35,7 @@ pub(crate) fn configure(account_name: &str, email: &str) -> Result imap::wizard::configure(account_name, email), + Some(idx) if BACKENDS[idx] == IMAP => imap::wizard::configure(account_name, email).await, Some(idx) if BACKENDS[idx] == MAILDIR => maildir::wizard::configure(), #[cfg(feature = "notmuch-backend")] Some(idx) if BACKENDS[idx] == NOTMUCH => notmuch::wizard::configure(), diff --git a/src/domain/sender/smtp/wizard.rs b/src/domain/sender/smtp/wizard.rs index 5f92a9f..75923ed 100644 --- a/src/domain/sender/smtp/wizard.rs +++ b/src/domain/sender/smtp/wizard.rs @@ -30,7 +30,7 @@ const KEYRING: &str = "Ask the password, then save it in my system's global keyr const RAW: &str = "Ask the password, then save it in the configuration file (not safe)"; const CMD: &str = "Use a shell command that exposes the password"; -pub(crate) fn configure(account_name: &str, email: &str) -> Result { +pub(crate) async fn configure(account_name: &str, email: &str) -> Result { let mut config = SmtpConfig::default(); config.host = Input::with_theme(&*THEME) @@ -201,8 +201,9 @@ pub(crate) fn configure(account_name: &str, email: &str) -> Result println!("{}", redirect_url.to_string()); println!(""); - let (access_token, refresh_token) = - auth_code_grant.wait_for_redirection(&client, csrf_token)?; + let (access_token, refresh_token) = auth_code_grant + .wait_for_redirection(&client, csrf_token) + .await?; Secret::new_keyring_entry(format!("{account_name}-smtp-oauth2-access-token")) .set_keyring_entry_secret(access_token)?; diff --git a/src/domain/sender/wizard.rs b/src/domain/sender/wizard.rs index 32ce06d..decd399 100644 --- a/src/domain/sender/wizard.rs +++ b/src/domain/sender/wizard.rs @@ -20,7 +20,7 @@ const SENDERS: &[&str] = &[ NONE, ]; -pub(crate) fn configure(account_name: &str, email: &str) -> Result { +pub(crate) async fn configure(account_name: &str, email: &str) -> Result { let sender = Select::with_theme(&*THEME) .with_prompt("Email sender") .items(SENDERS) @@ -29,7 +29,7 @@ pub(crate) fn configure(account_name: &str, email: &str) -> Result match sender { #[cfg(feature = "smtp-sender")] - Some(n) if SENDERS[n] == SMTP => smtp::wizard::configure(account_name, email), + Some(n) if SENDERS[n] == SMTP => smtp::wizard::configure(account_name, email).await, Some(n) if SENDERS[n] == SENDMAIL => sendmail::wizard::configure(), _ => Ok(SenderConfig::None), } diff --git a/src/main.rs b/src/main.rs index eb65dbb..904822c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,7 @@ async fn main() -> Result<()> { let raw_args: Vec = env::args().collect(); if raw_args.len() > 1 && raw_args[1].starts_with("mailto:") { let url = Url::parse(&raw_args[1])?; - let config = DeserializedConfig::from_opt_path(None)?; + let config = DeserializedConfig::from_opt_path(None).await?; let account_config = config.to_account_config(None)?; let mut backend = BackendBuilder::new(account_config.clone()).build().await?; let mut sender = SenderBuilder::new(account_config.clone()).build().await?; @@ -99,7 +99,7 @@ async fn main() -> Result<()> { _ => (), } - let config = DeserializedConfig::from_opt_path(config::args::parse_arg(&m))?; + let config = DeserializedConfig::from_opt_path(config::args::parse_arg(&m)).await?; let account_config = config.to_account_config(account::args::parse_arg(&m))?; let folder = folder::args::parse_source_arg(&m); let disable_cache = cache::args::parse_disable_cache_flag(&m);