commit 3ebe7c03eac8f94e7bb4c5e6c6b810c9d5153e50
parent 9a2944b0a4aee8a8e2cba3beaf868ee4a9da7525
Author: nickfarrow <nick@nickfarrow.com>
Date: Wed, 28 Sep 2022 17:07:29 +1000
restructure project
Diffstat:
M | Cargo.lock | | | 1076 | ++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- |
M | Cargo.toml | | | 7 | ++++--- |
M | README.md | | | 7 | +++++++ |
A | src/frost.rs | | | 84 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | src/lib.rs | | | 3 | +++ |
M | src/main.rs | | | 416 | +++---------------------------------------------------------------------------- |
A | src/roast_coordinator.rs | | | 214 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | src/roast_signer.rs | | | 110 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | src/rocket.rs | | | 37 | +++++++++++++++++++++++++++++++++++++ |
9 files changed, 1132 insertions(+), 822 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -3,51 +3,57 @@
version = 3
[[package]]
-name = "android_system_properties"
-version = "0.1.5"
+name = "aead"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
+checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331"
dependencies = [
- "libc",
+ "generic-array",
]
[[package]]
-name = "ansi_term"
-version = "0.12.1"
+name = "aes"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
+checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
dependencies = [
- "winapi",
+ "aes-soft",
+ "aesni",
+ "cipher",
]
[[package]]
-name = "async-stream"
-version = "0.3.3"
+name = "aes-gcm"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e"
+checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da"
dependencies = [
- "async-stream-impl",
- "futures-core",
+ "aead",
+ "aes",
+ "cipher",
+ "ctr",
+ "ghash",
+ "subtle",
]
[[package]]
-name = "async-stream-impl"
-version = "0.3.3"
+name = "aes-soft"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"
+checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "cipher",
+ "opaque-debug",
]
[[package]]
-name = "atoi"
-version = "0.3.3"
+name = "aesni"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c897df197d57c25b37df9d8fa2f93ddbfeee9ebd2264350ac79c8ec4b795885"
+checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
dependencies = [
- "num-traits",
+ "cipher",
+ "opaque-debug",
]
[[package]]
@@ -58,7 +64,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -68,6 +74,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
+name = "base64"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
+dependencies = [
+ "byteorder",
+ "safemem",
+]
+
+[[package]]
+name = "base64"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
+
+[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -75,6 +97,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
+name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
@@ -83,16 +114,16 @@ dependencies = [
]
[[package]]
-name = "bumpalo"
-version = "3.11.0"
+name = "byteorder"
+version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
+checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
-name = "bytes"
-version = "1.2.1"
+name = "cfg-if"
+version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
+checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
@@ -101,30 +132,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "chrono"
-version = "0.4.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
-dependencies = [
- "iana-time-zone",
- "num-integer",
- "num-traits",
- "winapi",
-]
-
-[[package]]
-name = "clap"
-version = "2.34.0"
+name = "cipher"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
dependencies = [
- "ansi_term",
- "atty",
- "bitflags",
- "strsim",
- "textwrap",
- "unicode-width",
- "vec_map",
+ "generic-array",
]
[[package]]
@@ -139,10 +152,20 @@ dependencies = [
]
[[package]]
-name = "core-foundation-sys"
-version = "0.8.3"
+name = "cookie"
+version = "0.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+checksum = "be2018768ed1d848cc4d347d551546474025ba820e5db70e4c9aaa349f678bd7"
+dependencies = [
+ "aes-gcm",
+ "base64 0.13.0",
+ "hkdf",
+ "hmac",
+ "percent-encoding 2.2.0",
+ "rand 0.8.5",
+ "sha2 0.9.9",
+ "time",
+]
[[package]]
name = "cpufeatures"
@@ -154,6 +177,12 @@ dependencies = [
]
[[package]]
+name = "cpuid-bool"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba"
+
+[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -164,26 +193,127 @@ dependencies = [
]
[[package]]
+name = "crypto-mac"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a"
+dependencies = [
+ "generic-array",
+ "subtle",
+]
+
+[[package]]
+name = "ctr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
+dependencies = [
+ "cipher",
+]
+
+[[package]]
+name = "devise"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd716c4a507adc5a2aa7c2a372d06c7497727e0892b243d3036bc7478a13e526"
+dependencies = [
+ "devise_codegen",
+ "devise_core",
+]
+
+[[package]]
+name = "devise_codegen"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea7b8290d118127c08e3669da20b331bed56b09f20be5945b7da6c116d8fab53"
+dependencies = [
+ "devise_core",
+ "quote 0.6.13",
+]
+
+[[package]]
+name = "devise_core"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1053e9d5d5aade9bcedb5ab53b78df2b56ff9408a3138ce77eaaef87f932373"
+dependencies = [
+ "bitflags",
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "syn 0.15.44",
+]
+
+[[package]]
+name = "digest"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
name = "digest"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
dependencies = [
- "block-buffer",
+ "block-buffer 0.10.3",
"crypto-common",
]
[[package]]
+name = "filetime"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
+dependencies = [
+ "cfg-if 1.0.0",
+ "libc",
+ "redox_syscall",
+ "windows-sys",
+]
+
+[[package]]
+name = "fsevent"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
+dependencies = [
+ "bitflags",
+ "fsevent-sys",
+]
+
+[[package]]
+name = "fsevent-sys"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]]
-name = "futures-core"
-version = "0.3.24"
+name = "fuchsia-zircon"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
+dependencies = [
+ "bitflags",
+ "fuchsia-zircon-sys",
+]
+
+[[package]]
+name = "fuchsia-zircon-sys"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
+checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "generic-array"
@@ -192,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
- "version_check",
+ "version_check 0.9.4",
]
[[package]]
@@ -201,21 +331,34 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
- "wasi",
+ "wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
-name = "heck"
-version = "0.3.3"
+name = "ghash"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
+checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375"
dependencies = [
- "unicode-segmentation",
+ "opaque-debug",
+ "polyval",
]
[[package]]
+name = "glob"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+
+[[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -225,16 +368,98 @@ dependencies = [
]
[[package]]
-name = "iana-time-zone"
-version = "0.1.50"
+name = "hkdf"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f"
+dependencies = [
+ "digest 0.9.0",
+ "hmac",
+]
+
+[[package]]
+name = "hmac"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
+dependencies = [
+ "crypto-mac",
+ "digest 0.9.0",
+]
+
+[[package]]
+name = "httparse"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
+
+[[package]]
+name = "hyper"
+version = "0.10.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273"
+dependencies = [
+ "base64 0.9.3",
+ "httparse",
+ "language-tags",
+ "log 0.3.9",
+ "mime",
+ "num_cpus",
+ "time",
+ "traitobject",
+ "typeable",
+ "unicase",
+ "url",
+]
+
+[[package]]
+name = "idna"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
+dependencies = [
+ "matches",
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "indexmap"
+version = "1.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
+name = "inotify"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
+dependencies = [
+ "bitflags",
+ "inotify-sys",
+ "libc",
+]
+
+[[package]]
+name = "inotify-sys"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "iovec"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0"
+checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
dependencies = [
- "android_system_properties",
- "core-foundation-sys",
- "js-sys",
- "wasm-bindgen",
- "winapi",
+ "libc",
]
[[package]]
@@ -244,19 +469,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
-name = "js-sys"
-version = "0.3.60"
+name = "kernel32-sys"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
+checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
- "wasm-bindgen",
+ "winapi 0.2.8",
+ "winapi-build",
]
[[package]]
-name = "lazy_static"
-version = "1.4.0"
+name = "language-tags"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
+
+[[package]]
+name = "lazycell"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
@@ -265,13 +497,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966"
[[package]]
-name = "lock_api"
-version = "0.4.9"
+name = "log"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
dependencies = [
- "autocfg",
- "scopeguard",
+ "log 0.4.17",
]
[[package]]
@@ -280,17 +511,14 @@ version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
-name = "matchers"
-version = "0.0.1"
+name = "matches"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
-dependencies = [
- "regex-automata",
-]
+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "memchr"
@@ -299,51 +527,84 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
-name = "mini-redis"
-version = "0.4.1"
+name = "mime"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "528890a6b63c88c9bda173867128abe62c0f5050dd959f067aeea09e90439f33"
+checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
dependencies = [
- "async-stream",
- "atoi",
- "bytes",
- "structopt",
- "tokio",
- "tokio-stream",
- "tracing",
- "tracing-futures",
- "tracing-subscriber",
+ "log 0.3.9",
]
[[package]]
name = "mio"
-version = "0.8.4"
+version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
+checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
dependencies = [
+ "cfg-if 0.1.10",
+ "fuchsia-zircon",
+ "fuchsia-zircon-sys",
+ "iovec",
+ "kernel32-sys",
"libc",
- "log",
- "wasi",
- "windows-sys",
+ "log 0.4.17",
+ "miow",
+ "net2",
+ "slab",
+ "winapi 0.2.8",
]
[[package]]
-name = "num-integer"
-version = "0.1.45"
+name = "mio-extras"
+version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
dependencies = [
- "autocfg",
- "num-traits",
+ "lazycell",
+ "log 0.4.17",
+ "mio",
+ "slab",
]
[[package]]
-name = "num-traits"
-version = "0.2.15"
+name = "miow"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
+checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
dependencies = [
- "autocfg",
+ "kernel32-sys",
+ "net2",
+ "winapi 0.2.8",
+ "ws2_32-sys",
+]
+
+[[package]]
+name = "net2"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
+name = "notify"
+version = "4.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257"
+dependencies = [
+ "bitflags",
+ "filetime",
+ "fsevent",
+ "fsevent-sys",
+ "inotify",
+ "libc",
+ "mio",
+ "mio-extras",
+ "walkdir",
+ "winapi 0.3.9",
]
[[package]]
@@ -357,59 +618,55 @@ dependencies = [
]
[[package]]
-name = "once_cell"
-version = "1.15.0"
+name = "opaque-debug"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
+checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
-name = "parking_lot"
-version = "0.12.1"
+name = "pear"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+checksum = "32dfa7458144c6af7f9ce6a137ef975466aa68ffa44d4d816ee5934018ba960a"
dependencies = [
- "lock_api",
- "parking_lot_core",
+ "pear_codegen",
]
[[package]]
-name = "parking_lot_core"
-version = "0.9.3"
+name = "pear_codegen"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
+checksum = "c0288ba5d581afbc93e2bbd931c1013584c15ecf46b1cdb927edc7abddbc8ca6"
dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "smallvec",
- "windows-sys",
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "syn 0.15.44",
+ "version_check 0.9.4",
+ "yansi",
]
[[package]]
-name = "pin-project"
-version = "1.0.12"
+name = "percent-encoding"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"
-dependencies = [
- "pin-project-internal",
-]
+checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
-name = "pin-project-internal"
-version = "1.0.12"
+name = "percent-encoding"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
-name = "pin-project-lite"
-version = "0.2.9"
+name = "polyval"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
+checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd"
+dependencies = [
+ "cpuid-bool",
+ "opaque-debug",
+ "universal-hash",
+]
[[package]]
name = "ppv-lite86"
@@ -418,36 +675,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
+name = "proc-macro2"
+version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
+ "unicode-xid",
]
[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
+name = "proc-macro2"
+version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58"
dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
+ "unicode-ident",
]
[[package]]
-name = "proc-macro2"
-version = "1.0.44"
+name = "quote"
+version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58"
+checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
dependencies = [
- "unicode-ident",
+ "proc-macro2 0.4.30",
]
[[package]]
@@ -456,7 +707,7 @@ version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
- "proc-macro2",
+ "proc-macro2 1.0.44",
]
[[package]]
@@ -479,7 +730,7 @@ dependencies = [
"libc",
"rand_core 0.3.1",
"rdrand",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -546,50 +797,93 @@ dependencies = [
]
[[package]]
-name = "regex"
-version = "1.6.0"
+name = "rng"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
+checksum = "daa6bba2ae9b3232e194e86d9a407e28c5d02fdfb85ea0e7e2e60f4d1e78aff2"
dependencies = [
- "regex-syntax",
+ "rand 0.3.23",
]
[[package]]
-name = "regex-automata"
-version = "0.1.10"
+name = "roast"
+version = "0.1.0"
+dependencies = [
+ "clightningrpc",
+ "rand 0.8.5",
+ "rng",
+ "rocket",
+ "rocket_contrib",
+ "schnorr_fun",
+ "secp256kfun",
+ "sha2 0.10.6",
+ "thiserror",
+]
+
+[[package]]
+name = "rocket"
+version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+checksum = "83b9d9dc08c5dcc1d8126a9dd615545e6a358f8c13c883c8dfed8c0376fa355e"
dependencies = [
- "regex-syntax",
+ "atty",
+ "base64 0.13.0",
+ "log 0.4.17",
+ "memchr",
+ "num_cpus",
+ "pear",
+ "rocket_codegen",
+ "rocket_http",
+ "state",
+ "time",
+ "toml",
+ "version_check 0.9.4",
+ "yansi",
]
[[package]]
-name = "regex-syntax"
-version = "0.6.27"
+name = "rocket_codegen"
+version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
+checksum = "2810037b5820098af97bd4fdd309e76a8101ceb178147de775c835a2537284fe"
+dependencies = [
+ "devise",
+ "glob",
+ "indexmap",
+ "quote 0.6.13",
+ "rocket_http",
+ "version_check 0.9.4",
+ "yansi",
+]
[[package]]
-name = "rng"
-version = "0.1.0"
+name = "rocket_contrib"
+version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "daa6bba2ae9b3232e194e86d9a407e28c5d02fdfb85ea0e7e2e60f4d1e78aff2"
+checksum = "e20efbc6a211cb3df5375accf532d4186f224b623f39eca650b19b96240c596b"
dependencies = [
- "rand 0.3.23",
+ "log 0.4.17",
+ "notify",
+ "rocket",
+ "serde",
+ "serde_json",
]
[[package]]
-name = "roast"
-version = "0.1.0"
+name = "rocket_http"
+version = "0.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2bf9cbd128e1f321a2d0bebd2b7cf0aafd89ca43edf69e49b56a5c46e48eb19f"
dependencies = [
- "clightningrpc",
- "mini-redis",
- "rand 0.8.5",
- "rng",
- "schnorr_fun",
- "secp256kfun",
- "sha2",
- "tokio",
+ "cookie",
+ "hyper",
+ "indexmap",
+ "pear",
+ "percent-encoding 1.0.1",
+ "smallvec",
+ "state",
+ "time",
+ "unicode-xid",
]
[[package]]
@@ -599,6 +893,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
+name = "safemem"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
name = "schnorr_fun"
version = "0.7.1"
dependencies = [
@@ -606,16 +915,10 @@ dependencies = [
]
[[package]]
-name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
-
-[[package]]
name = "secp256kfun"
version = "0.7.1"
dependencies = [
- "digest",
+ "digest 0.10.5",
"rand_core 0.6.4",
"serde",
"subtle-ng",
@@ -636,9 +939,9 @@ version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 1.0.44",
+ "quote 1.0.21",
+ "syn 1.0.101",
]
[[package]]
@@ -654,31 +957,35 @@ dependencies = [
[[package]]
name = "sha2"
-version = "0.10.6"
+version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
+checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
- "cfg-if",
+ "block-buffer 0.9.0",
+ "cfg-if 1.0.0",
"cpufeatures",
- "digest",
+ "digest 0.9.0",
+ "opaque-debug",
]
[[package]]
-name = "sharded-slab"
-version = "0.1.4"
+name = "sha2"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
+checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
- "lazy_static",
+ "cfg-if 1.0.0",
+ "cpufeatures",
+ "digest 0.10.5",
]
[[package]]
-name = "signal-hook-registry"
-version = "1.4.0"
+name = "slab"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
+checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
dependencies = [
- "libc",
+ "autocfg",
]
[[package]]
@@ -688,213 +995,132 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
[[package]]
-name = "socket2"
-version = "0.4.7"
+name = "state"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"
-dependencies = [
- "libc",
- "winapi",
-]
+checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483"
[[package]]
-name = "strsim"
-version = "0.8.0"
+name = "subtle"
+version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
-name = "structopt"
-version = "0.3.26"
+name = "subtle-ng"
+version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
-dependencies = [
- "clap",
- "lazy_static",
- "structopt-derive",
-]
+checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142"
[[package]]
-name = "structopt-derive"
-version = "0.4.18"
+name = "syn"
+version = "0.15.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
+checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
+ "proc-macro2 0.4.30",
+ "quote 0.6.13",
+ "unicode-xid",
]
[[package]]
-name = "subtle-ng"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142"
-
-[[package]]
name = "syn"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2"
dependencies = [
- "proc-macro2",
- "quote",
+ "proc-macro2 1.0.44",
+ "quote 1.0.21",
"unicode-ident",
]
[[package]]
-name = "textwrap"
-version = "0.11.0"
+name = "thiserror"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
+checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
dependencies = [
- "unicode-width",
+ "thiserror-impl",
]
[[package]]
-name = "thread_local"
-version = "1.1.4"
+name = "thiserror-impl"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
+checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
dependencies = [
- "once_cell",
+ "proc-macro2 1.0.44",
+ "quote 1.0.21",
+ "syn 1.0.101",
]
[[package]]
-name = "tokio"
-version = "1.21.2"
+name = "time"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
+checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
- "autocfg",
- "bytes",
"libc",
- "memchr",
- "mio",
- "num_cpus",
- "parking_lot",
- "pin-project-lite",
- "signal-hook-registry",
- "socket2",
- "tokio-macros",
- "winapi",
-]
-
-[[package]]
-name = "tokio-macros"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "tokio-stream"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af"
-dependencies = [
- "futures-core",
- "pin-project-lite",
- "tokio",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi 0.3.9",
]
[[package]]
-name = "tracing"
-version = "0.1.36"
+name = "tinyvec"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
- "cfg-if",
- "pin-project-lite",
- "tracing-attributes",
- "tracing-core",
+ "tinyvec_macros",
]
[[package]]
-name = "tracing-attributes"
-version = "0.1.22"
+name = "tinyvec_macros"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
-name = "tracing-core"
-version = "0.1.29"
+name = "toml"
+version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
+checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
dependencies = [
- "once_cell",
- "valuable",
+ "serde",
]
[[package]]
-name = "tracing-futures"
-version = "0.2.5"
+name = "traitobject"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
-dependencies = [
- "pin-project",
- "tracing",
-]
+checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
[[package]]
-name = "tracing-log"
-version = "0.1.3"
+name = "typeable"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
-dependencies = [
- "lazy_static",
- "log",
- "tracing-core",
-]
+checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
[[package]]
-name = "tracing-serde"
-version = "0.1.3"
+name = "typenum"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1"
-dependencies = [
- "serde",
- "tracing-core",
-]
+checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
-name = "tracing-subscriber"
-version = "0.2.25"
+name = "unicase"
+version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71"
+checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
dependencies = [
- "ansi_term",
- "chrono",
- "lazy_static",
- "matchers",
- "regex",
- "serde",
- "serde_json",
- "sharded-slab",
- "smallvec",
- "thread_local",
- "tracing",
- "tracing-core",
- "tracing-log",
- "tracing-serde",
+ "version_check 0.1.5",
]
[[package]]
-name = "typenum"
-version = "1.15.0"
+name = "unicode-bidi"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
+checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-ident"
@@ -903,94 +1129,81 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
[[package]]
-name = "unicode-segmentation"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
-
-[[package]]
-name = "unicode-width"
-version = "0.1.10"
+name = "unicode-normalization"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
+dependencies = [
+ "tinyvec",
+]
[[package]]
-name = "valuable"
+name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
-name = "vec_map"
-version = "0.8.2"
+name = "universal-hash"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
+dependencies = [
+ "generic-array",
+ "subtle",
+]
[[package]]
-name = "version_check"
-version = "0.9.4"
+name = "url"
+version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
+dependencies = [
+ "idna",
+ "matches",
+ "percent-encoding 1.0.1",
+]
[[package]]
-name = "wasi"
-version = "0.11.0+wasi-snapshot-preview1"
+name = "version_check"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
[[package]]
-name = "wasm-bindgen"
-version = "0.2.83"
+name = "version_check"
+version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.83"
+name = "walkdir"
+version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
+checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
- "bumpalo",
- "log",
- "once_cell",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
+ "same-file",
+ "winapi 0.3.9",
+ "winapi-util",
]
[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.83"
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.83"
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.83"
+name = "winapi"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
+checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
@@ -1003,12 +1216,27 @@ dependencies = [
]
[[package]]
+name = "winapi-build"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
+
+[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1056,3 +1284,19 @@ name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
+
+[[package]]
+name = "ws2_32-sys"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
+]
+
+[[package]]
+name = "yansi"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
diff --git a/Cargo.toml b/Cargo.toml
@@ -12,5 +12,7 @@ rand = "0.8.5"
sha2 = "0.10"
rng = "0.1.0"
clightningrpc = "0.2.0"
-tokio = { version = "1", features = ["full"] }
-mini-redis = "0.4"
-\ No newline at end of file
+
+rocket = "0.4.5"
+rocket_contrib = "0.4.5"
+thiserror = "1.0.21"
diff --git a/README.md b/README.md
@@ -1,3 +1,10 @@
+Experimental
+-> unfishished and not ready for use
+
+## todo
+Make agnostic to the threshold signature scheme that is used
+
+
## ROAST Paper Notes
[paper](https://eprint.iacr.org/2022/550.pdf)
diff --git a/src/frost.rs b/src/frost.rs
@@ -0,0 +1,84 @@
+use std::{
+ collections::{HashMap, HashSet},
+ sync::{Arc, Mutex},
+};
+
+use secp256kfun::{rand_core::RngCore, Scalar};
+
+use schnorr_fun::{
+ frost::{Frost, PointPoly, ScalarPoly, XOnlyFrostKey},
+ nonce::Deterministic,
+};
+
+use schnorr_fun::Schnorr;
+use sha2::Sha256;
+
+pub fn frost_keygen(threshold: usize, n_parties: usize) -> (Vec<Scalar>, Vec<XOnlyFrostKey>) {
+ let frost = Frost::new(Schnorr::<Sha256, Deterministic<Sha256>>::new(
+ Deterministic::<Sha256>::default(),
+ ));
+ dbg!(threshold, n_parties);
+ assert!(threshold <= n_parties);
+
+ // create some scalar polynomial for each party
+ let mut scalar_polys = vec![];
+ for i in 1..=n_parties {
+ println!("Creating scalar poly {}", i);
+ let scalar_poly = (1..=threshold)
+ .map(|_| {
+ let mut rng: rand::rngs::StdRng = rand::SeedableRng::from_entropy();
+ Scalar::from(rng.next_u32())
+ .non_zero()
+ .expect("computationally unreachable")
+ })
+ .collect();
+ scalar_polys.push(ScalarPoly::new(scalar_poly));
+ }
+ let point_polys: Vec<PointPoly> = scalar_polys.iter().map(|sp| sp.to_point_poly()).collect();
+
+ let keygen = frost.new_keygen(point_polys).unwrap();
+
+ let mut proofs_of_possession = vec![];
+ let mut shares_vec = vec![];
+ for (i, sp) in scalar_polys.into_iter().enumerate() {
+ println!("calculating shares and pop {}", i);
+ let (shares, pop) = frost.create_shares(&keygen, sp);
+ proofs_of_possession.push(pop);
+ shares_vec.push(shares);
+ }
+ println!("Calculated shares and pops");
+
+ // collect the recieved shares for each party
+ let mut recieved_shares: Vec<Vec<_>> = vec![];
+ for party_index in 0..n_parties {
+ println!("Collecting shares for {}", party_index);
+ recieved_shares.push(vec![]);
+ for share_index in 0..n_parties {
+ recieved_shares[party_index].push(shares_vec[share_index][party_index].clone());
+ }
+ }
+
+ println!("{:?}", recieved_shares);
+
+ // finish keygen for each party
+ let (secret_shares, frost_keys): (Vec<Scalar>, Vec<XOnlyFrostKey>) = (0..n_parties)
+ .map(|i| {
+ println!("Finishing keygen for participant {}", i);
+ std::thread::sleep(std::time::Duration::from_secs(1));
+ let (secret_share, frost_key) = frost
+ .finish_keygen(
+ keygen.clone(),
+ i,
+ recieved_shares[i].clone(),
+ proofs_of_possession.clone(),
+ )
+ .expect("collected shares");
+ println!("got secret share");
+ let xonly_frost_key = frost_key.into_xonly_key();
+ (secret_share, xonly_frost_key)
+ })
+ .unzip();
+ println!("Finished keygen!");
+
+ (secret_shares, frost_keys)
+}
diff --git a/src/lib.rs b/src/lib.rs
@@ -0,0 +1,3 @@
+pub mod frost;
+pub mod roast_coordinator;
+pub mod roast_signer;
diff --git a/src/main.rs b/src/main.rs
@@ -1,409 +1,19 @@
-use std::{
- collections::{HashMap, HashSet},
- sync::{Arc, Mutex},
-};
-
-use secp256kfun::{
- digest::typenum::U32,
- marker::{Public, Zero},
- rand_core::RngCore,
- Scalar,
-};
-
-use schnorr_fun::{
- frost::{Frost, PointPoly, ScalarPoly, XOnlyFrostKey},
- musig::{Nonce, NonceKeyPair},
- nonce::Deterministic,
- Message, Signature,
-};
-use sha2::Digest;
-
+use roast::frost;
+use roast::roast_coordinator;
+use roast::roast_signer;
+use schnorr_fun::frost::Frost;
+use schnorr_fun::nonce::Deterministic;
+use schnorr_fun::Message;
use schnorr_fun::Schnorr;
use sha2::Sha256;
-struct Roast<'a, H, NG> {
- frost: Frost<H, NG>,
- frost_key: XOnlyFrostKey,
- state: Arc<Mutex<RoastState<'a>>>,
-}
-
-struct RoastState<'a> {
- message: Message<'a, Public>,
- responsive_signers: HashSet<usize>,
- malicious_signers: HashSet<usize>,
- latest_nonces: HashMap<usize, Nonce>,
- sessions: HashMap<usize, Arc<Mutex<RoastSession>>>,
- session_counter: usize,
-}
-
-struct RoastSession {
- signers: HashSet<usize>,
- nonces: Vec<(usize, Nonce)>,
- sig_shares: Vec<Scalar<Public, Zero>>,
-}
-
-impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> Roast<'a, H, NG> {
- pub fn new(
- frost: Frost<H, NG>,
- frost_key: XOnlyFrostKey,
- message: Message<'a, Public>,
- ) -> Self {
- return Self {
- frost,
- frost_key,
- state: Arc::new(Mutex::new(RoastState {
- message,
- responsive_signers: HashSet::new(),
- malicious_signers: HashSet::new(),
- latest_nonces: HashMap::new(),
- sessions: HashMap::new(),
- session_counter: 0,
- })),
- };
- }
-
- pub async fn mark_malicious(&self, index: &usize) {
- let mut roast_state = self.state.lock().expect("got lock");
- roast_state.malicious_signers.insert(*index);
- if roast_state.malicious_signers.len() >= self.frost_key.threshold() {
- panic!("not enough singers left to continue!");
- }
- }
-
- /// Running roast as a signer
- // pub fn create_signature(
- // self,
- // secret_share: &Scalar,
- // secret_nonce: NonceKeyPair,
- // my_index: usize,
- // nonces: Vec<(usize, Nonce)>,
- // message: Message<'_>,
- // ) -> Scalar<Public, Zero> {
- // let session = self
- // .frost
- // .start_sign_session(&self.frost_key, nonces, message);
- // self.frost.sign(
- // &self.frost_key,
- // &session,
- // my_index,
- // secret_share,
- // secret_nonce,
- // )
- // }
-
- // Main body of the ROAST coordinator algorithm
- pub async fn recieve_signature(
- &self,
- index: usize,
- signature_share: Option<Scalar<Public, Zero>>,
- new_nonce: Nonce,
- ) -> (Option<Signature>, Option<Vec<(usize, Nonce)>>) {
- let mut roast_state = self.state.lock().expect("got lock");
-
- if roast_state.malicious_signers.contains(&index) {
- println!("Malicious signer tried to send signature! {}", index);
- return (None, None);
- }
-
- dbg!(roast_state.responsive_signers.clone());
- if roast_state.responsive_signers.contains(&index) {
- println!(
- "Unsolicited reply from signer {}, marking malicious.",
- index
- );
- self.mark_malicious(&index).await;
- return (None, None);
- }
-
- // If this is not the inital message from S_i
- if roast_state.sessions.contains_key(&index) {
- let mut roast_session = roast_state
- .sessions
- .get(&index)
- .unwrap()
- .lock()
- .expect("got lock");
-
- let session = self.frost.start_sign_session(
- &self.frost_key,
- roast_session.nonces.clone(),
- roast_state.message,
- );
-
- if !self.frost.verify_signature_share(
- &self.frost_key,
- &session,
- index,
- signature_share.expect("party provided None signature share"),
- ) {
- println!("Invalid signature, marking {} malicious.", index);
- self.mark_malicious(&index).await;
- return (None, None);
- }
-
- // Store valid signature
- roast_session
- .sig_shares
- .push(signature_share.expect("party provided None signature share"));
- println!("New signature from party {}", index);
-
- // if we have t-of-n, combine!
- if roast_session.sig_shares.len() >= self.frost_key.threshold() {
- println!("We have the threshold number of signatures, combining!");
- let combined_sig = self.frost.combine_signature_shares(
- &self.frost_key,
- &session,
- roast_session.sig_shares.clone(),
- );
- // return combined signature
- return (Some(combined_sig), None);
- }
- }
-
- // Store the recieved presignature shares
- roast_state.latest_nonces.insert(index, new_nonce);
-
- // Mark S_i as responsive
- roast_state.responsive_signers.insert(index);
-
- // if we now have t responsive signers:
- if roast_state.responsive_signers.len() >= self.frost_key.threshold() {
- println!("We now have threshold number of responsive signers!");
- roast_state.session_counter += 1;
- // build the presignature (aggregate the nonces).
- let r_signers = roast_state.responsive_signers.clone();
- // we're not actually aggregating any nonces in this core yet since this will
- // require changes to frost.rs
- let nonces: Vec<_> = r_signers
- .iter()
- .cloned()
- .map(|i| {
- (
- i,
- *roast_state
- .latest_nonces
- .get(&i)
- .expect("has submitted nonce"),
- )
- })
- .collect();
-
- for i in r_signers.clone() {
- // send agg nonce to signers (rho, R)
- roast_state.sessions.insert(
- i,
- Arc::new(Mutex::new(RoastSession {
- signers: r_signers.clone(),
- nonces: nonces.clone(),
- sig_shares: vec![],
- })),
- );
- let nonces = roast_state
- .latest_nonces
- .iter()
- .map(|(i, nonce)| (*i, *nonce))
- .collect();
- println!("Responding with nonces:");
- // DO THIS FOR EVERY S_i...>!>!> need async
-
- // OPEN MANY THREADS AND THEN AWAIT COLLECTION
- return (None, Some(nonces));
- }
- }
-
- // Return None if we get to here?
- // Better API would be return the number of remaining signatures or th remaining signature if complete.
- // Non complex RecieveSigResponse Result
- (None, None)
- }
-}
-
-// use mini_redis::{client, Result};
-
-#[tokio::main]
-async fn main() {
- // Do frost keygen for 9-of-15
- let threshold: usize = 2;
- let n_parties: usize = 3;
-
- let frost = Frost::new(Schnorr::<Sha256, Deterministic<Sha256>>::new(
- Deterministic::<Sha256>::default(),
- ));
- dbg!(threshold, n_parties);
- assert!(threshold <= n_parties);
-
- // create some scalar polynomial for each party
- let mut scalar_polys = vec![];
- for i in 1..=n_parties {
- println!("Creating scalar poly {}", i);
- let scalar_poly = (1..=threshold)
- .map(|_| {
- let mut rng: rand::rngs::StdRng = rand::SeedableRng::from_entropy();
- Scalar::from(rng.next_u32())
- .non_zero()
- .expect("computationally unreachable")
- })
- .collect();
- scalar_polys.push(ScalarPoly::new(scalar_poly));
- }
- let point_polys: Vec<PointPoly> = scalar_polys.iter().map(|sp| sp.to_point_poly()).collect();
-
- let keygen = frost.new_keygen(point_polys).unwrap();
-
- let mut proofs_of_possession = vec![];
- let mut shares_vec = vec![];
- for (i, sp) in scalar_polys.into_iter().enumerate() {
- println!("calculating shares and pop {}", i);
- let (shares, pop) = frost.create_shares(&keygen, sp);
- proofs_of_possession.push(pop);
- shares_vec.push(shares);
- }
- println!("Calculated shares and pops");
-
- // collect the recieved shares for each party
- let mut recieved_shares: Vec<Vec<_>> = vec![];
- for party_index in 0..n_parties {
- println!("Collecting shares for {}", party_index);
- recieved_shares.push(vec![]);
- for share_index in 0..n_parties {
- recieved_shares[party_index].push(shares_vec[share_index][party_index].clone());
- }
- }
-
- println!("{:?}", recieved_shares);
-
- // finish keygen for each party
- let (secret_shares, frost_keys): (Vec<Scalar>, Vec<XOnlyFrostKey>) = (0..n_parties)
- .map(|i| {
- println!("Finishing keygen for participant {}", i);
- std::thread::sleep(std::time::Duration::from_secs(1));
- let (secret_share, frost_key) = frost
- .finish_keygen(
- keygen.clone(),
- i,
- recieved_shares[i].clone(),
- proofs_of_possession.clone(),
- )
- .expect("collected shares");
- println!("got secret share");
- let xonly_frost_key = frost_key.into_xonly_key();
- (secret_share, xonly_frost_key)
- })
- .unzip();
- println!("Finished keygen!");
-
- // use a boolean mask for which t participants are signers
- let mut signer_mask = vec![true; threshold];
- signer_mask.append(&mut vec![false; n_parties - threshold]);
- // shuffle the mask for random signers
-
- let signer_indexes: Vec<_> = signer_mask
- .iter()
- .enumerate()
- .filter(|(_, is_signer)| **is_signer)
- .map(|(i, _)| i)
- .collect();
-
- println!("Preparing for signing session...");
-
- let verification_shares_bytes: Vec<_> = frost_keys[signer_indexes[0]]
- .verification_shares()
- .map(|share| share.to_bytes())
- .collect();
-
- let sid = [
- frost_keys[signer_indexes[0]]
- .public_key()
- .to_xonly_bytes()
- .as_slice(),
- verification_shares_bytes.concat().as_slice(),
- b"frost-prop-test".as_slice(),
- ]
- .concat();
-
- let mut nonces: Vec<NonceKeyPair> = signer_indexes
- .iter()
- .map(|i| {
- frost.gen_nonce(
- &secret_shares[*i],
- &[sid.as_slice(), [*i as u8].as_slice()].concat(),
- Some(frost_keys[signer_indexes[0]].public_key().normalize()),
- None,
- )
- })
- .collect();
-
- let mut recieved_nonces: Vec<_> = vec![];
- for (i, nonce) in signer_indexes.iter().zip(nonces.clone()) {
- recieved_nonces.push((*i, nonce.public()));
- }
- println!("Recieved nonces..");
-
- // Now time for ROAST
-
- // Test roast being run by 1 external party -> frost_key contains public data
- let message = Message::plain("test", b"test");
- let roast = Roast::new(frost.clone(), frost_keys[0].clone(), message);
-
- let mut counter = 0;
- loop {
- for i in 0..signer_indexes.len() {
- let current_nonce = nonces[i].clone();
- let next_nonce = frost.gen_nonce(
- &secret_shares[i],
- &[sid.clone(), [counter].to_vec()].concat(),
- Some(frost_keys[i].public_key().normalize()),
- None,
- );
- nonces[i] = next_nonce.clone();
+pub fn main() {
+ // Do a frost keygen
+ let (secret_shares, frost_keys) = frost::frost_keygen(3, 5);
- let (sig, new_nonces) = if counter == 0 {
- // Initial sending empty sig with nonces
- roast.recieve_signature(i, None, next_nonce.public()).await
- } else {
- println!("Signing for participant {}", signer_indexes[i]);
- let signer_index = signer_indexes[i];
- let session = frost.start_sign_session(
- &frost_keys[signer_index],
- recieved_nonces.clone(),
- Message::plain("test", b"test"),
- );
- let sig = frost.sign(
- &frost_keys[signer_index],
- &session,
- signer_index,
- &secret_shares[signer_index],
- current_nonce.clone(),
- );
- roast
- .recieve_signature(i, Some(sig), next_nonce.public())
- .await
- };
+ let frost = Frost::<Sha256, Deterministic<Sha256>>::default();
- // Hangs if you always send same index
- match sig {
- Some(combined_sig) => {
- assert!(frost.schnorr.verify(
- &frost_keys[signer_indexes[i]].public_key(),
- Message::<Public>::plain("test", b"test"),
- &combined_sig
- ));
- println!("Signed via roast!");
- break;
- }
- None => {
- println!("Sent partial signature {} to roast..", i)
- }
- };
- match new_nonces {
- Some(nonces) => {
- recieved_nonces = nonces.clone();
- println!("Got new nonces {:?}", nonces);
- }
- None => println!("No new nonces!?"),
- }
- println!("Current nonces {:?}", recieved_nonces.clone());
- }
- counter += 1;
- }
+ let message = Message::plain("10 000 emails", b"");
+ // Create a roast server
+ roast_coordinator::RoastServer::new(frost, frost_keys[0].clone(), message);
}
diff --git a/src/roast_coordinator.rs b/src/roast_coordinator.rs
@@ -0,0 +1,214 @@
+use std::{
+ collections::{HashMap, HashSet},
+ sync::{Arc, Mutex},
+};
+
+use secp256kfun::{
+ digest::typenum::U32,
+ marker::{Public, Zero},
+ Scalar,
+};
+
+use schnorr_fun::{
+ frost::{Frost, XOnlyFrostKey},
+ musig::{Nonce, NonceKeyPair},
+ nonce::NonceGen,
+ Message, Signature,
+};
+use sha2::Digest;
+
+pub struct RoastServer<'a, H, NG> {
+ frost: Frost<H, NG>,
+ frost_key: XOnlyFrostKey,
+ state: Arc<Mutex<RoastState<'a>>>,
+}
+
+pub struct RoastState<'a> {
+ message: Message<'a, Public>,
+ responsive_signers: HashSet<usize>,
+ malicious_signers: HashSet<usize>,
+ latest_nonces: HashMap<usize, Nonce>,
+ sessions: HashMap<usize, Arc<Mutex<RoastSignSession>>>,
+ session_counter: usize,
+}
+
+pub struct RoastSignSession {
+ signers: HashSet<usize>,
+ nonces: Vec<(usize, Nonce)>,
+ sig_shares: Vec<Scalar<Public, Zero>>,
+}
+
+impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG> RoastServer<'a, H, NG> {
+ pub fn new(
+ frost: Frost<H, NG>,
+ frost_key: XOnlyFrostKey,
+ message: Message<'a, Public>,
+ ) -> Self {
+ return Self {
+ frost,
+ frost_key,
+ state: Arc::new(Mutex::new(RoastState {
+ message,
+ responsive_signers: HashSet::new(),
+ malicious_signers: HashSet::new(),
+ latest_nonces: HashMap::new(),
+ sessions: HashMap::new(),
+ session_counter: 0,
+ })),
+ };
+ }
+
+ pub fn mark_malicious(&self, index: &usize) {
+ let mut roast_state = self.state.lock().expect("got lock");
+ roast_state.malicious_signers.insert(*index);
+ if roast_state.malicious_signers.len() >= self.frost_key.threshold() {
+ panic!("not enough singers left to continue!");
+ }
+ }
+
+ // Running roast as signer
+ pub fn create_signature(
+ self,
+ secret_share: &Scalar,
+ secret_nonce: NonceKeyPair,
+ my_index: usize,
+ nonces: Vec<(usize, Nonce)>,
+ message: Message<'_>,
+ ) -> Scalar<Public, Zero> {
+ let session = self
+ .frost
+ .start_sign_session(&self.frost_key, nonces, message);
+ self.frost.sign(
+ &self.frost_key,
+ &session,
+ my_index,
+ secret_share,
+ secret_nonce,
+ )
+ }
+
+ // Main body of the ROAST coordinator algorithm
+ pub async fn receive_signature(
+ &self,
+ index: usize,
+ signature_share: Option<Scalar<Public, Zero>>,
+ new_nonce: Nonce,
+ ) -> (Option<Signature>, Option<Vec<(usize, Nonce)>>) {
+ let mut roast_state = self.state.lock().expect("got lock");
+
+ if roast_state.malicious_signers.contains(&index) {
+ println!("Malicious signer tried to send signature! {}", index);
+ return (None, None);
+ }
+
+ if roast_state.responsive_signers.contains(&index) {
+ println!(
+ "Unsolicited reply from signer {}, marking malicious.",
+ index
+ );
+ self.mark_malicious(&index);
+ return (None, None);
+ }
+
+ // If this is not the inital message from S_i
+ if roast_state.sessions.contains_key(&index) {
+ let mut roast_session = roast_state
+ .sessions
+ .get(&index)
+ .unwrap()
+ .lock()
+ .expect("got lock");
+
+ let session = self.frost.start_sign_session(
+ &self.frost_key,
+ roast_session.nonces.clone(),
+ roast_state.message,
+ );
+
+ if !self.frost.verify_signature_share(
+ &self.frost_key,
+ &session,
+ index,
+ signature_share.expect("party provided None signature share"),
+ ) {
+ println!("Invalid signature, marking {} malicious.", index);
+ self.mark_malicious(&index);
+ return (None, None);
+ }
+
+ // Store valid signature
+ roast_session
+ .sig_shares
+ .push(signature_share.expect("party provided None signature share"));
+ println!("New signature from party {}", index);
+
+ // if we have t-of-n, combine!
+ if roast_session.sig_shares.len() >= self.frost_key.threshold() {
+ println!("We have the threshold number of signatures, combining!");
+ let combined_sig = self.frost.combine_signature_shares(
+ &self.frost_key,
+ &session,
+ roast_session.sig_shares.clone(),
+ );
+ // return combined signature
+ return (Some(combined_sig), None);
+ }
+ }
+
+ // Store the recieved presignature shares
+ roast_state.latest_nonces.insert(index, new_nonce);
+
+ // Mark S_i as responsive
+ roast_state.responsive_signers.insert(index);
+
+ // if we now have t responsive signers:
+ if roast_state.responsive_signers.len() >= self.frost_key.threshold() {
+ println!("We now have threshold number of responsive signers!");
+ roast_state.session_counter += 1;
+ // build the presignature (aggregate the nonces).
+ let r_signers = roast_state.responsive_signers.clone();
+ // we're not actually aggregating any nonces in this core yet since this will
+ // require changes to frost.rs
+ let nonces: Vec<_> = r_signers
+ .iter()
+ .cloned()
+ .map(|i| {
+ (
+ i,
+ *roast_state
+ .latest_nonces
+ .get(&i)
+ .expect("has submitted nonce"),
+ )
+ })
+ .collect();
+
+ for i in r_signers.clone() {
+ // send agg nonce to signers (rho, R)
+ roast_state.sessions.insert(
+ i,
+ Arc::new(Mutex::new(RoastSignSession {
+ signers: r_signers.clone(),
+ nonces: nonces.clone(),
+ sig_shares: vec![],
+ })),
+ );
+ let nonces = roast_state
+ .latest_nonces
+ .iter()
+ .map(|(i, nonce)| (*i, *nonce))
+ .collect();
+ println!("Responding with nonces:");
+ // DO THIS FOR EVERY S_i...>!>!> need async
+
+ // OPEN MANY THREADS AND THEN AWAIT COLLECTION
+ return (None, Some(nonces));
+ }
+ }
+
+ // (None, Some(roast_state.latest_nonces))
+ (None, None)
+ }
+}
+
+pub fn main() {}
diff --git a/src/roast_signer.rs b/src/roast_signer.rs
@@ -0,0 +1,110 @@
+use secp256kfun::{digest::typenum::U32, marker::Public, Scalar};
+
+use schnorr_fun::{
+ frost::{Frost, XOnlyFrostKey},
+ musig::{Nonce, NonceKeyPair},
+ nonce::NonceGen,
+ Message,
+};
+use sha2::Digest;
+
+use crate::roast_coordinator::RoastServer;
+
+struct RoastClient<'a, H, NG> {
+ roast_server: RoastServer<'a, H, NG>,
+ frost: Frost<H, NG>,
+ frost_key: XOnlyFrostKey,
+ my_index: usize,
+ secret_share: Scalar,
+ message: Message<'a, Public>,
+ nonce: NonceKeyPair,
+}
+
+impl<'a, H: Digest + Clone + Digest<OutputSize = U32>, NG: NonceGen> RoastClient<'a, H, NG> {
+ pub async fn start(
+ self,
+ roast_server: RoastServer<'a, H, NG>,
+ frost: Frost<H, NG>,
+ frost_key: XOnlyFrostKey,
+ my_index: usize,
+ secret_share: Scalar,
+ initial_nonce: NonceKeyPair,
+ message: Message<'a>,
+ ) -> RoastClient<'a, H, NG> {
+ let (combined_sig, nonce_set) = self
+ .roast_server
+ .receive_signature(self.my_index, None, initial_nonce.public)
+ .await;
+
+ match combined_sig {
+ Some(_) => {
+ println!("got combined sig!");
+ }
+ None => {
+ // println!("Sent partial signature {} to roast..", i)
+ }
+ };
+ match nonce_set {
+ Some(nonces) => {
+ println!("Got nonces {:?}", nonces);
+ }
+ None => println!("No new nonces!?"),
+ };
+ RoastClient {
+ roast_server,
+ frost,
+ frost_key,
+ my_index,
+ secret_share,
+ message,
+ nonce: initial_nonce,
+ }
+ }
+
+ fn new_nonce(&self, sid: &[u8]) -> NonceKeyPair {
+ self.frost.gen_nonce(
+ &self.secret_share,
+ sid,
+ Some(self.frost_key.public_key().normalize()),
+ Some(self.message),
+ )
+ }
+
+ pub async fn sign(&mut self, nonce_set: Vec<(usize, Nonce)>) {
+ let session = self.frost.start_sign_session(
+ &self.frost_key,
+ nonce_set,
+ Message::plain("test", b"test"),
+ );
+ let sig = self.frost.sign(
+ &self.frost_key,
+ &session,
+ self.my_index,
+ &self.secret_share,
+ self.nonce.clone(),
+ );
+ // call server with (sig, self.new_nonce())
+
+ self.nonce = self.new_nonce(&[0]);
+
+ let (combined_sig, nonce_set) = self
+ .roast_server
+ .receive_signature(self.my_index, Some(sig), self.nonce.public())
+ .await;
+
+ match combined_sig {
+ Some(_) => {
+ println!("got combined sig!");
+ }
+ None => {
+ // println!("Sent partial signature {} to roast..", i)
+ }
+ };
+ match nonce_set {
+ Some(nonces) => {
+ println!("Got nonces {:?}", nonces);
+ }
+ None => println!("No new nonces!?"),
+ };
+ }
+}
diff --git a/src/rocket.rs b/src/rocket.rs
@@ -0,0 +1,37 @@
+#![feature(decl_macro)]
+
+#[macro_use]
+extern crate rocket;
+
+use rocket::State;
+use rocket_contrib::json::Json;
+use std::collections::BTreeMap;
+use std::{error::Error, sync::Mutex};
+
+use schnorr_fun::frost::Nonce;
+use schnorr_fun::{frost::PointPoly, fun::Scalar, Signature};
+
+#[derive(Debug)]
+pub struct RoastDatabase {}
+
+// #[derive(Serialize, Deserialize, Clone)]
+// pub struct Response<'a, T> {
+// data: T,
+// message: &'a str,
+// }
+
+#[post("/submit_signature", data = "<signature>")]
+pub fn send_signature(roast_db: State<'_, Mutex<RoastDatabase>>, signature: String) -> () {}
+
+fn main() -> Result<(), Box<dyn Error>> {
+ rocket::ignite()
+ .manage(Mutex::new(RoastDatabase {}))
+ .mount(
+ "/",
+ routes![
+ send_signature, //post
+ ],
+ )
+ .launch();
+ Ok(())
+}