diff --git a/Cargo.lock b/Cargo.lock index e8700ee4f..749e55fb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,9 +60,9 @@ checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -174,9 +174,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -463,9 +463,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -545,9 +545,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys", @@ -618,9 +618,9 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -633,9 +633,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -643,15 +643,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -660,38 +660,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -764,21 +764,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "gloo-storage" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" -dependencies = [ - "gloo-utils", - "js-sys", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "gloo-timers" version = "0.2.6" @@ -845,7 +830,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", "serde", ] @@ -1008,9 +993,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" @@ -1029,9 +1014,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1066,9 +1051,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "lightning" @@ -1170,9 +1155,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -1257,6 +1242,7 @@ dependencies = [ "wasm-bindgen-futures", "wasm-bindgen-test", "web-sys", + "windowless_sleep", ] [[package]] @@ -1269,7 +1255,6 @@ dependencies = [ "console_error_panic_hook", "futures", "getrandom", - "gloo-storage", "gloo-utils", "instant", "js-sys", @@ -1290,6 +1275,7 @@ dependencies = [ "wasm-bindgen-test", "wasm-logger", "web-sys", + "windowless_sleep", ] [[package]] @@ -1340,7 +1326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525a8f75106f4eeb1fedaacadc61547548fe4715c3edde7d03eed2900b467952" dependencies = [ "aes", - "base64 0.21.4", + "base64 0.21.5", "bitcoin_hashes 0.12.0", "cbc", "getrandom", @@ -1425,9 +1411,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -1446,7 +1432,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1457,9 +1443,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" dependencies = [ "cc", "libc", @@ -1534,7 +1520,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1653,9 +1639,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] @@ -1695,7 +1681,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -1745,17 +1731,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys", ] [[package]] @@ -1775,9 +1760,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -1788,9 +1773,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -1800,9 +1785,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -1831,9 +1816,9 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1936,29 +1921,29 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -2036,9 +2021,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "subtle" @@ -2059,9 +2044,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -2091,9 +2076,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", @@ -2125,7 +2110,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2168,7 +2153,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2234,9 +2219,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2271,7 +2256,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2368,9 +2353,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" @@ -2434,9 +2419,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2444,24 +2429,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -2471,9 +2456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2481,28 +2466,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-bindgen-test" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6e302a7ea94f83a6d09e78e7dc7d9ca7b186bc2829c24a22d0753efd680671" +checksum = "c6433b7c56db97397842c46b67e11873eda263170afeb3a2dc74a7cb370fee0d" dependencies = [ "console_error_panic_hook", "js-sys", @@ -2514,12 +2499,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecb993dd8c836930ed130e020e77d9b2e65dd0fbab1b67c790b0f5d80b11a575" +checksum = "493fcbab756bb764fa37e6bee8cec2dd709eb4273d06d0c282a5e74275ded735" dependencies = [ "proc-macro2", "quote", + "syn 2.0.39", ] [[package]] @@ -2535,9 +2521,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -2571,6 +2557,17 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windowless_sleep" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3d03e99b3e6e0a5801289a81160c868bf2b1a35c937678b34efe30e749d512" +dependencies = [ + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "windows-core" version = "0.51.1" @@ -2692,5 +2689,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] diff --git a/mutiny-core/Cargo.toml b/mutiny-core/Cargo.toml index 052d69579..08f853e9e 100644 --- a/mutiny-core/Cargo.toml +++ b/mutiny-core/Cargo.toml @@ -69,11 +69,14 @@ test-utils = [] [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = "0.2.84" wasm-bindgen-futures = { version = "0.4.33" } -web-sys = { version = "0.3.60", features = ["console"] } js-sys = { version = "0.3.60" } gloo-net = { version = "0.2.4" } instant = { version = "0.1", features = ["wasm-bindgen"] } getrandom = { version = "0.2", features = ["js"] } +windowless_sleep = "0.1.1" + +[target.'cfg(target_arch = "wasm32")'.dev-dependencies] +web-sys = { version = "0.3.60", features = ["console"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tokio = { version = "1", features = ["rt"] } diff --git a/mutiny-core/src/utils.rs b/mutiny-core/src/utils.rs index 9bfe6adeb..3121f8bc1 100644 --- a/mutiny-core/src/utils.rs +++ b/mutiny-core/src/utils.rs @@ -24,21 +24,13 @@ pub(crate) fn min_lightning_amount(network: Network) -> u64 { pub async fn sleep(millis: i32) { #[cfg(target_arch = "wasm32")] { - let mut cb = |resolve: js_sys::Function, _reject: js_sys::Function| { - web_sys::window() - .unwrap() - .set_timeout_with_callback_and_timeout_and_arguments_0(&resolve, millis) - .unwrap(); - }; - let p = js_sys::Promise::new(&mut cb); - wasm_bindgen_futures::JsFuture::from(p).await.unwrap(); + windowless_sleep::sleep(millis).await; } #[cfg(not(target_arch = "wasm32"))] { tokio::time::sleep(Duration::from_millis(millis.try_into().unwrap())).await; } } - pub fn now() -> Duration { #[cfg(target_arch = "wasm32")] return instant::SystemTime::now() diff --git a/mutiny-wasm/Cargo.toml b/mutiny-wasm/Cargo.toml index 3388628df..9a7071f82 100644 --- a/mutiny-wasm/Cargo.toml +++ b/mutiny-wasm/Cargo.toml @@ -34,14 +34,13 @@ wasm-logger = "0.2.0" log = "0.4.17" rexie = "0.4" js-sys = "0.3.60" -gloo-storage = "0.2.2" gloo-utils = { version = "0.1.6", features = ["serde"] } -web-sys = { version = "0.3.60", features = ["console"] } bip39 = { version = "2.0.0" } getrandom = { version = "0.2", features = ["js"] } futures = "0.3.25" urlencoding = "2.1.2" once_cell = "1.18.0" +windowless_sleep = "0.1.1" # The `console_error_panic_hook` crate provides better debugging of panics by # logging them with `console.error`. This is great for development, but requires @@ -52,9 +51,10 @@ console_error_panic_hook = { version = "0.1.6", optional = true } [dev-dependencies] mutiny-core = { path = "../mutiny-core", features = ["test-utils"] } wasm-bindgen-test = "0.3.33" +web-sys = { version = "0.3.60", features = ["console"] } [features] -default = [ ] +default = [] [package.metadata.wasm-pack.profile.release] wasm-opt = true diff --git a/mutiny-wasm/src/indexed_db.rs b/mutiny-wasm/src/indexed_db.rs index cc0732b57..b4650d6d3 100644 --- a/mutiny-wasm/src/indexed_db.rs +++ b/mutiny-wasm/src/indexed_db.rs @@ -1,6 +1,5 @@ use anyhow::anyhow; use bip39::Mnemonic; -use gloo_storage::{LocalStorage, Storage}; use gloo_utils::format::JsValueSerdeExt; use lightning::util::logger::Logger; use lightning::{log_debug, log_error}; @@ -265,26 +264,6 @@ impl IndexedDbStorage { map.set(key, json)?; } - // get the local storage data, this should take priority if it is being used - log_debug!(logger, "Reading from local storage"); - let local_storage = LocalStorage::raw(); - let length = LocalStorage::length(); - for index in 0..length { - let key_opt: Option = local_storage.key(index).unwrap(); - - if let Some(key) = key_opt { - // only add to the map if it is a key we expect - // this is to prevent any unexpected data from being added to the map - // from either malicious 3rd party or a previous version of the wallet - if write_to_local_storage(&key) { - // compare versions between local storage and indexed db storage - if let Some((key, value)) = Self::handle_local_storage_key(key, &map, logger)? { - map.set_data(key, value, None)?; - } - } - } - } - match vss { None => { let final_map = map.memory.read().unwrap(); @@ -309,76 +288,6 @@ impl IndexedDbStorage { } } - fn handle_local_storage_key( - key: String, - current: &MemoryStorage, - logger: &MutinyLogger, - ) -> Result, MutinyError> { - if key.starts_with(MONITORS_PREFIX_KEY) { - // we can get versions from monitors, so we should compare - match current.get::>(&key)? { - Some(bytes) => { - // check first byte is 1, then take u64 from next 8 bytes - let current_version = utils::get_monitor_version(&bytes); - - let obj: Value = LocalStorage::get(&key).unwrap(); - let value = decrypt_value(&key, obj, current.password())?; - if let Ok(local_bytes) = serde_json::from_value::>(value.clone()) { - let local_version = utils::get_monitor_version(&local_bytes); - - // if the current version is less than the version from local storage - // then we want to use the local storage version - if current_version < local_version { - log_debug!( - logger, - "Using local storage key {key} with version {}", - local_version - ); - return Ok(Some((key, value))); - } - } - } - None => { - let value: Value = LocalStorage::get(&key).unwrap(); - return Ok(Some((key, value))); - } - } - } else if key.starts_with(CHANNEL_MANAGER_KEY) { - // we can get versions from channel manager, so we should compare - match current.get_data::(&key) { - Ok(Some(local)) => { - let obj: Value = LocalStorage::get(&key).unwrap(); - let value = decrypt_value(&key, obj, current.password())?; - - // if the current version is less than the version from local storage - // then we want to use the local storage version - if let Ok(v) = serde_json::from_value::(value.clone()) { - if v.version > local.version { - log_debug!( - logger, - "Using local storage key {key} with version {}", - v.version - ); - return Ok(Some((key, value))); - } - } - } - Ok(None) => { - let obj: Value = LocalStorage::get(&key).unwrap(); - let value = decrypt_value(&key, obj, current.password())?; - if serde_json::from_value::(value.clone()).is_ok() { - return Ok(Some((key, value))); - } - } - Err(_) => return Err(MutinyError::IncorrectPassword), - } - } - - log_debug!(logger, "Skipping local storage key {key}"); - - Ok(None) - } - async fn handle_vss_key( kv: KeyVersion, vss: &MutinyVssClient, @@ -544,18 +453,6 @@ fn used_once(key: &str) -> bool { } } -/// To help prevent force closes we save to local storage as well as indexed db. -/// This is because indexed db is not always reliable. -/// -/// We need to do this for the channel manager and channel monitors. -fn write_to_local_storage(key: &str) -> bool { - match key { - str if str.starts_with(CHANNEL_MANAGER_KEY) => true, - str if str.starts_with(MONITORS_PREFIX_KEY) => true, - _ => false, - } -} - impl MutinyStorage for IndexedDbStorage { fn password(&self) -> Option<&str> { self.password.as_deref() @@ -588,15 +485,6 @@ impl MutinyStorage for IndexedDbStorage { }; }); - // Some values we want to write to local storage as well as indexed db - if write_to_local_storage(&key) { - LocalStorage::set(&key, &data).map_err(|e| { - MutinyError::write_err(MutinyStorageError::Other(anyhow!( - "Failed to write to local storage: {e}" - ))) - })?; - } - // some values only are read once, so we don't need to write them to memory, // just need them in indexed db for next time if !used_once(key.as_ref()) { @@ -621,15 +509,6 @@ impl MutinyStorage for IndexedDbStorage { Self::save_to_indexed_db(&self.indexed_db, &key, &data).await?; - // Some values we want to write to local storage as well as indexed db - if write_to_local_storage(&key) { - LocalStorage::set(&key, &data).map_err(|e| { - MutinyError::write_err(MutinyStorageError::Other(anyhow!( - "Failed to write to local storage: {e}" - ))) - })?; - } - // some values only are read once, so we don't need to write them to memory, // just need them in indexed db for next time if !used_once(key.as_ref()) { @@ -695,11 +574,6 @@ impl MutinyStorage for IndexedDbStorage { .map_err(|e| MutinyError::write_err(e.into()))?; for key in keys { - // Some values we want to write to local storage as well as indexed db - // we should delete them from local storage as well - if write_to_local_storage(&key) { - LocalStorage::delete(&key) - } map.remove(&key); } @@ -818,9 +692,6 @@ impl MutinyStorage for IndexedDbStorage { .await .map_err(|e| MutinyError::write_err(anyhow!("Failed clear indexed db: {e}").into()))?; - // We use some localstorage right now for ensuring channel data - LocalStorage::clear(); - Ok(()) } @@ -839,20 +710,15 @@ impl MutinyStorage for IndexedDbStorage { #[cfg(test)] mod tests { use super::*; - use crate::indexed_db::{IndexedDbStorage, WALLET_OBJECT_STORE_NAME}; - use crate::utils::sleep; + use crate::indexed_db::IndexedDbStorage; use crate::utils::test::log; use bip39::Mnemonic; - use bitcoin::hashes::hex::ToHex; - use gloo_storage::{LocalStorage, Storage}; use mutiny_core::storage::MutinyStorage; - use mutiny_core::test_utils::{MANAGER_BYTES, MONITOR_VERSION_HIGHER, MONITOR_VERSION_LOWER}; + use mutiny_core::utils::sleep; use mutiny_core::{encrypt::encryption_key_from_pass, logging::MutinyLogger}; - use rexie::TransactionMode; use serde_json::json; use std::str::FromStr; use std::sync::Arc; - use wasm_bindgen::JsValue; use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; wasm_bindgen_test_configure!(run_in_browser); @@ -1018,102 +884,17 @@ mod tests { IndexedDbStorage::clear().await.unwrap(); } - async fn compare_local_storage_versions( - test_name: &str, - local_storage: Vec, - indexed_db: Vec, - ) -> Vec { - let key = format!("{MONITORS_PREFIX_KEY}test_{test_name}"); - // set in local storage - LocalStorage::set(&key, local_storage).unwrap(); - // set in indexed db - let rexie = IndexedDbStorage::build_indexed_db_database().await.unwrap(); - let tx = rexie - .transaction(&[WALLET_OBJECT_STORE_NAME], TransactionMode::ReadWrite) - .unwrap(); - let store = tx.store(WALLET_OBJECT_STORE_NAME).unwrap(); - store - .put( - &JsValue::from_serde(&indexed_db).unwrap(), - Some(&JsValue::from(&key)), - ) - .await - .unwrap(); - - tx.done().await.unwrap(); - - let logger = Arc::new(MutinyLogger::default()); - let storage = IndexedDbStorage::new(None, None, None, logger) - .await - .unwrap(); - - let bytes: Vec = storage.get(&key).unwrap().unwrap(); - - // clear the storage to clean up - IndexedDbStorage::clear().await.unwrap(); - - bytes - } - - #[test] - async fn test_local_storage_version_0_indexed_db_version_max() { - let test_name = "test_local_storage_version_0_indexed_db_version_max"; - log!("{test_name}"); - - let bytes = compare_local_storage_versions( - test_name, - MONITOR_VERSION_LOWER.to_vec(), - MONITOR_VERSION_HIGHER.to_vec(), - ) - .await; - assert_eq!(bytes, MONITOR_VERSION_HIGHER); - } - - #[test] - async fn test_local_storage_version_max_indexed_db_version_0() { - let test_name = "test_local_storage_version_max_indexed_db_version_0"; - log!("{test_name}"); - - let bytes = compare_local_storage_versions( - test_name, - MONITOR_VERSION_HIGHER.to_vec(), - MONITOR_VERSION_LOWER.to_vec(), - ) - .await; - assert_eq!(bytes, MONITOR_VERSION_HIGHER); - } - - #[test] - async fn test_local_storage_version_max_indexed_db_version_max() { - let test_name = "test_local_storage_version_max_indexed_db_version_max"; - log!("{test_name}"); - - let bytes = compare_local_storage_versions( - test_name, - MONITOR_VERSION_HIGHER.to_vec(), - MONITOR_VERSION_HIGHER.to_vec(), - ) - .await; - assert_eq!(bytes, MONITOR_VERSION_HIGHER); - } - #[test] async fn test_correct_incorrect_password_error() { let test_name = "test_correct_incorrect_password_error"; log!("{test_name}"); let logger = Arc::new(MutinyLogger::default()); - let key = format!("{CHANNEL_MANAGER_KEY}_test_{test_name}"); - let data = VersionedValue { - version: 69, - // just use this as dummy data - value: Value::String(MANAGER_BYTES.to_hex()), - }; let storage = IndexedDbStorage::new(None, None, None, logger.clone()) .await .unwrap(); - - storage.set_data(&key, data, None).unwrap(); + let seed = generate_seed(12).unwrap(); + storage.set_data(MNEMONIC_KEY, seed, None).unwrap(); // wait for the storage to be persisted utils::sleep(1_000).await; @@ -1125,9 +906,11 @@ mod tests { .transpose() .unwrap(); - let result = IndexedDbStorage::new(password, cipher, None, logger).await; + let storage = IndexedDbStorage::new(password, cipher, None, logger) + .await + .unwrap(); - match result { + match storage.get_mnemonic() { Err(MutinyError::IncorrectPassword) => (), Ok(_) => panic!("Expected IncorrectPassword error, got Ok"), Err(e) => panic!("Expected IncorrectPassword error, got {:?}", e), diff --git a/mutiny-wasm/src/lib.rs b/mutiny-wasm/src/lib.rs index e557fc9cd..cbc86eb0c 100644 --- a/mutiny-wasm/src/lib.rs +++ b/mutiny-wasm/src/lib.rs @@ -15,7 +15,6 @@ mod utils; use crate::error::MutinyJsError; use crate::indexed_db::IndexedDbStorage; use crate::models::*; -use crate::utils::sleep; use bip39::Mnemonic; use bitcoin::consensus::deserialize; use bitcoin::hashes::hex::{FromHex, ToHex}; @@ -36,6 +35,7 @@ use mutiny_core::redshift::RedshiftManager; use mutiny_core::redshift::RedshiftRecipient; use mutiny_core::scb::EncryptedSCB; use mutiny_core::storage::MutinyStorage; +use mutiny_core::utils::sleep; use mutiny_core::vss::MutinyVssClient; use mutiny_core::{labels::LabelStorage, nodemanager::NodeManager}; use mutiny_core::{logging::MutinyLogger, nostr::ProfileType}; @@ -1561,6 +1561,7 @@ mod tests { use crate::indexed_db::IndexedDbStorage; use js_sys::Array; use mutiny_core::storage::MutinyStorage; + use mutiny_core::utils::sleep; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue; use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure}; @@ -1591,7 +1592,7 @@ mod tests { ) .await .expect("mutiny wallet should initialize"); - super::utils::sleep(1_000).await; + sleep(1_000).await; assert!(MutinyWallet::has_node_manager(password).await); IndexedDbStorage::clear() @@ -1620,7 +1621,7 @@ mod tests { ) .await .expect("mutiny wallet should initialize"); - super::utils::sleep(1_000).await; + sleep(1_000).await; assert!(MutinyWallet::has_node_manager(None).await); uninit().await; @@ -1679,7 +1680,7 @@ mod tests { ) .await .expect("mutiny wallet should initialize"); - super::utils::sleep(1_000).await; + sleep(1_000).await; assert!(MutinyWallet::has_node_manager(password.clone()).await); // try to create a second @@ -1855,7 +1856,7 @@ mod tests { assert_ne!("", node_identity.pubkey()); // sleep to make sure logs save - super::utils::sleep(6_000).await; + sleep(6_000).await; let logs = MutinyWallet::get_logs(None).await.expect("should get logs"); let parsed_logs = js_to_option_vec_string(logs).expect("should parse logs"); assert!(parsed_logs.is_some()); @@ -1906,7 +1907,7 @@ mod tests { assert_ne!("", node_identity.pubkey()); // sleep to make sure logs save - super::utils::sleep(6_000).await; + sleep(6_000).await; let logs = MutinyWallet::get_logs(password) .await .expect("should get logs"); diff --git a/mutiny-wasm/src/models.rs b/mutiny-wasm/src/models.rs index e4071ce4d..0b542d5d9 100644 --- a/mutiny-wasm/src/models.rs +++ b/mutiny-wasm/src/models.rs @@ -1,3 +1,4 @@ +use crate::error::MutinyJsError; use ::nostr::key::XOnlyPublicKey; use ::nostr::prelude::{FromBech32, ToBech32}; use bitcoin::hashes::hex::ToHex; @@ -10,14 +11,13 @@ use lnurl::lnurl::LnUrl; use mutiny_core::labels::Contact as MutinyContact; use mutiny_core::nostr::nwc::SpendingConditions; use mutiny_core::redshift::{RedshiftRecipient, RedshiftStatus}; +use mutiny_core::utils::now; use mutiny_core::*; use serde::{Deserialize, Serialize, Serializer}; use serde_json::json; use std::str::FromStr; use wasm_bindgen::prelude::*; -use crate::{error::MutinyJsError, utils}; - #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)] #[wasm_bindgen] pub enum ActivityType { @@ -801,7 +801,7 @@ impl Contact { ln_address, lnurl, image_url, - last_used: utils::now().as_secs(), + last_used: now().as_secs(), }) } diff --git a/mutiny-wasm/src/utils.rs b/mutiny-wasm/src/utils.rs index 76b2158f4..b7d6cc58c 100644 --- a/mutiny-wasm/src/utils.rs +++ b/mutiny-wasm/src/utils.rs @@ -1,5 +1,3 @@ -use core::time::Duration; -use instant::SystemTime; use log::{debug, Level}; use wasm_bindgen::prelude::*; @@ -21,24 +19,6 @@ pub async fn main_js() -> Result<(), JsValue> { Ok(()) } -pub fn now() -> Duration { - SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH) - .unwrap() -} - -#[allow(dead_code)] -pub async fn sleep(millis: i32) { - let mut cb = |resolve: js_sys::Function, _reject: js_sys::Function| { - web_sys::window() - .unwrap() - .set_timeout_with_callback_and_timeout_and_arguments_0(&resolve, millis) - .unwrap(); - }; - let p = js_sys::Promise::new(&mut cb); - wasm_bindgen_futures::JsFuture::from(p).await.unwrap(); -} - #[cfg(test)] pub(crate) mod test { macro_rules! log {