diff --git a/Cargo.lock b/Cargo.lock index 797c19e3885a25894dd9e2be3d8bb6391860de80..a7bfeaee1f911ffc14dc2f83e624ef96e8a75f83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,631 +1,580 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "adler32" -version = "1.0.4" +name = "addr2line" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" +dependencies = [ + "gimli", +] [[package]] -name = "autocfg" -version = "1.0.0" +name = "adler" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" [[package]] -name = "backtrace" -version = "0.3.46" +name = "autocfg" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "backtrace-sys" -version = "0.1.35" +name = "backtrace" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", ] [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bumpalo" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "cc" -version = "1.0.50" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chacha20-poly1305-aead" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77d2058ba29594f69c75e8a9018e0485e3914ca5084e3613cd64529042f5423b" dependencies = [ - "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq", ] [[package]] name = "clear_on_drop" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc5db465b294c3fa986d5bbb0f3017cd850bff6dd6c52f9ccff8b4d21b7b08" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", ] [[package]] name = "cloudabi" -version = "0.0.3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", ] [[package]] name = "ctor" -version = "0.1.13" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484" dependencies = [ - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "failure" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" dependencies = [ - "backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace", + "failure_derive", ] [[package]] name = "failure_derive" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] name = "flate2" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "crc32fast", + "libc", + "miniz_oxide", ] [[package]] name = "ghost" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] +[[package]] +name = "gimli" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" + [[package]] name = "indoc" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8" dependencies = [ - "indoc-impl 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "indoc-impl", + "proc-macro-hack", ] [[package]] name = "indoc-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0" dependencies = [ - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", + "unindent", ] [[package]] -name = "inventory" -version = "0.1.6" +name = "instant" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" dependencies = [ - "ctor 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "ghost 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "inventory-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", ] [[package]] -name = "inventory-impl" -version = "0.1.6" +name = "inventory" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fedd49de24d8c263613701406611410687148ae8c37cd6452650b250f753a0dd" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor", + "ghost", + "inventory-impl", ] [[package]] -name = "itoa" -version = "0.4.5" +name = "inventory-impl" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddead8880bc50f57fcd3b5869a7f6ff92570bb4e8f6870c22e2483272f2256da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "js-sys" -version = "0.3.37" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.68" +version = "0.2.77" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" [[package]] name = "lock_api" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" dependencies = [ - "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard", ] [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", ] [[package]] name = "miniz_oxide" -version = "0.3.6" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "adler", + "autocfg", ] [[package]] -name = "num-traits" -version = "0.2.11" +name = "object" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" + +[[package]] +name = "once_cell" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" [[package]] name = "parking_lot" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" dependencies = [ - "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "instant", + "lock_api", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "cloudabi", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", ] [[package]] name = "paste" -version = "0.1.10" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" dependencies = [ - "paste-impl 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl", + "proc-macro-hack", ] [[package]] name = "paste-impl" -version = "0.1.10" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" dependencies = [ - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack", ] [[package]] name = "pkstl" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b1a12c0fc296f2ea6b862fa77c9b97e02d82b0348988528478f14260b1f356" dependencies = [ - "chacha20-poly1305-aead 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "chacha20-poly1305-aead", + "clear_on_drop", + "failure", + "flate2", + "log", + "ring", ] [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" [[package]] name = "proc-macro2" -version = "1.0.10" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ef7cd2518ead700af67bf9d1a658d90b6037d77110fd9c0445429d0ba1c6c9" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid", ] [[package]] name = "py-pkstl" version = "0.1.0" dependencies = [ - "pkstl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pyo3 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "pkstl", + "pyo3", + "ring", ] [[package]] name = "pyo3" -version = "0.9.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b065394f390af20bfe60bad3728d71dfc4d397a5717f46cf9083a40ea468a52c" dependencies = [ - "indoc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "inventory 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "pyo3cls 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", - "unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor", + "indoc", + "inventory", + "libc", + "parking_lot", + "paste", + "pyo3cls", + "unindent", ] [[package]] name = "pyo3-derive-backend" -version = "0.9.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aa7cbb51801ffb526165a0ed6722b71b5c81ec43e87ceaa4b56c6501abad008" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "pyo3cls" -version = "0.9.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914680828ba0395e05902bbf358c26e8bf20fb484385334ab700a61e6f1a9ccf" dependencies = [ - "pyo3-derive-backend 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "pyo3-derive-backend", + "quote", + "syn", ] [[package]] name = "quote" -version = "1.0.3" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex" -version = "1.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.17" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "ring" -version = "0.16.12" +version = "0.16.15" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", ] [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ryu" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", -] +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "smallvec" -version = "1.3.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "syn" -version = "1.0.17" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c51d92969d209b54a98397e1b91c8ae82d8c87a7bb87df0b29aa2ad81454228" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] name = "synstructure" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", + "unicode-xid", ] [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "unindent" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af41d708427f8fd0e915dcebb2cae0f0e6acb2a939b2d399c265c39a38a18942" [[package]] name = "untrusted" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.9.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "wasm-bindgen" -version = "0.2.60" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.60" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ - "bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.60" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.60" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.60" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "web-sys" -version = "0.3.37" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" dependencies = [ - "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys", + "wasm-bindgen", ] [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[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-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" -"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" -"checksum backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" -"checksum backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" -"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum chacha20-poly1305-aead 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77d2058ba29594f69c75e8a9018e0485e3914ca5084e3613cd64529042f5423b" -"checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum ctor 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1" -"checksum failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" -"checksum failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" -"checksum flate2 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" -"checksum ghost 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a36606a68532b5640dc86bb1f33c64b45c4682aad4c50f3937b317ea387f3d6" -"checksum indoc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "79255cf29f5711995ddf9ec261b4057b1deb34e66c90656c201e41376872c544" -"checksum indoc-impl 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "54554010aa3d17754e484005ea0022f1c93839aabc627c2c55f3d7b47206134c" -"checksum inventory 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "82d3f4b90287725c97b17478c60dda0c6324e7c84ee1ed72fb9179d0fdf13956" -"checksum inventory-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9092a4fefc9d503e9287ef137f03180a6e7d1b04c419563171ee14947c5e80ec" -"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" -"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" -"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" -"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" -"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" -"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" -"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" -"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" -"checksum paste 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab4fb1930692d1b6a9cfabdde3d06ea0a7d186518e2f4d67660d8970e2fa647a" -"checksum paste-impl 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "a62486e111e571b1e93b710b61e8f493c0013be39629b714cb166bdb06aa5a8a" -"checksum pkstl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "38b1a12c0fc296f2ea6b862fa77c9b97e02d82b0348988528478f14260b1f356" -"checksum proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" -"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" -"checksum pyo3 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7028df4086f1e488a6192932e86de604077ef6b06eac2b0f159a3082c7450c58" -"checksum pyo3-derive-backend 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4e3c7aaceb685d2560b7c3fc46c152464c181de2baf44e57119ce43d712d1b64" -"checksum pyo3cls 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053d66146897d823e8d228758fb0aefac18e8a3024585a1640dbbe885c1b07a1" -"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" -"checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" -"checksum ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" -"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -"checksum ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" -"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -"checksum serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" -"checksum serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" -"checksum serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)" = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" -"checksum smallvec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a" -"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" -"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" -"checksum unindent 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "63f18aa3b0e35fed5a0048f029558b1518095ffe2a0a31fb87c93dece93a4993" -"checksum untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" -"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" -"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" -"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" -"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" -"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" -"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" -"checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 7e77fcf312c486192eaffc35d4dc6011715076c2..83b570c8fe1ff830a771aef02297ee1e48f4c453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,14 +10,17 @@ readme = "README.md" keywords = ["python","security"] edition = "2018" +[profile.release] +codegen-units = 1 + [lib] name = "py_pkstl" crate-type = ["cdylib"] [dependencies] pkstl = "0.1.0" -ring = "0.16.9" +ring = "0.16.15" [dependencies.pyo3] -version = "0.9.2" +version = "0.12.1" features = ["extension-module"] diff --git a/src/lib.rs b/src/lib.rs index 2962cdde1505085e0f8ddd81802652b688554578..a24c8e579d4850ec0fc18452c69bf382f18f4485 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,306 +1,306 @@ extern crate pkstl; -use std::io::BufWriter; +use pyo3::exceptions::*; use pyo3::prelude::*; use pyo3::types::*; -use pyo3::exceptions::*; use ring::signature::KeyPair; +use std::io::BufWriter; #[pyclass] struct Ed25519KeyPair { - inner: ring::signature::Ed25519KeyPair + inner: ring::signature::Ed25519KeyPair, } #[pymethods] impl Ed25519KeyPair { - - /// Instantiate key pair from seed - /// Arguments: - /// - seed: bytes (length=32) - /// Returns: Ed255KeyPair - #[staticmethod] - fn from_seed_unchecked(seed: Py<PyBytes>) -> PyResult<Ed25519KeyPair> { - let gil = Python::acquire_gil(); - let py = gil.python(); - match ring::signature::Ed25519KeyPair::from_seed_unchecked(seed.as_ref(py).as_bytes()) { - Ok(val) => Ok(Ed25519KeyPair { inner: val }), - Err(_) => Err(ValueError::py_err("Error")) - } - } - - /// Public key - #[getter] - fn get_pubkey(&self) -> PyResult<PyObject> { - let gil = Python::acquire_gil(); - let py = gil.python(); - Ok(PyBytes::new(py, self.inner.public_key().as_ref()).to_object(py)) - } + /// Instantiate key pair from seed + /// Arguments: + /// - seed: bytes (length=32) + /// Returns: Ed255KeyPair + #[staticmethod] + fn from_seed_unchecked(seed: Py<PyBytes>) -> PyResult<Ed25519KeyPair> { + let gil = Python::acquire_gil(); + let py = gil.python(); + match ring::signature::Ed25519KeyPair::from_seed_unchecked(seed.as_ref(py).as_bytes()) { + Ok(val) => Ok(Ed25519KeyPair { inner: val }), + Err(_) => Err(PyValueError::new_err("Error")), + } + } + + /// Public key + #[getter] + fn get_pubkey(&self) -> PyResult<PyObject> { + let gil = Python::acquire_gil(); + let py = gil.python(); + Ok(PyBytes::new(py, self.inner.public_key().as_ref()).to_object(py)) + } } #[pyclass] struct Seed32 { - inner: pkstl::Seed32 + inner: pkstl::Seed32, } #[pymethods] impl Seed32 { - - /// Create random seed - /// Returns: Seed32 - #[staticmethod] - fn random() -> PyResult<Seed32> { - Ok(Seed32 { inner: pkstl::Seed32::random() }) - } - - /// Seed bytes - #[getter] - fn get_bytes(&self) -> PyResult<PyObject> { - let gil = Python::acquire_gil(); - let py = gil.python(); - Ok(PyBytes::new(py, self.inner.as_ref()).to_object(py)) - } + /// Create random seed + /// Returns: Seed32 + #[staticmethod] + fn random() -> PyResult<Seed32> { + Ok(Seed32 { + inner: pkstl::Seed32::random(), + }) + } + + /// Seed bytes + #[getter] + fn get_bytes(&self) -> PyResult<PyObject> { + let gil = Python::acquire_gil(); + let py = gil.python(); + Ok(PyBytes::new(py, self.inner.as_ref()).to_object(py)) + } } #[pyclass] struct SecureLayerConfig { - inner: pkstl::SecureLayerConfig + inner: pkstl::SecureLayerConfig, } #[pymethods] impl SecureLayerConfig { - - /// Instantiate SecureLayerConfig with default attributes - /// Returns: SecureLayerConfig - #[staticmethod] - fn default() -> PyResult<SecureLayerConfig> { - Ok(SecureLayerConfig { inner: pkstl::SecureLayerConfig::default() }) - } + /// Instantiate SecureLayerConfig with default attributes + /// Returns: SecureLayerConfig + #[staticmethod] + fn default() -> PyResult<SecureLayerConfig> { + Ok(SecureLayerConfig { + inner: pkstl::SecureLayerConfig::default(), + }) + } } #[pyclass] struct MinimalSecureLayer { - inner: pkstl::MinimalSecureLayer + inner: pkstl::MinimalSecureLayer, } #[pymethods] impl MinimalSecureLayer { - - /// Instantiate MinimalSecureLayer - /// Arguments: - /// - config: SecureLayerConfig - /// - expected_remote_sig_public_key: bytes (optional) - /// Returns: MinimalSecureLayer - #[staticmethod] - fn create(config: &SecureLayerConfig, expected_remote_sig_public_key: Option<Py<PyBytes>>) -> PyResult<MinimalSecureLayer> { - let gil = Python::acquire_gil(); - let py = gil.python(); - match pkstl::MinimalSecureLayer::create( - config.inner, - match expected_remote_sig_public_key { - Some(val) => Some(val.as_ref(py).as_bytes().to_vec()), - None => None - } - ) { - Ok(minimal_secure_layer) => Ok(MinimalSecureLayer { inner: minimal_secure_layer }), - Err(_) => Err(ValueError::py_err("Error")) - } - } + /// Instantiate MinimalSecureLayer + /// Arguments: + /// - config: SecureLayerConfig + /// - expected_remote_sig_public_key: bytes (optional) + /// Returns: MinimalSecureLayer + #[staticmethod] + fn create( + config: &SecureLayerConfig, + expected_remote_sig_public_key: Option<Py<PyBytes>>, + ) -> PyResult<MinimalSecureLayer> { + let gil = Python::acquire_gil(); + let py = gil.python(); + match pkstl::MinimalSecureLayer::create( + config.inner, + match expected_remote_sig_public_key { + Some(val) => Some(val.as_ref(py).as_bytes().to_vec()), + None => None, + }, + ) { + Ok(minimal_secure_layer) => Ok(MinimalSecureLayer { + inner: minimal_secure_layer, + }), + Err(_) => Err(PyValueError::new_err("Error")), + } + } } #[pyclass] struct IncomingBinaryMessage { - inner: pkstl::IncomingBinaryMessage + inner: pkstl::IncomingBinaryMessage, } #[pymethods] impl IncomingBinaryMessage { - - /// Message type - /// 1=Connect; 2=Ack; 3=Message - #[getter] - fn get_msg_type(&self) -> PyResult<u8> { - Ok(match self.inner { - pkstl::IncomingBinaryMessage::Connect{..} => 1, - pkstl::IncomingBinaryMessage::Ack{..} => 2, - pkstl::IncomingBinaryMessage::Message{..} => 3, - }) - } - - /// Message data - /// If msg_type=Connect: [data, pubkey] - /// Else: [data] - #[getter] - fn get_data(&self) -> PyResult<Vec<PyObject>> { - let gil = Python::acquire_gil(); - let py = gil.python(); - match &self.inner { - pkstl::IncomingBinaryMessage::Connect{custom_datas, peer_sig_public_key} => match custom_datas { - Some(val) => Ok(vec![ - PyBytes::new(py, val.as_slice()).to_object(py), - PyBytes::new(py, peer_sig_public_key.as_slice()).to_object(py) - ]), - None => Err(ValueError::py_err("Error")) - }, - pkstl::IncomingBinaryMessage::Ack{custom_datas} => match custom_datas { - Some(val) => Ok(vec![PyBytes::new(py, val.as_slice()).to_object(py)]), - None => Err(ValueError::py_err("Error")) - }, - pkstl::IncomingBinaryMessage::Message{datas} => match datas { - Some(val) => Ok(vec![PyBytes::new(py, val.as_slice()).to_object(py)]), - None => Err(ValueError::py_err("Error")) - } - } - } + /// Message type + /// 1=Connect; 2=Ack; 3=Message + #[getter] + fn get_msg_type(&self) -> PyResult<u8> { + Ok(match self.inner { + pkstl::IncomingBinaryMessage::Connect { .. } => 1, + pkstl::IncomingBinaryMessage::Ack { .. } => 2, + pkstl::IncomingBinaryMessage::Message { .. } => 3, + }) + } + + /// Message data + /// If msg_type=Connect: [data, pubkey] + /// Else: [data] + #[getter] + fn get_data(&self) -> PyResult<Vec<PyObject>> { + let gil = Python::acquire_gil(); + let py = gil.python(); + match &self.inner { + pkstl::IncomingBinaryMessage::Connect { + custom_datas, + peer_sig_public_key, + } => match custom_datas { + Some(val) => Ok(vec![ + PyBytes::new(py, val.as_slice()).to_object(py), + PyBytes::new(py, peer_sig_public_key.as_slice()).to_object(py), + ]), + None => Err(PyValueError::new_err("Error")), + }, + pkstl::IncomingBinaryMessage::Ack { custom_datas } => match custom_datas { + Some(val) => Ok(vec![PyBytes::new(py, val.as_slice()).to_object(py)]), + None => Err(PyValueError::new_err("Error")), + }, + pkstl::IncomingBinaryMessage::Message { datas } => match datas { + Some(val) => Ok(vec![PyBytes::new(py, val.as_slice()).to_object(py)]), + None => Err(PyValueError::new_err("Error")), + }, + } + } } #[pyclass] struct SecureLayer { - inner: pkstl::SecureLayer + inner: pkstl::SecureLayer, } #[pymethods] impl SecureLayer { - - /// Instanciate SecureLayer - /// Arguments: - /// - config: SecureLayerConfig - /// - sig_key_pair_seed: Seed32 (optional) - /// - expected_remote_sig_public_key: bytes (optional) - /// Returns: SecureLayer - #[staticmethod] - fn create( - config: &SecureLayerConfig, - sig_key_pair_seed: Option<&Seed32>, - expected_remote_sig_public_key: Option<Py<PyBytes>> - ) -> PyResult<SecureLayer> - { - let gil = Python::acquire_gil(); + /// Instanciate SecureLayer + /// Arguments: + /// - config: SecureLayerConfig + /// - sig_key_pair_seed: Seed32 (optional) + /// - expected_remote_sig_public_key: bytes (optional) + /// Returns: SecureLayer + #[staticmethod] + fn create( + config: &SecureLayerConfig, + sig_key_pair_seed: Option<&Seed32>, + expected_remote_sig_public_key: Option<Py<PyBytes>>, + ) -> PyResult<SecureLayer> { + let gil = Python::acquire_gil(); let py = gil.python(); - match pkstl::SecureLayer::create( - config.inner, - match sig_key_pair_seed { - Some(val) => Some(val.inner.clone()), - None => None - }, - match expected_remote_sig_public_key { - Some(val) => Some(val.as_ref(py).as_bytes().to_vec()), - None => None - } - ) { - Ok(secure_layer) => Ok(SecureLayer { inner: secure_layer }), - Err(_) => Err(ValueError::py_err("Error")) - } - } - - /// Write message `Connect` - /// Arguments: - /// - custom_data: bytes (optional) - /// Returns: bytes - fn write_connect_msg_bin(&mut self, custom_data: Option<Py<PyBytes>>) -> PyResult<PyObject> { - let gil = Python::acquire_gil(); - let py = gil.python(); - let mut channel = BufWriter::new(Vec::with_capacity(1_024)); - - match custom_data { - Some(val) => - match self.inner.write_connect_msg_bin( - Some(val.as_ref(py).as_bytes()), - &mut channel - ) { - Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), - Err(_) => Err(ValueError::py_err("Error")) - }, - None => - match self.inner.write_connect_msg_bin( - None, - &mut channel - ) { - Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), - Err(_) => Err(ValueError::py_err("Error")) - } - } - } - - /// Write message `Ack` - /// Arguments: - /// - custom_data: bytes (optional) - /// Returns: bytes - fn write_ack_msg_bin(&mut self, custom_data: Option<Py<PyBytes>>) -> PyResult<PyObject> { - let gil = Python::acquire_gil(); - let py = gil.python(); - let mut channel = BufWriter::new(Vec::with_capacity(1_024)); - - match custom_data { - Some(val) => - match self.inner.write_ack_msg_bin( - Some(val.as_ref(py).as_bytes()), - &mut channel - ) { - Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), - Err(_) => Err(ValueError::py_err("Error")) - }, - None => - match self.inner.write_ack_msg_bin( - None, - &mut channel - ) { - Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), - Err(_) => Err(ValueError::py_err("Error")) - } - } - } - - /// Write - /// Arguments: - /// - data: bytes - /// Returns: bytes - fn write_bin(&mut self, data: Py<PyBytes>) -> PyResult<PyObject> { - let gil = Python::acquire_gil(); - let py = gil.python(); - let mut channel = BufWriter::new(Vec::with_capacity(1_024)); - - match self.inner.write_bin( - data.as_ref(py).as_bytes(), - &mut channel - ) { - Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), - Err(_) => Err(ValueError::py_err("Error")) - } - } - - /// Read binary messages - /// Arguments: - /// - incoming_data: bytes - /// Returns: [IncomingBinaryMessage] - fn read_bin(&mut self, incoming_data: Py<PyBytes>) -> PyResult<Vec<IncomingBinaryMessage>> { - let gil = Python::acquire_gil(); - let py = gil.python(); - let val = self.inner.read_bin(incoming_data.as_ref(py).as_bytes()); - match val { - Ok(val) => Ok(val.into_iter().map(|x| IncomingBinaryMessage { inner: x }).collect()), - Err(_) => Err(ValueError::py_err("Error")) - } - } - - /// Set config - /// Arguments: - /// - new_config: SecureLayerConfig - fn change_config(&mut self, new_config: &SecureLayerConfig) -> PyResult<()> { - match self.inner.change_config(new_config.inner) { - Ok(_) => Ok(()), - Err(_) => Err(ValueError::py_err("Error")) - } - } + match pkstl::SecureLayer::create( + config.inner, + match sig_key_pair_seed { + Some(val) => Some(val.inner.clone()), + None => None, + }, + match expected_remote_sig_public_key { + Some(val) => Some(val.as_ref(py).as_bytes().to_vec()), + None => None, + }, + ) { + Ok(secure_layer) => Ok(SecureLayer { + inner: secure_layer, + }), + Err(_) => Err(PyValueError::new_err("Error")), + } + } + + /// Write message `Connect` + /// Arguments: + /// - custom_data: bytes (optional) + /// Returns: bytes + fn write_connect_msg_bin(&mut self, custom_data: Option<Py<PyBytes>>) -> PyResult<PyObject> { + let gil = Python::acquire_gil(); + let py = gil.python(); + let mut channel = BufWriter::new(Vec::with_capacity(1_024)); + + match custom_data { + Some(val) => match self + .inner + .write_connect_msg_bin(Some(val.as_ref(py).as_bytes()), &mut channel) + { + Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), + Err(_) => Err(PyValueError::new_err("Error")), + }, + None => match self.inner.write_connect_msg_bin(None, &mut channel) { + Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), + Err(_) => Err(PyValueError::new_err("Error")), + }, + } + } + + /// Write message `Ack` + /// Arguments: + /// - custom_data: bytes (optional) + /// Returns: bytes + fn write_ack_msg_bin(&mut self, custom_data: Option<Py<PyBytes>>) -> PyResult<PyObject> { + let gil = Python::acquire_gil(); + let py = gil.python(); + let mut channel = BufWriter::new(Vec::with_capacity(1_024)); + + match custom_data { + Some(val) => match self + .inner + .write_ack_msg_bin(Some(val.as_ref(py).as_bytes()), &mut channel) + { + Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), + Err(_) => Err(PyValueError::new_err("Error")), + }, + None => match self.inner.write_ack_msg_bin(None, &mut channel) { + Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), + Err(_) => Err(PyValueError::new_err("Error")), + }, + } + } + + /// Write + /// Arguments: + /// - data: bytes + /// Returns: bytes + fn write_bin(&mut self, data: Py<PyBytes>) -> PyResult<PyObject> { + let gil = Python::acquire_gil(); + let py = gil.python(); + let mut channel = BufWriter::new(Vec::with_capacity(1_024)); + + match self + .inner + .write_bin(data.as_ref(py).as_bytes(), &mut channel) + { + Ok(_) => Ok(PyBytes::new(py, channel.buffer()).to_object(py)), + Err(_) => Err(PyValueError::new_err("Error")), + } + } + + /// Read binary messages + /// Arguments: + /// - incoming_data: bytes + /// Returns: [IncomingBinaryMessage] + fn read_bin(&mut self, incoming_data: Py<PyBytes>) -> PyResult<Vec<IncomingBinaryMessage>> { + let gil = Python::acquire_gil(); + let py = gil.python(); + let val = self.inner.read_bin(incoming_data.as_ref(py).as_bytes()); + match val { + Ok(val) => Ok(val + .into_iter() + .map(|x| IncomingBinaryMessage { inner: x }) + .collect()), + Err(_) => Err(PyValueError::new_err("Error")), + } + } + + /// Set config + /// Arguments: + /// - new_config: SecureLayerConfig + fn change_config(&mut self, new_config: &SecureLayerConfig) -> PyResult<()> { + match self.inner.change_config(new_config.inner) { + Ok(_) => Ok(()), + Err(_) => Err(PyValueError::new_err("Error")), + } + } } #[pymodule] fn libpkstl(_py: Python<'_>, m: &PyModule) -> PyResult<()> { - m.add_class::<Ed25519KeyPair>()?; - m.add_class::<Seed32>()?; - m.add_class::<SecureLayerConfig>()?; - m.add_class::<MinimalSecureLayer>()?; - m.add_class::<IncomingBinaryMessage>()?; - m.add_class::<SecureLayer>()?; - - Ok(()) + m.add_class::<Ed25519KeyPair>()?; + m.add_class::<Seed32>()?; + m.add_class::<SecureLayerConfig>()?; + m.add_class::<MinimalSecureLayer>()?; + m.add_class::<IncomingBinaryMessage>()?; + m.add_class::<SecureLayer>()?; + + Ok(()) }