diff --git a/Cargo.lock b/Cargo.lock index beddf34..5960424 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] @@ -18,12 +18,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aho-corasick" -version = "1.1.2" +name = "aes" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" dependencies = [ - "memchr", + "cfg-if", + "cipher", + "cpufeatures", ] [[package]] @@ -35,6 +37,51 @@ dependencies = [ "winapi", ] +[[package]] +name = "anyhow" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" + +[[package]] +name = "asn1-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.99", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.99", +] + [[package]] name = "atty" version = "0.2.14" @@ -46,15 +93,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -63,37 +101,43 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "bindgen" version = "0.68.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cexpr", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2 1.0.70", - "quote 1.0.33", + "proc-macro2", + "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.41", + "syn 2.0.52", ] [[package]] @@ -104,34 +148,45 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" + +[[package]] +name = "block-padding" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "byteorder" -version = "1.5.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] -name = "cbor-codec" -version = "0.7.1" +name = "cbc" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e083a023562b37c52837e850131a51b1154cceb9d149f41ee3d386737b140f46" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "byteorder", - "libc", + "cipher", ] [[package]] name = "cc" -version = "1.0.83" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cexpr" @@ -144,21 +199,25 @@ dependencies = [ [[package]] name = "cfg-if" -version = "0.1.10" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "cipher" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", @@ -174,202 +233,90 @@ dependencies = [ "ansi_term", "atty", "bitflags 1.3.2", - "strsim 0.8.0", + "strsim", "textwrap", "unicode-width", "vec_map", ] [[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "crossbeam" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 0.1.10", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "csv" -version = "1.3.0" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", + "libc", ] [[package]] -name = "csv-core" -version = "0.1.11" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "memchr", + "generic-array", + "typenum", ] [[package]] -name = "ctap_hmac" -version = "0.4.5" +name = "ctap-hid-fido2" +version = "3.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c22d4c95aeeb4e2d41e823912d5460cfa1ebf672363eb97b32fa7c91cab89a" +checksum = "43150cf02f8e7c3caa32d5704a908bcdbd31899f6b9cc11ad6e0e42c9b7280ac" dependencies = [ + "aes", + "anyhow", + "base64", "byteorder", - "cbor-codec", - "crossbeam", - "csv", - "derive_builder", - "failure", - "failure_derive", - "num-derive", - "num-traits", - "rand 0.6.5", + "cbc", + "hex 0.4.3", + "hidapi", + "num", + "pad", "ring", - "rust-crypto", "serde", - "serde_derive", - "untrusted", -] - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2 1.0.70", - "quote 1.0.33", - "strsim 0.9.3", - "syn 1.0.109", + "serde_cbor", + "strum", + "strum_macros", + "x509-parser", ] [[package]] -name = "darling_macro" -version = "0.10.2" +name = "data-encoding" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote 1.0.33", - "syn 1.0.109", -] +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] -name = "derive_builder" -version = "0.9.0" +name = "der-parser" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" dependencies = [ - "darling", - "derive_builder_core", - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", ] [[package]] -name = "derive_builder_core" -version = "0.9.0" +name = "displaydoc" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "darling", - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 1.0.99", ] [[package]] name = "either" -version = "1.9.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "failure" @@ -387,19 +334,20 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 1.0.99", "synstructure", ] [[package]] name = "fido2luks" -version = "0.3.0-alpha" +version = "0.3.1-alpha" dependencies = [ - "ctap_hmac", + "anyhow", + "ctap-hid-fido2", "failure", - "hex", + "hex 0.3.2", "libcryptsetup-rs", "ring", "rpassword", @@ -410,39 +358,31 @@ dependencies = [ ] [[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "gcc" -version = "0.3.55" +name = "generic-array" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "glob" @@ -450,6 +390,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "heck" version = "0.3.3" @@ -459,6 +405,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -475,16 +427,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" [[package]] -name = "ident_case" -version = "1.0.1" +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hidapi" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d26e1151deaab68f34fbfd16d491a2a0170cf98d69d3efa23873b567a4199e1" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "inout" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" + +[[package]] +name = "js-sys" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] [[package]] name = "lazy_static" @@ -500,17 +482,17 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libcryptsetup-rs" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d2aa26d63e5289d6fac1e7e0be2e248ded9b5dfb3e2c345820d060c537d4b6" +checksum = "67dd3f8d51b4feb4acc765c063d45434fb7926fe979b20ee6f95dcd974b4dc0c" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "either", "lazy_static", "libc", @@ -536,40 +518,25 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "winapi", ] [[package]] name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.5.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg 1.1.0", -] +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "minimal-lexical" @@ -579,301 +546,223 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" dependencies = [ "adler", ] [[package]] name = "nom" -version = "7.1.3" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ "memchr", "minimal-lexical", ] [[package]] -name = "num-derive" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg 1.1.0", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "num" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", - "version_check", + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", ] [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "num-bigint" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "unicode-xid 0.1.0", + "autocfg", + "num-integer", + "num-traits", ] [[package]] -name = "proc-macro2" -version = "1.0.70" +name = "num-complex" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ - "unicode-ident", + "num-traits", ] [[package]] -name = "quote" -version = "0.6.13" +name = "num-integer" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "proc-macro2 0.4.30", + "autocfg", + "num-traits", ] [[package]] -name = "quote" -version = "1.0.33" +name = "num-iter" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "proc-macro2 1.0.70", + "autocfg", + "num-integer", + "num-traits", ] [[package]] -name = "rand" -version = "0.3.23" +name = "num-rational" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ - "libc", - "rand 0.4.6", + "autocfg", + "num-bigint", + "num-integer", + "num-traits", ] [[package]] -name = "rand" -version = "0.4.6" +name = "num-traits" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", + "autocfg", ] [[package]] -name = "rand" -version = "0.6.5" +name = "num_threads" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" dependencies = [ - "autocfg 0.1.8", "libc", - "rand_chacha", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi", ] [[package]] -name = "rand_chacha" -version = "0.1.1" +name = "object" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ - "autocfg 0.1.8", - "rand_core 0.3.1", + "memchr", ] [[package]] -name = "rand_core" -version = "0.3.1" +name = "oid-registry" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" dependencies = [ - "rand_core 0.4.2", + "asn1-rs", ] [[package]] -name = "rand_core" -version = "0.4.2" +name = "once_cell" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" [[package]] -name = "rand_hc" -version = "0.1.0" +name = "pad" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3" dependencies = [ - "rand_core 0.3.1", + "unicode-width", ] [[package]] -name = "rand_isaac" -version = "0.1.1" +name = "peeking_take_while" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] -name = "rand_jitter" -version = "0.1.4" +name = "pkg-config" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] -name = "rand_os" -version = "0.1.3" +name = "proc-macro-error" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi", + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.99", + "version_check", ] [[package]] -name = "rand_pcg" -version = "0.1.2" +name = "proc-macro-error-attr" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "autocfg 0.1.8", - "rand_core 0.4.2", + "proc-macro2", + "quote", + "version_check", ] [[package]] -name = "rand_xorshift" -version = "0.1.1" +name = "proc-macro2" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ - "rand_core 0.3.1", + "unicode-ident", ] [[package]] -name = "rdrand" -version = "0.4.0" +name = "quote" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "rand_core 0.3.1", + "proc-macro2", ] [[package]] name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "ring" -version = "0.13.5" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", - "lazy_static", "libc", + "once_cell", + "spin", "untrusted", + "web-sys", + "winapi", ] [[package]] @@ -886,24 +775,11 @@ dependencies = [ "winapi", ] -[[package]] -name = "rust-crypto" -version = "0.2.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" -dependencies = [ - "gcc", - "libc", - "rand 0.3.23", - "rustc-serialize", - "time", -] - [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" @@ -912,54 +788,64 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "rustc-serialize" -version = "0.3.25" +name = "rusticata-macros" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] [[package]] -name = "ryu" -version = "1.0.16" +name = "rustversion" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] -name = "scopeguard" -version = "1.2.0" +name = "ryu" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "semver" -version = "1.0.20" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.144" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" + +[[package]] +name = "serde_cbor" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ - "serde_derive", + "half", + "serde", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 1.0.99", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ "itoa", "ryu", @@ -968,21 +854,21 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] -name = "strsim" -version = "0.8.0" +name = "spin" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "strsim" -version = "0.9.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" @@ -1001,43 +887,51 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 1.0.99", ] [[package]] -name = "syn" -version = "0.15.44" +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum_macros" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", + "heck 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.99", ] [[package]] name = "syn" -version = "1.0.109" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", + "proc-macro2", + "quote", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.41" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", + "proc-macro2", + "quote", "unicode-ident", ] @@ -1047,10 +941,10 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.70", - "quote 1.0.33", - "syn 1.0.109", - "unicode-xid 0.2.4", + "proc-macro2", + "quote", + "syn 1.0.99", + "unicode-xid", ] [[package]] @@ -1062,58 +956,85 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.99", +] + [[package]] name = "time" -version = "0.1.45" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" dependencies = [ + "itoa", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "num_threads", + "time-macros", ] [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "time-macros" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" [[package]] -name = "unicode-segmentation" -version = "1.10.1" +name = "typenum" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] -name = "unicode-width" -version = "0.1.11" +name = "unicode-ident" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "unicode-segmentation" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "untrusted" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "uuid" -version = "1.6.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" dependencies = [ "getrandom", ] @@ -1132,15 +1053,73 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "wasm-bindgen" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 1.0.99", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.99", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "winapi" @@ -1163,3 +1142,21 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] diff --git a/Cargo.toml b/Cargo.toml index 30b20d2..d6ca365 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fido2luks" -version = "0.3.0-alpha" +version = "0.3.1-alpha" authors = ["shimunn "] edition = "2018" @@ -14,9 +14,8 @@ categories = ["command-line-utilities"] license = "MPL-2.0" [dependencies] -ctap_hmac = { version="0.4.5", features = ["request_multiple"] } hex = "0.3.2" -ring = "0.13.5" +ring = "0.16.5" failure = "0.1.5" rpassword = "4.0.1" structopt = "0.3.2" @@ -24,15 +23,17 @@ libcryptsetup-rs = "0.9.1" serde_json = "1.0.51" serde_derive = "1.0.116" serde = "1.0.116" +anyhow = "1.0.56" +ctap-hid-fido2 = "3.4.1" [build-dependencies] -ctap_hmac = { version="0.4.5", features = ["request_multiple"] } hex = "0.3.2" -ring = "0.13.5" +ring = "0.16.5" failure = "0.1.5" rpassword = "4.0.1" libcryptsetup-rs = "0.9.1" structopt = "0.3.2" +anyhow = "1.0.56" [profile.release] lto = true diff --git a/build.rs b/build.rs index c6bd9c0..65ddbc0 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,6 @@ #![allow(warnings)] #[macro_use] extern crate failure; -extern crate ctap_hmac as ctap; #[path = "src/cli_args/mod.rs"] mod cli_args; @@ -12,17 +11,22 @@ mod util; use cli_args::Args; use std::env; +use std::fs; +use std::path::PathBuf; use std::str::FromStr; use structopt::clap::Shell; use structopt::StructOpt; fn main() { + let env_outdir = env::var_os("OUT_DIR").unwrap(); + let outdir = PathBuf::from(PathBuf::from(env_outdir).ancestors().nth(3).unwrap()); + fs::create_dir_all(&outdir).unwrap(); // generate completion scripts, zsh does panic for some reason for shell in Shell::variants().iter().filter(|shell| **shell != "zsh") { Args::clap().gen_completions( env!("CARGO_PKG_NAME"), Shell::from_str(shell).unwrap(), - env!("CARGO_MANIFEST_DIR"), + &outdir, ); } } diff --git a/flake.nix b/flake.nix index c5cfdb6..c5e7351 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ forPkgs = pkgs: let naersk-lib = naersk.lib."${pkgs.system}"; - buildInputs = with pkgs; [ cryptsetup cryptsetup.dev ]; + buildInputs = with pkgs; [ cryptsetup cryptsetup.dev udev.dev ]; nativeBuildInputs = with pkgs; [ rustPlatform.bindgenHook pkg-config diff --git a/src/cli.rs b/src/cli.rs index 1f5a2b5..c620eba 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -4,14 +4,13 @@ use crate::util::sha256; use crate::*; pub use cli_args::Args; use cli_args::*; -use ctap::{FidoCredential, FidoErrorKind}; +use ctap_hid_fido2::public_key_credential_descriptor::PublicKeyCredentialDescriptor; use std::borrow::Cow; use std::collections::HashSet; use std::io::Write; use std::iter::FromIterator; use std::path::Path; use std::str::FromStr; -use std::thread; use std::time::Duration; use std::time::SystemTime; use structopt::clap::Shell; @@ -26,31 +25,31 @@ fn derive_secret( salt: &[u8; 32], timeout: u64, pin: Option<&str>, -) -> Fido2LuksResult<([u8; 32], FidoCredential)> { +) -> Fido2LuksResult<([u8; 32], PublicKeyCredentialDescriptor)> { if credentials.is_empty() { return Err(Fido2LuksError::InsufficientCredentials); } let timeout = Duration::from_secs(timeout); let start = SystemTime::now(); - while let Ok(el) = start.elapsed() { - if el > timeout { - return Err(error::Fido2LuksError::NoAuthenticatorError); - } - if get_devices() - .map(|devices| !devices.is_empty()) - .unwrap_or(false) - { - break; - } - thread::sleep(Duration::from_millis(500)); - } + //while let Ok(el) = start.elapsed() { + // if el > timeout { + // return Err(error::Fido2LuksError::NoAuthenticatorError); + // } + // if get_devices() + // .map(|devices| !devices.is_empty()) + // .unwrap_or(false) + // { + // break; + // } + // thread::sleep(Duration::from_millis(500)); + //} let credentials = credentials .iter() - .map(|hex| FidoCredential { + .map(|hex| PublicKeyCredentialDescriptor { id: hex.0.clone(), - public_key: None, + ctype: Default::default(), }) .collect::>(); let credentials = credentials.iter().collect::>(); @@ -182,7 +181,8 @@ pub fn run_cli() -> Fido2LuksResult<()> { } else { None }; - let cred = make_credential_id(Some(name.as_ref()), pin)?; + let cred = + make_credential_id(Some(name.as_str()).filter(|name| name.len() > 0), pin, &[])?; println!("{}", hex::encode(&cred.id)); Ok(()) } @@ -289,7 +289,10 @@ pub fn run_cli() -> Fido2LuksResult<()> { let other_secret = |salt_q: &str, verify: bool| - -> Fido2LuksResult<(Vec, Option)> { + -> Fido2LuksResult<( + Vec, + Option, + )> { match other_secret { OtherSecret { keyfile: Some(file), @@ -314,22 +317,38 @@ pub fn run_cli() -> Fido2LuksResult<()> { )), } }; - let secret = |q: &str, - verify: bool, - credentials: &[HexEncoded]| - -> Fido2LuksResult<([u8; 32], FidoCredential)> { - let (pin, salt) = inputs(q, verify)?; - prompt_interaction(interactive); - derive_secret(credentials, &salt, authenticator.await_time, pin.as_deref()) - }; + let secret = + |q: &str, + verify: bool, + credentials: &[HexEncoded]| + -> Fido2LuksResult<([u8; 32], PublicKeyCredentialDescriptor)> { + let (pin, salt) = inputs(q, verify)?; + prompt_interaction(interactive); + derive_secret(credentials, &salt, authenticator.await_time, pin.as_deref()) + }; // Non overlap match &args.command { Command::AddKey { exclusive, generate_credential, + comment, .. } => { - let (existing_secret, _) = other_secret("Current password", false)?; + let (existing_secret, existing_credential) = + other_secret("Current password", false)?; + let excluded_credential = existing_credential.as_ref(); + let exclude_list = excluded_credential + .as_ref() + .map(core::slice::from_ref) + .unwrap_or_default(); + existing_credential.iter().for_each(|cred| { + log(&|| { + format!( + "using credential to unlock container: {}", + hex::encode(&cred.id) + ) + }) + }); let (new_secret, cred) = if *generate_credential && luks2 { let cred = make_credential_id( Some(derive_credential_name(luks.device.as_path()).as_str()), @@ -340,6 +359,7 @@ pub fn run_cli() -> Fido2LuksResult<()> { None }) .as_deref(), + dbg!(exclude_list), )?; log(&|| { format!( @@ -361,6 +381,7 @@ pub fn run_cli() -> Fido2LuksResult<()> { Some(&cred.id[..]) .filter(|_| !luks.disable_token || *generate_credential) .filter(|_| luks2), + comment.as_deref().map(String::from), )?; if *exclusive { let destroyed = luks_dev.remove_keyslots(&[added_slot])?; @@ -396,6 +417,7 @@ pub fn run_cli() -> Fido2LuksResult<()> { .filter(|_| !luks.disable_token) .filter(|_| luks2) .map(|cred| &cred.id[..]), + None, ) } else { let slot = luks_dev.replace_key( @@ -501,9 +523,8 @@ pub fn run_cli() -> Fido2LuksResult<()> { Err(e) => { match e { Fido2LuksError::WrongSecret if retries > 0 => {} - Fido2LuksError::AuthenticatorError { ref cause } - if cause.kind() == FidoErrorKind::Timeout && retries > 0 => {} - + //Fido2LuksError::AuthenticatorError { ref cause } + // if cause.kind() == FidoErrorKind::Timeout && retries > 0 => {} e => return Err(e), }; retries -= 1; @@ -544,8 +565,13 @@ pub fn run_cli() -> Fido2LuksResult<()> { continue; } println!( - "{}:\n\tSlots: {}\n\tCredentials: {}", + "{}{}:\n\tSlots: {}\n\tCredentials: {}", id, + token + .comment + .as_deref() + .map(|comment| format!(" - {}", comment)) + .unwrap_or_default(), if token.keyslots.is_empty() { "None".into() } else { @@ -571,6 +597,7 @@ pub fn run_cli() -> Fido2LuksResult<()> { TokenCommand::Add { device, credentials, + comment, slot, } => { let mut dev = LuksDevice::load(device)?; @@ -582,7 +609,11 @@ pub fn run_cli() -> Fido2LuksResult<()> { } } let count = if tokens.is_empty() { - dev.add_token(&Fido2LuksToken::with_credentials(&credentials.0, *slot))?; + dev.add_token(&Fido2LuksToken::with_credentials( + &credentials.0, + *slot, + comment.as_deref().map(String::from), + ))?; 1 } else { tokens.len() diff --git a/src/cli_args/mod.rs b/src/cli_args/mod.rs index b884939..c36df7d 100644 --- a/src/cli_args/mod.rs +++ b/src/cli_args/mod.rs @@ -189,6 +189,9 @@ pub enum Command { luks: LuksParameters, #[structopt(flatten)] credentials: Credentials, + /// Comment to be associated with this credential + #[structopt(long = "comment")] + comment: Option, #[structopt(flatten)] authenticator: AuthenticatorParameters, #[structopt(flatten)] @@ -254,7 +257,7 @@ pub enum Command { #[structopt(flatten)] authenticator: AuthenticatorParameters, /// Name to be displayed on the authenticator display - #[structopt(env = "FIDO2LUKS_CREDENTIAL_NAME", default_value = "fido2luks")] + #[structopt(env = "FIDO2LUKS_CREDENTIAL_NAME", default_value = "")] name: String, }, /// Check if an authenticator is connected @@ -295,6 +298,9 @@ pub enum TokenCommand { long = "creds" )] credentials: CommaSeparated, + /// Comment to be associated with this credential + #[structopt(long = "comment")] + comment: Option, /// Slot to which the credentials will be added #[structopt(long = "slot", env = "FIDO2LUKS_DEVICE_SLOT")] slot: u32, diff --git a/src/device.rs b/src/device.rs index e735165..fbae8a9 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1,84 +1,133 @@ use crate::error::*; use crate::util; -use ctap::{ - self, extensions::hmac::HmacExtension, request_multiple_devices, FidoAssertionRequestBuilder, - FidoCredential, FidoCredentialRequestBuilder, FidoDevice, FidoError, FidoErrorKind, -}; +use ctap_hid_fido2; +use ctap_hid_fido2::fidokey::get_assertion::get_assertion_params; +use ctap_hid_fido2::fidokey::make_credential::make_credential_params; +use ctap_hid_fido2::fidokey::GetAssertionArgsBuilder; +use ctap_hid_fido2::fidokey::MakeCredentialArgsBuilder; +use ctap_hid_fido2::get_fidokey_devices; +use ctap_hid_fido2::public_key_credential_descriptor::PublicKeyCredentialDescriptor; +use ctap_hid_fido2::public_key_credential_user_entity::PublicKeyCredentialUserEntity; +use ctap_hid_fido2::FidoKeyHidFactory; +use ctap_hid_fido2::HidInfo; +use ctap_hid_fido2::LibCfg; use std::time::Duration; const RP_ID: &str = "fido2luks"; +fn lib_cfg() -> LibCfg { + let mut cfg = LibCfg::init(); + cfg.enable_log = false; + cfg.keep_alive_msg = String::new(); + cfg +} + pub fn make_credential_id( name: Option<&str>, pin: Option<&str>, -) -> Fido2LuksResult { - let mut request = FidoCredentialRequestBuilder::default().rp_id(RP_ID); - if let Some(user_name) = name { - request = request.user_name(user_name); + exclude: &[&PublicKeyCredentialDescriptor], +) -> Fido2LuksResult { + let mut req = MakeCredentialArgsBuilder::new(RP_ID, &[]) + .extensions(&[make_credential_params::Extension::HmacSecret(Some(true))]); + if let Some(pin) = pin { + req = req.pin(pin); + } else { + req = req.without_pin_and_uv(); + } + for cred in exclude { + req = req.exclude_authenticator(cred.id.as_ref()); + } + if let Some(_) = name { + req = req.user_entity(&PublicKeyCredentialUserEntity::new( + Some(b"00"), + name.clone(), + name, + )); } - let request = request.build().unwrap(); - let make_credential = |device: &mut FidoDevice| { - if let Some(pin) = pin.filter(|_| device.needs_pin()) { - device.unlock(pin)?; + let devices = get_devices()?; + let mut err: Option = None; + let req = req.build(); + for dev in devices { + let handle = FidoKeyHidFactory::create_by_params(&vec![dev.param], &lib_cfg()).unwrap(); + match handle.make_credential_with_args(&req) { + Ok(resp) => return Ok(resp.credential_descriptor), + Err(e) => err = Some(e.into()), } - device.make_hmac_credential(&request) - }; - Ok(request_multiple_devices( - get_devices()? - .iter_mut() - .map(|device| (device, &make_credential)), - None, - )?) + } + Err(err.unwrap_or(Fido2LuksError::NoAuthenticatorError)) } pub fn perform_challenge<'a>( - credentials: &'a [&'a FidoCredential], + credentials: &'a [&'a PublicKeyCredentialDescriptor], salt: &[u8; 32], - timeout: Duration, + _timeout: Duration, pin: Option<&str>, -) -> Fido2LuksResult<([u8; 32], &'a FidoCredential)> { - let request = FidoAssertionRequestBuilder::default() - .rp_id(RP_ID) - .credentials(credentials) - .build() - .unwrap(); - let get_assertion = |device: &mut FidoDevice| { - if let Some(pin) = pin.filter(|_| device.needs_pin()) { - device.unlock(pin)?; +) -> Fido2LuksResult<([u8; 32], &'a PublicKeyCredentialDescriptor)> { + if credentials.is_empty() { + return Err(Fido2LuksError::InsufficientCredentials); + } + let mut req = GetAssertionArgsBuilder::new(RP_ID, &[]).extensions(&[ + get_assertion_params::Extension::HmacSecret(Some(util::sha256(&[&salt[..]]))), + ]); + for cred in credentials { + req = req.add_credential_id(&cred.id); + } + if let Some(pin) = pin { + req = req.pin(pin); + } else { + req = req.without_pin_and_uv(); + } + let process_response = |resp: Vec| -> Fido2LuksResult<([u8; 32], &'a PublicKeyCredentialDescriptor)> { + for att in resp { + for ext in att.extensions.iter() { + match ext { + get_assertion_params::Extension::HmacSecret(Some(secret)) => { + //TODO: eliminate unwrap + let cred_used = credentials + .iter() + .copied() + .find(|cred| { + att.credential_id == cred.id + }) + .unwrap(); + return Ok((secret.clone(), cred_used)); + } + _ => continue, + } } - device.get_hmac_assertion(&request, &util::sha256(&[&salt[..]]), None) + } + Err(Fido2LuksError::WrongSecret) }; - let (credential, (secret, _)) = request_multiple_devices( - get_devices()? - .iter_mut() - .map(|device| (device, &get_assertion)), - Some(timeout), - )?; - Ok((secret, credential)) + + let devices = get_devices()?; + let mut err: Option = None; + let req = req.build(); + for dev in devices { + let handle = FidoKeyHidFactory::create_by_params(&vec![dev.param], &lib_cfg()).unwrap(); + match handle.get_assertion_with_args(&req) { + Ok(resp) => return process_response(resp), + Err(e) => err = Some(e.into()), + } + } + Err(err.unwrap_or(Fido2LuksError::NoAuthenticatorError)) } pub fn may_require_pin() -> Fido2LuksResult { - for di in ctap::get_devices()? { - if let Ok(dev) = FidoDevice::new(&di) { - if dev.needs_pin() { - return Ok(true); - } + for dev in get_devices()? { + let handle = FidoKeyHidFactory::create_by_params(&vec![dev.param], &lib_cfg()).unwrap(); + let info = handle.get_info()?; + let needs_pin = info + .options + .iter() + .any(|(name, val)| &name[..] == "clientPin" && *val); + if needs_pin { + return Ok(true); } } Ok(false) } -pub fn get_devices() -> Fido2LuksResult> { - let mut devices = Vec::with_capacity(2); - for di in ctap::get_devices()? { - match FidoDevice::new(&di) { - Err(e) => match e.kind() { - FidoErrorKind::ParseCtap | FidoErrorKind::DeviceUnsupported => (), - err => return Err(FidoError::from(err).into()), - }, - Ok(dev) => devices.push(dev), - } - } - Ok(devices) +pub fn get_devices() -> Fido2LuksResult> { + Ok(get_fidokey_devices()) } diff --git a/src/error.rs b/src/error.rs index f451f1c..995c495 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -use ctap::FidoError; +use anyhow; use libcryptsetup_rs::LibcryptErr; use std::io; use std::io::ErrorKind; @@ -14,7 +14,7 @@ pub enum Fido2LuksError { #[fail(display = "unable to read keyfile: {}", cause)] KeyfileError { cause: io::Error }, #[fail(display = "authenticator error: {}", cause)] - AuthenticatorError { cause: ctap::FidoError }, + AuthenticatorError { cause: anyhow::Error }, #[fail(display = "no authenticator found, please ensure your device is plugged in")] NoAuthenticatorError, #[fail(display = " {}", cause)] @@ -35,6 +35,12 @@ pub enum Fido2LuksError { InsufficientCredentials, } +impl From for Fido2LuksError { + fn from(cause: anyhow::Error) -> Self { + Fido2LuksError::AuthenticatorError { cause } + } +} + impl Fido2LuksError { pub fn exit_code(&self) -> i32 { use Fido2LuksError::*; @@ -91,12 +97,6 @@ impl From for Fido2LuksError { } } -impl From for Fido2LuksError { - fn from(e: FidoError) -> Self { - AuthenticatorError { cause: e } - } -} - impl From for Fido2LuksError { fn from(e: LibcryptErr) -> Self { match e { diff --git a/src/luks.rs b/src/luks.rs index c46a4df..230ada1 100644 --- a/src/luks.rs +++ b/src/luks.rs @@ -141,6 +141,7 @@ impl LuksDevice { old_secret: &[u8], iteration_time: Option, credential_id: Option<&[u8]>, + comment: Option, ) -> Fido2LuksResult { if let Some(millis) = iteration_time { self.device.settings_handle().set_iteration_time(millis) @@ -151,7 +152,7 @@ impl LuksDevice { .add_by_passphrase(None, old_secret, secret)?; if let Some(id) = credential_id { self.device.token_handle().json_set(TokenInput::AddToken( - &serde_json::to_value(&Fido2LuksToken::new(id, slot)).unwrap(), + &serde_json::to_value(&Fido2LuksToken::new(id, slot, comment)).unwrap(), ))?; } @@ -215,9 +216,18 @@ impl LuksDevice { )? as u32; if let Some(id) = credential_id { if self.is_luks2()? { - let token = self.find_token(slot)?.map(|(t, _)| t); - let json = serde_json::to_value(&Fido2LuksToken::new(id, slot)).unwrap(); - if let Some(token) = token { + let (token_id, token_data) = match self.find_token(slot)? { + Some((id, data)) => (Some(id), Some(data)), + _ => (None, None), + }; + let json = serde_json::to_value(&Fido2LuksToken::new( + id, + slot, + // retain comment on replace + token_data.map(|data| data.comment).flatten(), + )) + .unwrap(); + if let Some(token) = token_id { self.device .token_handle() .json_set(TokenInput::ReplaceToken(token, &json))?; @@ -314,16 +324,19 @@ pub struct Fido2LuksToken { pub type_: String, pub credential: HashSet, pub keyslots: HashSet, + #[serde(skip_serializing_if = "Option::is_none")] + pub comment: Option, } impl Fido2LuksToken { - pub fn new(credential_id: impl AsRef<[u8]>, slot: u32) -> Self { - Self::with_credentials(std::iter::once(credential_id), slot) + pub fn new(credential_id: impl AsRef<[u8]>, slot: u32, comment: Option) -> Self { + Self::with_credentials(std::iter::once(credential_id), slot, comment) } pub fn with_credentials, B: AsRef<[u8]>>( credentials: I, slot: u32, + comment: Option, ) -> Self { Self { credential: credentials @@ -331,6 +344,7 @@ impl Fido2LuksToken { .map(|cred| hex::encode(cred.as_ref())) .collect(), keyslots: vec![slot.to_string()].into_iter().collect(), + comment, ..Default::default() } } @@ -345,6 +359,7 @@ impl Default for Fido2LuksToken { type_: Self::default_type().into(), credential: HashSet::new(), keyslots: HashSet::new(), + comment: None, } } } diff --git a/src/main.rs b/src/main.rs index cc5f42e..92d8d09 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ #[macro_use] extern crate failure; -extern crate ctap_hmac as ctap; #[macro_use] extern crate serde_derive; use crate::cli::*;