diff --git a/Cargo.lock b/Cargo.lock index 3369877..18bc1fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -51,9 +51,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" @@ -81,22 +81,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.60.2", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.10" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.60.2", + "windows-sys", ] [[package]] @@ -149,9 +149,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "byteorder" @@ -167,9 +167,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.39" +version = "1.2.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" +checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" dependencies = [ "find-msvc-tools", "shlex", @@ -177,15 +177,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", "js-sys", @@ -224,9 +224,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.48" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" +checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" dependencies = [ "clap_builder", "clap_derive", @@ -234,9 +234,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.48" +version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" dependencies = [ "anstream", "anstyle", @@ -246,21 +246,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.47" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "clap_lex" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" [[package]] name = "cmz" @@ -278,34 +278,34 @@ dependencies = [ "serde_bytes", "serde_with", "sigma-compiler", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] name = "cmz-core" -version = "0.1.0-rc2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4a2a2128f7d96b1f9fec3f985079f0ca7799b8fb2f270139916a0e4a7412cd" +checksum = "d44996d931fb4b23721bbbec00396fec6f7505fc0534da8891bb1a3d10ec1490" dependencies = [ "clap", "darling 0.20.11", "prettyplease", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "cmz-derive" -version = "0.1.0-rc2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9382d9aa6d7e68453df90df78d2719674f8faa78c524131c4e8b9d0361e55bc6" +checksum = "a1910788dc7a1e8d23bbeacd98162eb440a01d28914e7b935a7a49db2a208da1" dependencies = [ "cmz-core", "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -398,9 +398,9 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", "typenum", @@ -433,7 +433,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -467,7 +467,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -481,7 +481,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -492,7 +492,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -503,14 +503,14 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "deranged" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", "serde_core", @@ -580,9 +580,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "find-msvc-tools" -version = "0.1.2" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" [[package]] name = "fnv" @@ -617,9 +617,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", @@ -639,12 +639,13 @@ dependencies = [ [[package]] name = "half" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", + "zerocopy", ] [[package]] @@ -661,9 +662,9 @@ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" [[package]] name = "heck" @@ -729,21 +730,24 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.16.1", "serde", "serde_core", ] [[package]] name = "indoc" -version = "2.0.6" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] [[package]] name = "inventory" @@ -756,20 +760,20 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" @@ -791,15 +795,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "js-sys" -version = "0.3.81" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ "once_cell", "wasm-bindgen", @@ -822,9 +826,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.176" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libm" @@ -834,9 +838,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "maplit" @@ -844,6 +848,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + [[package]] name = "matrixmultiply" version = "0.3.10" @@ -884,6 +897,15 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys", +] + [[package]] name = "num-bigint" version = "0.3.3" @@ -963,9 +985,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "ooniauth-core" @@ -985,9 +1007,23 @@ dependencies = [ "serde_with", "sha2", "subtle", - "syn 2.0.106", - "thiserror 2.0.17", + "syn 2.0.114", + "thiserror 2.0.18", "time", + "tracing", + "tracing-forest", + "tracing-subscriber", +] + +[[package]] +name = "ooniauth-ffi" +version = "0.1.0" +dependencies = [ + "hex", + "ooniauth-core", + "rand", + "tracing-forest", + "tracing-subscriber", ] [[package]] @@ -1002,7 +1038,7 @@ dependencies = [ "pyo3-stub-gen", "rand", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -1020,6 +1056,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + [[package]] name = "plotters" version = "0.3.7" @@ -1050,9 +1092,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" [[package]] name = "portable-atomic-util" @@ -1085,14 +1127,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" dependencies = [ "unicode-ident", ] @@ -1142,7 +1184,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -1155,7 +1197,7 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -1167,7 +1209,7 @@ dependencies = [ "anyhow", "chrono", "either", - "indexmap 2.11.4", + "indexmap 2.13.0", "inventory", "itertools 0.13.0", "log", @@ -1190,14 +1232,14 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "quote" -version = "1.0.41" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" dependencies = [ "proc-macro2", ] @@ -1281,14 +1323,14 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "regex" -version = "1.11.3" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -1298,9 +1340,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1309,9 +1351,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rustc-hash" @@ -1334,12 +1376,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - [[package]] name = "same-file" version = "1.0.6" @@ -1363,9 +1399,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.0.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" dependencies = [ "dyn-clone", "ref-cast", @@ -1416,46 +1452,45 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] name = "serde_spanned" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" dependencies = [ "serde_core", ] [[package]] name = "serde_with" -version = "3.14.1" +version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c522100790450cf78eeac1507263d0a350d4d5b30df0c8e1fe051a10c22b376e" +checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.11.4", + "indexmap 2.13.0", "schemars 0.9.0", - "schemars 1.0.4", - "serde", - "serde_derive", + "schemars 1.2.0", + "serde_core", "serde_json", "serde_with_macros", "time", @@ -1463,14 +1498,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.14.1" +version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327ada00f7d64abaac1e55a6911e90cf665aa051b9a561c7006c157f4633135e" +checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -1494,6 +1529,15 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1502,9 +1546,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "sigma-compiler" -version = "0.1.0-rc2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5916890ed39d5bb79e0c9f21043fd44fadd9387b58d52c033ffe61108ca5332" +checksum = "736016d29725f54ee767083ded55e1ddf46b9aa081ae0005423c2b36587ea0be" dependencies = [ "group", "rand", @@ -1515,25 +1559,25 @@ dependencies = [ [[package]] name = "sigma-compiler-core" -version = "0.1.0-rc2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc19242949b28e1efafe2bbd5f55c9db8b9cd7aaadbb797868aa7864bd405a97" +checksum = "a6a96f60157d659e1f7ac2f04999490ca684cfc20c06a6de5aa5502880fa03b7" dependencies = [ "clap", "prettyplease", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "sigma-compiler-derive" -version = "0.1.0-rc2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6df1acaaf98084f800ba3583880bf708428c71a959a492664a1a1ff0f83af59" +checksum = "7c11631f78f12c1eb5e424a6322f173f2ab37d2643de397fe605dfb9b06d4f86" dependencies = [ "sigma-compiler-core", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] @@ -1558,6 +1602,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + [[package]] name = "strsim" version = "0.11.1" @@ -1583,9 +1633,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -1600,9 +1650,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c" +checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba" [[package]] name = "thiserror" @@ -1615,11 +1665,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -1630,46 +1680,55 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", ] [[package]] name = "time" -version = "0.3.44" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" dependencies = [ "num-conv", "time-core", @@ -1687,11 +1746,11 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.7" +version = "0.9.11+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" +checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46" dependencies = [ - "indexmap 2.11.4", + "indexmap 2.13.0", "serde_core", "serde_spanned", "toml_datetime", @@ -1702,39 +1761,112 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.2" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] [[package]] name = "toml_parser" -version = "1.0.3" +version = "1.0.6+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" dependencies = [ "winnow", ] [[package]] name = "toml_writer" -version = "1.0.3" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-forest" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee40835db14ddd1e3ba414292272eddde9dad04d3d4b65509656414d1c42592f" +dependencies = [ + "smallvec", + "thiserror 1.0.69", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unindent" @@ -1748,6 +1880,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "version_check" version = "0.9.5" @@ -1772,9 +1910,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" -version = "0.2.104" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" dependencies = [ "cfg-if", "once_cell", @@ -1783,25 +1921,11 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.106", - "wasm-bindgen-shared", -] - [[package]] name = "wasm-bindgen-macro" -version = "0.2.104" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1809,31 +1933,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.104" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.106", - "wasm-bindgen-backend", + "syn 2.0.114", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.104" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.81" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ "js-sys", "wasm-bindgen", @@ -1845,14 +1969,14 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.1", + "windows-sys", ] [[package]] name = "windows-core" -version = "0.62.1" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", @@ -1863,211 +1987,64 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.1" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "windows-interface" -version = "0.59.2" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "windows-link" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.4", -] - -[[package]] -name = "windows-sys" -version = "0.61.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ "windows-link", ] -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" - [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" [[package]] name = "wyz" @@ -2080,26 +2057,32 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.114", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zmij" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2" diff --git a/Cargo.toml b/Cargo.toml index 7a3faf3..1dd3785 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,10 @@ [workspace] -members = ["ooniauth-core", "ooniauth-py"] +members = ["ooniauth-core", "ooniauth-ffi", "ooniauth-py"] resolver = "2" [workspace.dependencies] rand = "0.8.5" bincode = "1" -# cmz = "0.1.0" -cmz = {git = "https://github.com/sigma-rs/cmz"} +cmz = { git = "https://github.com/sigma-rs/cmz" } serde = "1.0.219" thiserror = "2.0.12" - diff --git a/Readme.md b/Readme.md index 87bb7fb..2490885 100644 --- a/Readme.md +++ b/Readme.md @@ -1,14 +1,14 @@ # OONI User Auth -To set this up you should run: -``` -make include +Run example: +```bash +cargo run -p ooniauth-core --example basic_usage ``` -Make sure you have setup ssh keys to clone the repositories listed in the -Makefile. +iOS build: +Open `ios/OoniAuthApp.xcodeproj` in Xcode. -You can then build it as usual with: -``` -cargo build +Criterion benchmark (same flow): +```bash +cargo bench -p ooniauth-core --bench bench_basic_usage ``` diff --git a/ios/OoniAuthApp.xcodeproj/project.pbxproj b/ios/OoniAuthApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c791b15 --- /dev/null +++ b/ios/OoniAuthApp.xcodeproj/project.pbxproj @@ -0,0 +1,614 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 2A59923A2CC77A7E00135402 /* OoniAuthFFI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5992362CC77A7E00135402 /* OoniAuthFFI.swift */; }; + 37AB9B142EB3AEE700EDF5DE /* OoniAuthFFI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A5992372CC77A7E00135402 /* OoniAuthFFI.xcframework */; settings = {ATTRIBUTES = (Required, ); }; }; + 37AB9B152EB3AEE700EDF5DE /* OoniAuthFFI.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2A5992372CC77A7E00135402 /* OoniAuthFFI.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2A5991FD2CC7722A00135402 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A5991E42CC7722900135402 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2A5991EB2CC7722900135402; + remoteInfo = OoniAuthApp; + }; + 2A5992072CC7722A00135402 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A5991E42CC7722900135402 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2A5991EB2CC7722900135402; + remoteInfo = OoniAuthApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 37AB9B162EB3AEE700EDF5DE /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 37AB9B152EB3AEE700EDF5DE /* OoniAuthFFI.xcframework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2A5991EC2CC7722900135402 /* OoniAuthApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OoniAuthApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A5991FC2CC7722A00135402 /* OoniAuthAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OoniAuthAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A5992062CC7722A00135402 /* OoniAuthAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OoniAuthAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A5992362CC77A7E00135402 /* OoniAuthFFI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OoniAuthFFI.swift; sourceTree = ""; }; + 2A5992372CC77A7E00135402 /* OoniAuthFFI.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = OoniAuthFFI.xcframework; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 2A5991EE2CC7722900135402 /* OoniAuthApp */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = OoniAuthApp; + sourceTree = ""; + }; + 2A5991FF2CC7722A00135402 /* OoniAuthAppTests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = OoniAuthAppTests; + sourceTree = ""; + }; + 2A5992092CC7722A00135402 /* OoniAuthAppUITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = OoniAuthAppUITests; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2A5991E92CC7722900135402 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 37AB9B142EB3AEE700EDF5DE /* OoniAuthFFI.xcframework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5991F92CC7722A00135402 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5992032CC7722A00135402 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2A5991E32CC7722900135402 = { + isa = PBXGroup; + children = ( + 2A5991EE2CC7722900135402 /* OoniAuthApp */, + 2A5991FF2CC7722A00135402 /* OoniAuthAppTests */, + 2A5992092CC7722A00135402 /* OoniAuthAppUITests */, + 2A5991ED2CC7722900135402 /* Products */, + 2A5992382CC77A7E00135402 /* OoniAuthBindings */, + ); + sourceTree = ""; + }; + 2A5991ED2CC7722900135402 /* Products */ = { + isa = PBXGroup; + children = ( + 2A5991EC2CC7722900135402 /* OoniAuthApp.app */, + 2A5991FC2CC7722A00135402 /* OoniAuthAppTests.xctest */, + 2A5992062CC7722A00135402 /* OoniAuthAppUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2A5992382CC77A7E00135402 /* OoniAuthBindings */ = { + isa = PBXGroup; + children = ( + 2A5992362CC77A7E00135402 /* OoniAuthFFI.swift */, + 2A5992372CC77A7E00135402 /* OoniAuthFFI.xcframework */, + ); + path = OoniAuthBindings; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2A5991EB2CC7722900135402 /* OoniAuthApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A5992102CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthApp" */; + buildPhases = ( + 2A5991E82CC7722900135402 /* Sources */, + 2A5991E92CC7722900135402 /* Frameworks */, + 2A5991EA2CC7722900135402 /* Resources */, + 37AB9B162EB3AEE700EDF5DE /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 2A5991EE2CC7722900135402 /* OoniAuthApp */, + ); + name = OoniAuthApp; + packageProductDependencies = ( + ); + productName = OoniAuthApp; + productReference = 2A5991EC2CC7722900135402 /* OoniAuthApp.app */; + productType = "com.apple.product-type.application"; + }; + 2A5991FB2CC7722A00135402 /* OoniAuthAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A5992132CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthAppTests" */; + buildPhases = ( + 2A5991F82CC7722A00135402 /* Sources */, + 2A5991F92CC7722A00135402 /* Frameworks */, + 2A5991FA2CC7722A00135402 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2A5991FE2CC7722A00135402 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 2A5991FF2CC7722A00135402 /* OoniAuthAppTests */, + ); + name = OoniAuthAppTests; + packageProductDependencies = ( + ); + productName = OoniAuthAppTests; + productReference = 2A5991FC2CC7722A00135402 /* OoniAuthAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 2A5992052CC7722A00135402 /* OoniAuthAppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A5992162CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthAppUITests" */; + buildPhases = ( + 2A5992022CC7722A00135402 /* Sources */, + 2A5992032CC7722A00135402 /* Frameworks */, + 2A5992042CC7722A00135402 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2A5992082CC7722A00135402 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 2A5992092CC7722A00135402 /* OoniAuthAppUITests */, + ); + name = OoniAuthAppUITests; + packageProductDependencies = ( + ); + productName = OoniAuthAppUITests; + productReference = 2A5992062CC7722A00135402 /* OoniAuthAppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2A5991E42CC7722900135402 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1600; + LastUpgradeCheck = 2600; + TargetAttributes = { + 2A5991EB2CC7722900135402 = { + CreatedOnToolsVersion = 16.0; + }; + 2A5991FB2CC7722A00135402 = { + CreatedOnToolsVersion = 16.0; + TestTargetID = 2A5991EB2CC7722900135402; + }; + 2A5992052CC7722A00135402 = { + CreatedOnToolsVersion = 16.0; + TestTargetID = 2A5991EB2CC7722900135402; + }; + }; + }; + buildConfigurationList = 2A5991E72CC7722900135402 /* Build configuration list for PBXProject "OoniAuthApp" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2A5991E32CC7722900135402; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 2A5991ED2CC7722900135402 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2A5991EB2CC7722900135402 /* OoniAuthApp */, + 2A5991FB2CC7722A00135402 /* OoniAuthAppTests */, + 2A5992052CC7722A00135402 /* OoniAuthAppUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2A5991EA2CC7722900135402 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5991FA2CC7722A00135402 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5992042CC7722A00135402 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2A5991E82CC7722900135402 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A59923A2CC77A7E00135402 /* OoniAuthFFI.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5991F82CC7722A00135402 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A5992022CC7722A00135402 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2A5991FE2CC7722A00135402 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2A5991EB2CC7722900135402 /* OoniAuthApp */; + targetProxy = 2A5991FD2CC7722A00135402 /* PBXContainerItemProxy */; + }; + 2A5992082CC7722A00135402 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2A5991EB2CC7722900135402 /* OoniAuthApp */; + targetProxy = 2A5992072CC7722A00135402 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 2A59920E2CC7722A00135402 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lc++"; + SDKROOT = iphoneos; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 2A59920F2CC7722A00135402 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + OTHER_LDFLAGS = "-lc++"; + SDKROOT = iphoneos; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2A5992112CC7722A00135402 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"OoniAuthApp/Preview Content\""; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2A5992122CC7722A00135402 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"OoniAuthApp/Preview Content\""; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 2A5992142CC7722A00135402 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OoniAuthApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/OoniAuthApp"; + }; + name = Debug; + }; + 2A5992152CC7722A00135402 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthAppTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OoniAuthApp.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/OoniAuthApp"; + }; + name = Release; + }; + 2A5992172CC7722A00135402 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = OoniAuthApp; + }; + name = Debug; + }; + 2A5992182CC7722A00135402 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 8DN4QDS23Z; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = org.ooni.OoniAuthAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = OoniAuthApp; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2A5991E72CC7722900135402 /* Build configuration list for PBXProject "OoniAuthApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A59920E2CC7722A00135402 /* Debug */, + 2A59920F2CC7722A00135402 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A5992102CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A5992112CC7722A00135402 /* Debug */, + 2A5992122CC7722A00135402 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A5992132CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A5992142CC7722A00135402 /* Debug */, + 2A5992152CC7722A00135402 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A5992162CC7722A00135402 /* Build configuration list for PBXNativeTarget "OoniAuthAppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A5992172CC7722A00135402 /* Debug */, + 2A5992182CC7722A00135402 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2A5991E42CC7722900135402 /* Project object */; +} diff --git a/ios/OoniAuthApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/OoniAuthApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/OoniAuthApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/OoniAuthApp.xcodeproj/project.xcworkspace/xcuserdata/maker.xcuserdatad/UserInterfaceState.xcuserstate b/ios/OoniAuthApp.xcodeproj/project.xcworkspace/xcuserdata/maker.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..9bf12b3 Binary files /dev/null and b/ios/OoniAuthApp.xcodeproj/project.xcworkspace/xcuserdata/maker.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/OoniAuthApp.xcodeproj/xcuserdata/maker.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/OoniAuthApp.xcodeproj/xcuserdata/maker.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..ece420e --- /dev/null +++ b/ios/OoniAuthApp.xcodeproj/xcuserdata/maker.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + OoniAuthApp.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/ios/OoniAuthApp/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/OoniAuthApp/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/ios/OoniAuthApp/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/OoniAuthApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/OoniAuthApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/ios/OoniAuthApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/OoniAuthApp/Assets.xcassets/Contents.json b/ios/OoniAuthApp/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ios/OoniAuthApp/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/OoniAuthApp/ContentView.swift b/ios/OoniAuthApp/ContentView.swift new file mode 100644 index 0000000..7e87a55 --- /dev/null +++ b/ios/OoniAuthApp/ContentView.swift @@ -0,0 +1,52 @@ +import SwiftUI + +struct ContentView: View { + @State private var log = "Tap Run Demo to execute the Rust flow via FFI." + @State private var isRunning = false + + var body: some View { + VStack(alignment: .leading, spacing: 12) { + Text("OONI Auth Demo") + .font(.title2) + .fontWeight(.semibold) + + Text("Runs the basic_usage flow from Rust and prints the result below.") + .font(.subheadline) + .foregroundStyle(.secondary) + + Button(action: runDemo) { + HStack { + if isRunning { + ProgressView() + } + Text(isRunning ? "Running..." : "Run Demo") + } + } + .disabled(isRunning) + + Divider() + + ScrollView { + Text(log) + .font(.system(.body, design: .monospaced)) + .frame(maxWidth: .infinity, alignment: .leading) + .textSelection(.enabled) + .padding(.vertical, 4) + } + } + .padding() + } + + private func runDemo() { + isRunning = true + log = "Running..." + + DispatchQueue.global(qos: .userInitiated).async { + let output = OoniAuthFFI.runBasicUsage() + DispatchQueue.main.async { + log = output + isRunning = false + } + } + } +} diff --git a/ios/OoniAuthApp/OoniAuthAppApp.swift b/ios/OoniAuthApp/OoniAuthAppApp.swift new file mode 100644 index 0000000..44a9dce --- /dev/null +++ b/ios/OoniAuthApp/OoniAuthAppApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct OoniAuthAppApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/ios/OoniAuthApp/Preview Content/Preview Assets.xcassets/Contents.json b/ios/OoniAuthApp/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ios/OoniAuthApp/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/OoniAuthAppTests/OoniAuthAppTests.swift b/ios/OoniAuthAppTests/OoniAuthAppTests.swift new file mode 100644 index 0000000..5e13f8a --- /dev/null +++ b/ios/OoniAuthAppTests/OoniAuthAppTests.swift @@ -0,0 +1,8 @@ +import Testing +@testable import OoniAuthApp + +struct OoniAuthAppTests { + @Test func example() async throws { + // Placeholder test for the app target. + } +} diff --git a/ios/OoniAuthAppUITests/OoniAuthAppUITests.swift b/ios/OoniAuthAppUITests/OoniAuthAppUITests.swift new file mode 100644 index 0000000..ad248f3 --- /dev/null +++ b/ios/OoniAuthAppUITests/OoniAuthAppUITests.swift @@ -0,0 +1,13 @@ +import XCTest + +final class OoniAuthAppUITests: XCTestCase { + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testExample() throws { + let app = XCUIApplication() + app.launch() + } +} diff --git a/ios/OoniAuthAppUITests/OoniAuthAppUITestsLaunchTests.swift b/ios/OoniAuthAppUITests/OoniAuthAppUITestsLaunchTests.swift new file mode 100644 index 0000000..69fdc7a --- /dev/null +++ b/ios/OoniAuthAppUITests/OoniAuthAppUITestsLaunchTests.swift @@ -0,0 +1,12 @@ +import XCTest + +final class OoniAuthAppUITestsLaunchTests: XCTestCase { + @MainActor + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/ios/OoniAuthBindings/.gitignore b/ios/OoniAuthBindings/.gitignore new file mode 100644 index 0000000..b7b7aa2 --- /dev/null +++ b/ios/OoniAuthBindings/.gitignore @@ -0,0 +1 @@ +OoniAuthFFI.xcframework/ diff --git a/ios/OoniAuthBindings/OoniAuthFFI.swift b/ios/OoniAuthBindings/OoniAuthFFI.swift new file mode 100644 index 0000000..cff8689 --- /dev/null +++ b/ios/OoniAuthBindings/OoniAuthFFI.swift @@ -0,0 +1,17 @@ +import Foundation + +@_silgen_name("ooniauth_run_basic_usage") +private func ooniauth_run_basic_usage() -> UnsafeMutablePointer? + +@_silgen_name("ooniauth_string_free") +private func ooniauth_string_free(_ ptr: UnsafeMutablePointer?) + +enum OoniAuthFFI { + static func runBasicUsage() -> String { + guard let raw = ooniauth_run_basic_usage() else { + return "error: FFI returned null pointer" + } + defer { ooniauth_string_free(raw) } + return String(cString: raw) + } +} diff --git a/ios/OoniAuthBindings/README.md b/ios/OoniAuthBindings/README.md new file mode 100644 index 0000000..a47a6b6 --- /dev/null +++ b/ios/OoniAuthBindings/README.md @@ -0,0 +1,7 @@ +This folder is the home for the generated iOS xcframework produced from the Rust FFI crate. + +Generate it with: + + ./ios/build-ffi.sh + +The script will place `OoniAuthFFI.xcframework` in this directory. diff --git a/ios/README.md b/ios/README.md new file mode 100644 index 0000000..15ab00f --- /dev/null +++ b/ios/README.md @@ -0,0 +1,20 @@ +# iOS app + +This folder contains a SwiftUI app that calls the Rust demo flow through a C ABI FFI. + +## Build the FFI framework + +1. Install the iOS Rust targets (once): + + rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios + +2. Build the xcframework: + + ./ios/build-ffi.sh + +This writes `ios/OoniAuthBindings/OoniAuthFFI.xcframework`. + +## Run the app + +Open `ios/OoniAuthApp.xcodeproj` in Xcode and run the `OoniAuthApp` target. +The app has a single "Run Demo" button that executes the Rust `basic_usage` flow via FFI. diff --git a/ios/build-ffi.sh b/ios/build-ffi.sh new file mode 100755 index 0000000..dda145e --- /dev/null +++ b/ios/build-ffi.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +OUT_DIR="$ROOT/ios/OoniAuthBindings" +HEADER_DIR="$ROOT/ooniauth-ffi/include" + +build_target() { + local target="$1" + cargo build -p ooniauth-ffi --release --target "$target" +} + +build_target aarch64-apple-ios +build_target aarch64-apple-ios-sim +build_target x86_64-apple-ios + +LIB_DEVICE="$ROOT/target/aarch64-apple-ios/release/libooniauth_ffi.a" +LIB_SIM="$ROOT/target/aarch64-apple-ios-sim/release/libooniauth_ffi.a" +LIB_SIM_X86="$ROOT/target/x86_64-apple-ios/release/libooniauth_ffi.a" +LIB_SIM_UNIVERSAL="$ROOT/target/ios-sim-universal/libooniauth_ffi.a" + +mkdir -p "$(dirname "$LIB_SIM_UNIVERSAL")" +if command -v lipo >/dev/null 2>&1; then + lipo -create "$LIB_SIM" "$LIB_SIM_X86" -output "$LIB_SIM_UNIVERSAL" +else + echo "error: lipo not found; cannot create universal simulator library" >&2 + exit 1 +fi + +rm -rf "$OUT_DIR/OoniAuthFFI.xcframework" + +xcodebuild -create-xcframework \ + -library "$LIB_DEVICE" -headers "$HEADER_DIR" \ + -library "$LIB_SIM_UNIVERSAL" -headers "$HEADER_DIR" \ + -output "$OUT_DIR/OoniAuthFFI.xcframework" + +echo "Generated $OUT_DIR/OoniAuthFFI.xcframework" diff --git a/ooniauth-core/Cargo.toml b/ooniauth-core/Cargo.toml index 84cbb41..98dda43 100644 --- a/ooniauth-core/Cargo.toml +++ b/ooniauth-core/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -cmz = {workspace = true} +cmz = { workspace = true } curve25519-dalek = { version = "4", features = ["digest", "group", "rand_core", "serde"] } ff = "0.13.1" group = "0.13.0" @@ -20,9 +20,12 @@ subtle = "2.6.1" thiserror = {workspace = true} syn = "2.0.103" hex = "0.4" +tracing = "0.1" [dev-dependencies] criterion = { version = "0.5"} +tracing-subscriber = { version = "0.3", features = ["env-filter", "registry"] } +tracing-forest = "0.1" [[example]] name = "basic_usage" @@ -31,3 +34,7 @@ test = true [[bench]] name = "bench_server" harness = false + +[[bench]] +name = "bench_basic_usage" +harness = false diff --git a/ooniauth-core/benches/bench_basic_usage.rs b/ooniauth-core/benches/bench_basic_usage.rs new file mode 100644 index 0000000..d45e0a7 --- /dev/null +++ b/ooniauth-core/benches/bench_basic_usage.rs @@ -0,0 +1,79 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use ooniauth_core::{ServerState, UserState}; +use rand::thread_rng; +use std::hint::black_box; + +fn run_basic_usage_flow() { + let mut rng = thread_rng(); + let server = ServerState::new(&mut rng); + let public_params = server.public_parameters(); + let mut user = UserState::new(public_params); + + let (reg_request, reg_state) = user.request(&mut rng).unwrap(); + let reg_response = server.open_registration(reg_request).unwrap(); + user.handle_response(reg_state, reg_response).unwrap(); + + let today = ServerState::today(); + let age_range = (today - 30)..(today + 1); + let measurement_count_range = 0..100; + + let ((submit_request, submit_state), nym) = user + .submit_request( + &mut rng, + "US".to_string(), + "AS1234".to_string(), + age_range.clone(), + measurement_count_range.clone(), + ) + .unwrap(); + + let submit_response = server + .handle_submit( + &mut rng, + submit_request, + &nym, + "US", + "AS1234", + age_range, + measurement_count_range, + ) + .unwrap(); + user.handle_submit_response(submit_state, submit_response) + .unwrap(); + + let age_range2 = (today - 30)..(today + 1); + let measurement_count_range2 = 0..100; + + let ((submit_request2, submit_state2), nym2) = user + .submit_request( + &mut rng, + "UK".to_string(), + "AS5678".to_string(), + age_range2.clone(), + measurement_count_range2.clone(), + ) + .unwrap(); + + let submit_response2 = server + .handle_submit( + &mut rng, + submit_request2, + &nym2, + "UK", + "AS5678", + age_range2, + measurement_count_range2, + ) + .unwrap(); + user.handle_submit_response(submit_state2, submit_response2) + .unwrap(); + + black_box(user.get_credential().is_some()); +} + +fn bench_basic_usage(c: &mut Criterion) { + c.bench_function("basic_usage_flow", |b| b.iter(run_basic_usage_flow)); +} + +criterion_group!(benches, bench_basic_usage); +criterion_main!(benches); diff --git a/ooniauth-core/examples/basic_usage.rs b/ooniauth-core/examples/basic_usage.rs index 459c684..9701edd 100644 --- a/ooniauth-core/examples/basic_usage.rs +++ b/ooniauth-core/examples/basic_usage.rs @@ -1,9 +1,22 @@ use std::time::Instant; -use hex; use ooniauth_core::{scalar_u32, ServerState, UserState}; +use tracing_forest::util::LevelFilter; +use tracing_forest::ForestLayer; +use tracing_subscriber::layer::SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; +use tracing_subscriber::{EnvFilter, Registry}; fn main() -> Result<(), Box> { + // Initialize tracing with forest layer for runtime display + let env_filter = EnvFilter::builder() + .with_default_directive(LevelFilter::INFO.into()) + .from_env_lossy(); + + Registry::default() + .with(env_filter) + .with(ForestLayer::default()) + .init(); let mut rng = rand::thread_rng(); println!("=== Anonymous Credential Example ===\n"); @@ -103,7 +116,7 @@ fn main() -> Result<(), Box> { println!(" Domain-specific pseudonym computed"); // Show the NYM as hex - println!(" NYM (hex): {}", hex::encode(&nym)); + println!(" NYM (hex): {}", hex::encode(nym)); // Convert to bytes let submit_request_bytes = submit_request.as_bytes(); @@ -181,7 +194,7 @@ fn main() -> Result<(), Box> { println!(" Different domain produces different pseudonym"); // Show the second NYM as hex - println!(" NYM (hex): {}", hex::encode(&nym2)); + println!(" NYM (hex): {}", hex::encode(nym2)); let now = Instant::now(); let submit_response2 = server.handle_submit( diff --git a/ooniauth-core/src/lib.rs b/ooniauth-core/src/lib.rs index fd7d545..6b2bf9b 100644 --- a/ooniauth-core/src/lib.rs +++ b/ooniauth-core/src/lib.rs @@ -15,8 +15,8 @@ pub mod errors; pub mod registration; pub mod submit; pub mod update; -pub mod user_submit; pub mod user_registration; +pub mod user_submit; #[derive(Debug, Serialize, Deserialize)] pub struct ServerState { diff --git a/ooniauth-core/src/registration.rs b/ooniauth-core/src/registration.rs index ee3cab8..b240bea 100644 --- a/ooniauth-core/src/registration.rs +++ b/ooniauth-core/src/registration.rs @@ -12,6 +12,7 @@ use cmz::*; use group::Group; use rand::{CryptoRng, RngCore}; use sha2::Sha512; +use tracing::{instrument, trace}; const SESSION_ID: &[u8] = b"registration"; @@ -40,10 +41,12 @@ muCMZProtocol! {open_registration, } impl UserState { + #[instrument(skip(self, rng))] pub fn request( &self, rng: &mut (impl RngCore + CryptoRng), ) -> Result<(open_registration::Request, open_registration::ClientState), CMZError> { + trace!("Starting registration request"); cmz_group_init(G::hash_from_bytes::(b"CMZ Generator A")); let mut UAC = UserAuthCredential::using_pubkey(&self.pp); @@ -58,11 +61,13 @@ impl UserState { } impl UserState { + #[instrument(skip(self, state, rep))] pub fn handle_response( &mut self, state: open_registration::ClientState, rep: open_registration::Reply, ) -> Result<(), CMZError> { + trace!("Handling registration response"); let replybytes = rep.as_bytes(); let recvreply = open_registration::Reply::try_from(&replybytes[..]).unwrap(); match state.finalize(recvreply) { @@ -76,10 +81,12 @@ impl UserState { } impl ServerState { + #[instrument(skip(self, req))] pub fn open_registration( &self, req: open_registration::Request, ) -> Result { + trace!("Server opening registration"); let mut rng = rand::thread_rng(); let reqbytes = req.as_bytes(); diff --git a/ooniauth-core/src/submit.rs b/ooniauth-core/src/submit.rs index 3390383..1af7280 100644 --- a/ooniauth-core/src/submit.rs +++ b/ooniauth-core/src/submit.rs @@ -1,5 +1,3 @@ -use std::u32; - use super::{scalar_u32, ServerState, UserState, G}; use crate::errors::CredentialError; use crate::registration::UserAuthCredential; @@ -8,6 +6,7 @@ use curve25519_dalek::RistrettoPoint; use group::{Group, GroupEncoding}; use rand::{CryptoRng, RngCore}; use sha2::Sha512; +use tracing::{debug, instrument, trace}; const SESSION_ID: &[u8] = b"submit"; @@ -24,6 +23,7 @@ muCMZProtocol!(submit, measurement_count_range: std::ops::Range, ) -> Result<((submit::Request, submit::ClientState), [u8; 32]), CredentialError> { + trace!("Starting submit request"); + debug!( + "Age range: {:?}, Measurement count range: {:?}", + age_range, measurement_count_range + ); cmz_group_init(G::hash_from_bytes::(b"CMZ Generator A")); // Get the current credential @@ -45,8 +50,10 @@ impl UserState { // Domain-specific generator and NYM computation let domain_str = format!("ooni.org/{}/{}", probe_cc, probe_asn); + trace!("Computing DOMAIN for: {}", domain_str); let DOMAIN = G::hash_from_bytes::(domain_str.as_bytes()); let NYM = Old.nym_id.unwrap() * DOMAIN; + debug!("NYM computed successfully"); // Ensure the credential timestamp is within the allowed range let age: u32 = match scalar_u32(&Old.age.unwrap()) { @@ -115,9 +122,16 @@ impl UserState { NYM, }; - match submit::prepare(rng, SESSION_ID, &Old, New, ¶ms) { - Ok(req_state) => Ok((req_state, NYM.compress().to_bytes())), - Err(_) => Err(CredentialError::CMZError(CMZError::CliProofFailed)), + trace!("Preparing submit proof with params"); + match submit::prepare(rng, SESSION_ID, Old, New, ¶ms) { + Ok(req_state) => { + debug!("Submit request prepared successfully"); + Ok((req_state, NYM.compress().to_bytes())) + } + Err(_) => { + debug!("Failed to prepare submit request"); + Err(CredentialError::CMZError(CMZError::CliProofFailed)) + } } } @@ -139,6 +153,8 @@ impl UserState { } impl ServerState { + #[instrument(skip(self, rng, req))] + #[allow(clippy::too_many_arguments)] pub fn handle_submit( &self, rng: &mut (impl RngCore + CryptoRng), @@ -149,6 +165,11 @@ impl ServerState { age_range: std::ops::Range, measurement_count_range: std::ops::Range, ) -> Result { + trace!("Server handling submit request"); + debug!( + "Age range: {:?}, Measurement count range: {:?}", + age_range, measurement_count_range + ); let reqbytes = req.as_bytes(); let recvreq = submit::Request::try_from(&reqbytes[..]).unwrap(); @@ -190,8 +211,14 @@ impl ServerState { Ok(()) }, ) { - Ok((response, (_old_cred, _new_cred))) => Ok(response), - Err(e) => Err(e), + Ok((response, (_old_cred, _new_cred))) => { + debug!("Submit request verified successfully"); + Ok(response) + } + Err(e) => { + debug!("Submit request verification failed: {:?}", e); + Err(e) + } } } } @@ -279,7 +306,10 @@ mod tests { let ((request, client_state), nym) = result.unwrap(); // Verify the request is valid - assert!(request.as_bytes().len() > 0, "Request should have content"); + assert!( + !request.as_bytes().is_empty(), + "Request should have content" + ); // Verify NYM is computed (check it's not all zeros) assert_ne!(&nym, &[0u8; 32], "NYM should not be all zeros"); diff --git a/ooniauth-core/src/user_registration.rs b/ooniauth-core/src/user_registration.rs index 8301464..42be7b1 100644 --- a/ooniauth-core/src/user_registration.rs +++ b/ooniauth-core/src/user_registration.rs @@ -1,16 +1,19 @@ use super::{Scalar, G}; use crate::registration::{open_registration, UserAuthCredential}; -use curve25519_dalek::RistrettoPoint; use cmz::*; +use curve25519_dalek::RistrettoPoint; use rand::{CryptoRng, RngCore}; use sha2::Sha512; +use tracing::{instrument, trace}; const SESSION_ID: &[u8] = b"registration"; +#[instrument(skip(pp, rng))] pub fn request( pp: &CMZPubkey, rng: &mut (impl RngCore + CryptoRng), ) -> Result<(open_registration::Request, open_registration::ClientState), CMZError> { + trace!("Starting registration request (standalone)"); cmz_group_init(G::hash_from_bytes::(b"CMZ Generator A")); let mut UAC = UserAuthCredential::using_pubkey(pp); @@ -22,17 +25,20 @@ pub fn request( pub fn handle_request_response( state: open_registration::ClientState, - rep: open_registration::Reply + rep: open_registration::Reply, ) -> Result { + trace!("Handling registration response (standalone)"); let replybytes = rep.as_bytes(); let recvreply = open_registration::Reply::try_from(&replybytes[..]).unwrap(); - state.finalize(recvreply).map_err(|_| CMZError::IssProofFailed) + state + .finalize(recvreply) + .map_err(|_| CMZError::IssProofFailed) } #[cfg(test)] mod tests { use super::*; - use crate::{ServerState}; + use crate::ServerState; #[test] fn test_registration() { diff --git a/ooniauth-core/src/user_submit.rs b/ooniauth-core/src/user_submit.rs index c425869..dbc6b82 100644 --- a/ooniauth-core/src/user_submit.rs +++ b/ooniauth-core/src/user_submit.rs @@ -1,11 +1,9 @@ -use std::u32; - use super::{scalar_u32, G}; -use crate::{errors::CredentialError}; +use crate::errors::CredentialError; use crate::registration::UserAuthCredential; +use crate::submit::submit; use cmz::*; use curve25519_dalek::RistrettoPoint; -use crate::submit::submit; use rand::{CryptoRng, RngCore}; use sha2::Sha512; @@ -106,14 +104,16 @@ pub fn handle_submit_response( ) -> Result { let replybytes = rep.as_bytes(); let recvreply = submit::Reply::try_from(&replybytes[..]).unwrap(); - state.finalize(recvreply).map_err(|_| CMZError::IssProofFailed) + state + .finalize(recvreply) + .map_err(|_| CMZError::IssProofFailed) } #[cfg(test)] mod tests { use super::*; + use crate::user_registration::{handle_request_response, request}; use crate::{Scalar, ServerState, G}; - use crate::user_registration::{request, handle_request_response}; use sha2::Sha512; #[test] @@ -192,7 +192,10 @@ mod tests { let ((request, client_state), nym) = result.unwrap(); // Verify the request is valid - assert!(request.as_bytes().len() > 0, "Request should have content"); + assert!( + !request.as_bytes().is_empty(), + "Request should have content" + ); // Verify NYM is computed (check it's not all zeros) assert_ne!(&nym, &[0u8; 32], "NYM should not be all zeros"); diff --git a/ooniauth-ffi/Cargo.toml b/ooniauth-ffi/Cargo.toml new file mode 100644 index 0000000..ab1d257 --- /dev/null +++ b/ooniauth-ffi/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "ooniauth-ffi" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib", "staticlib"] + +[dependencies] +hex = "0.4" +ooniauth-core = { path = "../ooniauth-core" } +rand = "0.8.5" +tracing-forest = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "registry"] } diff --git a/ooniauth-ffi/include/ooniauth_ffi.h b/ooniauth-ffi/include/ooniauth_ffi.h new file mode 100644 index 0000000..e381dcc --- /dev/null +++ b/ooniauth-ffi/include/ooniauth_ffi.h @@ -0,0 +1,15 @@ +#ifndef OONIAUTH_FFI_H +#define OONIAUTH_FFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +char *ooniauth_run_basic_usage(void); +void ooniauth_string_free(char *ptr); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // OONIAUTH_FFI_H diff --git a/ooniauth-ffi/src/lib.rs b/ooniauth-ffi/src/lib.rs new file mode 100644 index 0000000..ced4525 --- /dev/null +++ b/ooniauth-ffi/src/lib.rs @@ -0,0 +1,321 @@ +use std::ffi::{c_char, CString}; +use std::sync::Once; +use std::time::Instant; + +use ooniauth_core::registration::UserAuthCredential; +use ooniauth_core::{scalar_u32, ServerState, UserState}; +use tracing_forest::util::LevelFilter; +use tracing_forest::ForestLayer; +use tracing_subscriber::layer::SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; +use tracing_subscriber::{EnvFilter, Registry}; + +static TRACING_INIT: Once = Once::new(); + +fn init_tracing() { + TRACING_INIT.call_once(|| { + let env_filter = EnvFilter::builder() + .with_default_directive(LevelFilter::INFO.into()) + .from_env_lossy(); + + Registry::default() + .with(env_filter) + .with(ForestLayer::default()) + .init(); + }); +} + +fn push_line(log: &mut String, line: &str) { + log.push_str(line); + log.push('\n'); +} + +fn log_credential(log: &mut String, label: &str, cred: &UserAuthCredential) -> Result<(), String> { + push_line(log, ""); + push_line(log, &format!(" === {label} ===")); + + let nym_id = cred + .nym_id + .ok_or_else(|| "missing nym_id in credential".to_string())?; + let age = cred + .age + .ok_or_else(|| "missing age in credential".to_string())?; + let measurement_count = cred + .measurement_count + .ok_or_else(|| "missing measurement_count in credential".to_string())?; + + push_line( + log, + &format!(" - nym_id: {}", hex::encode(nym_id.to_bytes())), + ); + + let age_value = scalar_u32(&age).ok_or_else(|| "age is not a u32".to_string())?; + push_line(log, &format!(" - age: {}", age_value)); + + let measurement_value = scalar_u32(&measurement_count) + .ok_or_else(|| "measurement_count is not a u32".to_string())?; + push_line( + log, + &format!(" - measurement_count: {}", measurement_value), + ); + + Ok(()) +} + +fn run_basic_usage_demo() -> Result { + init_tracing(); + let mut log = String::new(); + push_line(&mut log, "=== Anonymous Credential Example ==="); + push_line(&mut log, ""); + + // Match the flow in ooniauth-core/examples/basic_usage.rs so the iOS app + // surfaces identical outputs and timings. + let mut rng = rand::thread_rng(); + push_line(&mut log, "1. Initializing server..."); + let now = Instant::now(); + let server = ServerState::new(&mut rng); + let public_params = server.public_parameters(); + push_line( + &mut log, + &format!( + " Key generation completed in {} ms", + now.elapsed().as_millis() + ), + ); + + push_line(&mut log, ""); + push_line(&mut log, "2. Initializing user..."); + let now = Instant::now(); + let mut user = UserState::new(public_params); + push_line( + &mut log, + &format!(" User initialized in {} ms", now.elapsed().as_millis()), + ); + + push_line(&mut log, ""); + push_line(&mut log, "3. User registration..."); + let now = Instant::now(); + let (reg_request, reg_state) = user + .request(&mut rng) + .map_err(|e| format!("registration request failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Registration request created in {} ms", + now.elapsed().as_millis() + ), + ); + + let request_bytes = reg_request.as_bytes(); + push_line( + &mut log, + &format!(" Request size: {} bytes", request_bytes.len()), + ); + push_line( + &mut log, + &format!(" Request payload (hex): {}", hex::encode(&request_bytes)), + ); + + let now = Instant::now(); + let reg_response = server + .open_registration(reg_request) + .map_err(|e| format!("registration response failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Server processed registration in {} ms", + now.elapsed().as_millis() + ), + ); + + let response_bytes = reg_response.as_bytes(); + push_line( + &mut log, + &format!(" Response size: {} bytes", response_bytes.len()), + ); + + let now = Instant::now(); + user.handle_response(reg_state, reg_response) + .map_err(|e| format!("registration finalize failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " User handled response in {} ms", + now.elapsed().as_millis() + ), + ); + + log_credential( + &mut log, + "Initial Credential Attributes", + user.get_credential() + .ok_or_else(|| "credential missing after registration".to_string())?, + )?; + + push_line(&mut log, ""); + push_line(&mut log, "4. Creating anonymous report submission..."); + let probe_cc = "US".to_string(); + let probe_asn = "AS1234".to_string(); + let today = ServerState::today(); + let age_range = (today - 30)..(today + 1); + let measurement_count_range = 0..100; + + let now = Instant::now(); + let ((submit_request, submit_state), nym) = user + .submit_request( + &mut rng, + probe_cc.clone(), + probe_asn.clone(), + age_range.clone(), + measurement_count_range.clone(), + ) + .map_err(|e| format!("submit request failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Submit request created for {probe_cc}/{probe_asn} in {} ms", + now.elapsed().as_millis() + ), + ); + push_line(&mut log, " Domain-specific pseudonym computed"); + push_line(&mut log, &format!(" NYM (hex): {}", hex::encode(nym))); + let submit_request_bytes = submit_request.as_bytes(); + push_line( + &mut log, + &format!(" Request size: {} bytes", submit_request_bytes.len()), + ); + + let now = Instant::now(); + let submit_response = server + .handle_submit( + &mut rng, + submit_request, + &nym, + &probe_cc, + &probe_asn, + age_range, + measurement_count_range, + ) + .map_err(|e| format!("submit handling failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Server validated submission and issued updated credential in {} ms", + now.elapsed().as_millis() + ), + ); + let submit_response_bytes = submit_response.as_bytes(); + push_line( + &mut log, + &format!(" Response size: {} bytes", submit_response_bytes.len()), + ); + let now = Instant::now(); + user.handle_submit_response(submit_state, submit_response) + .map_err(|e| format!("submit finalize failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " User handled submit response in {} ms", + now.elapsed().as_millis() + ), + ); + + log_credential( + &mut log, + "Updated Credential Attributes", + user.get_credential() + .ok_or_else(|| "credential missing after submit".to_string())?, + )?; + + push_line(&mut log, ""); + push_line(&mut log, "5. Creating second submission..."); + let probe_cc2 = "UK".to_string(); + let probe_asn2 = "AS5678".to_string(); + + let age_range2 = (today - 30)..(today + 1); + let measurement_count_range2 = 0..100; + + let now = Instant::now(); + let ((submit_request2, submit_state2), nym2) = user + .submit_request( + &mut rng, + probe_cc2.clone(), + probe_asn2.clone(), + age_range2.clone(), + measurement_count_range2.clone(), + ) + .map_err(|e| format!("submit request 2 failed: {e:?}"))?; + + push_line( + &mut log, + &format!( + " Submit request created for {probe_cc2}/{probe_asn2} in {} ms", + now.elapsed().as_millis() + ), + ); + push_line(&mut log, " Different domain produces different pseudonym"); + push_line(&mut log, &format!(" NYM (hex): {}", hex::encode(nym2))); + + let now = Instant::now(); + let submit_response2 = server + .handle_submit( + &mut rng, + submit_request2, + &nym2, + &probe_cc2, + &probe_asn2, + age_range2, + measurement_count_range2, + ) + .map_err(|e| format!("submit handling 2 failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Second submit request handled by server in {} ms", + now.elapsed().as_millis() + ), + ); + + let now = Instant::now(); + user.handle_submit_response(submit_state2, submit_response2) + .map_err(|e| format!("submit finalize 2 failed: {e:?}"))?; + push_line( + &mut log, + &format!( + " Second submit response handled by user in {} ms", + now.elapsed().as_millis() + ), + ); + + log_credential( + &mut log, + "Final Credential Attributes", + user.get_credential() + .ok_or_else(|| "credential missing after second submit".to_string())?, + )?; + + Ok(log) +} + +#[no_mangle] +pub extern "C" fn ooniauth_run_basic_usage() -> *mut c_char { + let output = match run_basic_usage_demo() { + Ok(log) => log, + Err(err) => format!("error: {err}"), + }; + + CString::new(output) + .unwrap_or_else(|_| CString::new("error: output contained nul byte").unwrap()) + .into_raw() +} + +/// # Safety +/// Caller must pass the pointer returned by `ooniauth_run_basic_usage`. +/// The pointer must be valid, non-null, and freed exactly once. +#[no_mangle] +pub unsafe extern "C" fn ooniauth_string_free(ptr: *mut c_char) { + if ptr.is_null() { + return; + } + drop(CString::from_raw(ptr)); +} diff --git a/ooniauth-py/Cargo.toml b/ooniauth-py/Cargo.toml index ccded4e..a80772a 100644 --- a/ooniauth-py/Cargo.toml +++ b/ooniauth-py/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ooniauth_py" version = "0.1.0" -edition = "2024" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] diff --git a/ooniauth-py/build.rs b/ooniauth-py/build.rs new file mode 100644 index 0000000..ac2d936 --- /dev/null +++ b/ooniauth-py/build.rs @@ -0,0 +1,43 @@ +use std::process::Command; + +fn main() { + println!("cargo:rerun-if-env-changed=PYO3_PYTHON"); + println!("cargo:rerun-if-env-changed=PYTHON_SYS_EXECUTABLE"); + + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); + if target_os != "macos" && target_os != "linux" { + return; + } + + let flags = python3_config_ldflags(); + if let Some(flags) = flags { + emit_link_flags(&flags); + } +} + +fn python3_config_ldflags() -> Option { + run_python3_config(&["--embed", "--ldflags"]).or_else(|| run_python3_config(&["--ldflags"])) +} + +fn run_python3_config(args: &[&str]) -> Option { + let output = Command::new("python3-config").args(args).output().ok()?; + if !output.status.success() { + return None; + } + String::from_utf8(output.stdout).ok() +} + +fn emit_link_flags(flags: &str) { + let mut iter = flags.split_whitespace().peekable(); + while let Some(flag) = iter.next() { + if let Some(path) = flag.strip_prefix("-L") { + println!("cargo:rustc-link-search=native={path}"); + } else if let Some(lib) = flag.strip_prefix("-l") { + println!("cargo:rustc-link-lib={lib}"); + } else if flag == "-framework" { + if let Some(name) = iter.next() { + println!("cargo:rustc-link-lib=framework={name}"); + } + } + } +} diff --git a/ooniauth-py/src/exceptions.rs b/ooniauth-py/src/exceptions.rs index bd1de76..4aaea9d 100644 --- a/ooniauth-py/src/exceptions.rs +++ b/ooniauth-py/src/exceptions.rs @@ -1,7 +1,7 @@ use cmz::CMZError; use ooniauth_core::errors; -use pyo3::PyErr; use pyo3::exceptions::PyException; +use pyo3::PyErr; use pyo3_stub_gen::create_exception; use thiserror::Error; diff --git a/ooniauth-py/src/protocol.rs b/ooniauth-py/src/protocol.rs index c1f46b3..75f01ad 100644 --- a/ooniauth-py/src/protocol.rs +++ b/ooniauth-py/src/protocol.rs @@ -11,7 +11,7 @@ use pyo3::{ use pyo3_stub_gen::derive::{gen_stub_pyclass, gen_stub_pymethods}; use crate::utils::{from_pystring, to_pystring}; -use crate::{OoniErr, exceptions::OoniResult}; +use crate::{exceptions::OoniResult, OoniErr}; #[gen_stub_pyclass] #[pyclass] @@ -72,6 +72,7 @@ impl ServerState { ooni::ServerState::today() } + #[allow(clippy::too_many_arguments)] fn handle_submit_request( &self, py: Python<'_>, @@ -174,7 +175,11 @@ impl UserState { self.state.get_credential().map(|c| to_pystring(py, c)) } - pub fn set_public_params(&mut self, py: Python<'_>, new_public_params : Py) -> OoniResult<()>{ + pub fn set_public_params( + &mut self, + py: Python<'_>, + new_public_params: Py, + ) -> OoniResult<()> { let params = from_pystring(py, &new_public_params)?; self.state.pp = params; Ok(()) @@ -301,11 +306,11 @@ pub struct SubmitRequest { #[cfg(test)] mod tests { - use base64::{Engine, prelude::BASE64_STANDARD}; - use ooniauth_core::{ServerState, UserState, registration::open_registration::Request}; + use base64::{prelude::BASE64_STANDARD, Engine}; + use ooniauth_core::{registration::open_registration::Request, ServerState, UserState}; use pyo3::{ - Py, Python, types::{PyList, PyString}, + Py, Python, }; use rand::{rngs::ThreadRng, thread_rng}; @@ -337,11 +342,9 @@ mod tests { let mut client = crate::UserState::new(py, server.get_public_parameters(py)).unwrap(); let req = client.make_registration_request(py).unwrap(); let reg_response = server.handle_registration_request(py, req).unwrap(); - assert!( - client - .handle_registration_response(py, reg_response) - .is_ok() - ); + assert!(client + .handle_registration_response(py, reg_response) + .is_ok()); // Test submit let cc = PyString::new(py, "VE"); @@ -353,19 +356,17 @@ mod tests { let age_range = PyList::new(py, vec![today - 30, today + 1]).unwrap(); let msm_range = PyList::new(py, vec![0, 100]).unwrap(); - assert!( - server - .handle_submit_request( - py, - submit_req.nym, - submit_req.request, - cc.into(), - asn.into(), - age_range.into(), - msm_range.into() - ) - .is_ok() - ); + assert!(server + .handle_submit_request( + py, + submit_req.nym, + submit_req.request, + cc.into(), + asn.into(), + age_range.into(), + msm_range.into() + ) + .is_ok()); }); } @@ -395,7 +396,9 @@ mod tests { .expect("Unable to handle registration response"); // Update credential - client.set_public_params(py, new_state.get_public_parameters(py)).expect("Unable to change public params"); + client + .set_public_params(py, new_state.get_public_parameters(py)) + .expect("Unable to change public params"); let update_req = client .make_credential_update_request(py) .expect("Unable to make credential update request"); @@ -467,7 +470,9 @@ mod tests { // Create new server state and update credentials let new_state = crate::ServerState::new(); - client.set_public_params(py, new_state.get_public_parameters(py)).expect("Unable to change public params"); + client + .set_public_params(py, new_state.get_public_parameters(py)) + .expect("Unable to change public params"); let update_req = client .make_credential_update_request(py) diff --git a/ooniauth-py/src/utils.rs b/ooniauth-py/src/utils.rs index 319af15..5628050 100644 --- a/ooniauth-py/src/utils.rs +++ b/ooniauth-py/src/utils.rs @@ -1,6 +1,6 @@ use std::fmt::Display; -use crate::{OoniResult, exceptions::OoniErr}; +use crate::{exceptions::OoniErr, OoniResult}; use base64::prelude::*; use pyo3::{prelude::*, types::PyString};