diff --git a/.gitignore b/.gitignore index fcca1e40..0c4f19f2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ pkg/ result target/ worker/ +.cargo/ diff --git a/Cargo.lock b/Cargo.lock index 77d99f74..bb7fe621 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,9 +228,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blake2-rfc" @@ -285,9 +285,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.5.1" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -329,9 +329,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.99" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "907d8581360765417f8f2e0e7d602733bbed60156b4465b7617243689ef9b83d" [[package]] name = "cfg-if" @@ -348,7 +348,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -469,16 +469,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -492,7 +491,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -528,7 +527,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -552,13 +551,13 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -601,9 +600,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "env_logger" @@ -653,7 +652,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "synstructure 0.12.6", + "synstructure", ] [[package]] @@ -773,7 +772,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -919,9 +918,13 @@ dependencies = [ "blake2b_simd", "ed25519-dalek", "failure", + "hc_seed_bundle", "lazy_static", "rand 0.6.5", "serde", + "serde_json", + "sodoken", + "tokio", "url", ] @@ -980,6 +983,7 @@ dependencies = [ name = "hpos-config-seed-bundle-explorer" version = "0.2.1" dependencies = [ + "base36", "base64 0.13.1", "ed25519-dalek", "hc_seed_bundle", @@ -1007,9 +1011,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0e7a4dd27b9476dc40cb050d3632d3bba3a70ddbff012285f7f8559a1e7e545" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1046,124 +1050,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "id-arena" version = "2.2.1" @@ -1175,14 +1061,12 @@ dependencies = [ [[package]] name = "idna" -version = "1.0.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "icu_normalizer", - "icu_properties", - "smallvec", - "utf8_iter", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -1222,9 +1106,9 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "leb128" @@ -1285,12 +1169,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" - [[package]] name = "lock_api" version = "0.4.12" @@ -1309,9 +1187,9 @@ checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" @@ -1327,9 +1205,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -1343,9 +1221,9 @@ checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -1421,9 +1299,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] @@ -1472,7 +1350,7 @@ dependencies = [ "libc", "redox_syscall 0.5.2", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1515,12 +1393,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - [[package]] name = "powerfmt" version = "0.2.0" @@ -1559,9 +1431,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1762,7 +1634,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -1892,7 +1764,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -1901,11 +1773,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" dependencies = [ "log", + "once_cell", "ring", "rustls-pki-types", "rustls-webpki", @@ -1921,9 +1794,9 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" dependencies = [ "ring", "rustls-pki-types", @@ -1956,38 +1829,38 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.14" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "indexmap 2.2.6", "itoa", @@ -2149,9 +2022,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2166,9 +2039,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" dependencies = [ "proc-macro2", "quote", @@ -2187,17 +2060,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "tar" version = "0.4.41" @@ -2241,22 +2103,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -2302,15 +2164,20 @@ dependencies = [ ] [[package]] -name = "tinystr" -version = "0.7.6" +name = "tinyvec" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ - "displaydoc", - "zerovec", + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.38.0" @@ -2338,7 +2205,7 @@ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", ] [[package]] @@ -2365,12 +2232,27 @@ dependencies = [ "version_check", ] +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.11.0" @@ -2397,9 +2279,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.7" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd" +checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" dependencies = [ "base64 0.22.1", "brotli-decompressor", @@ -2408,34 +2290,21 @@ dependencies = [ "once_cell", "rustls", "rustls-pki-types", - "rustls-webpki", "url", "webpki-roots", ] [[package]] name = "url" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "vcpkg" version = "0.2.15" @@ -2512,7 +2381,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", "wasm-bindgen-shared", ] @@ -2586,7 +2455,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.71", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2657,9 +2526,9 @@ checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" [[package]] name = "webpki-roots" -version = "0.26.2" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c452ad30530b54a4d8e71952716a212b08efd0f3562baa66c29a618b07da7c3" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] @@ -2701,7 +2570,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2719,7 +2588,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2739,18 +2608,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2761,9 +2630,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2773,9 +2642,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2785,15 +2654,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2803,9 +2672,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2815,9 +2684,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2827,9 +2696,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2839,21 +2708,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "write16" -version = "1.0.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "xattr" @@ -2866,69 +2723,24 @@ dependencies = [ "rustix", ] -[[package]] -name = "yoke" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", - "synstructure 0.13.1", -] - [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "zerofrom" -version = "0.1.4" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", - "synstructure 0.13.1", + "syn 2.0.71", ] [[package]] @@ -2937,28 +2749,6 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -[[package]] -name = "zerovec" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "zip" version = "2.1.3" diff --git a/Cargo.toml b/Cargo.toml index b6c19d71..c4d7d390 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,8 @@ members = [ "is-valid" ] +resolver = "2" + [workspace.dependencies] ed25519-dalek = "2.1.1" anyhow = "1.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index 35c577f7..772ba260 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -28,3 +28,9 @@ rev = "28e765e4369e19bc0126bb46acaacadf1303de22" [features] wasm-bindgen = ["rand/wasm-bindgen"] + +[dev-dependencies] +tokio = { version = "1.12.0", features = [ "full" ] } +hc_seed_bundle = "0.2.3" +sodoken = "=0.0.11" +serde_json = "1.0.117" \ No newline at end of file diff --git a/core/src/config.rs b/core/src/config.rs index 2ebed2e5..9a9d0305 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -1,8 +1,9 @@ use arrayref::array_ref; use ed25519_dalek::{Digest, Sha512, SigningKey, VerifyingKey}; use failure::Error; -use rand::{rngs::OsRng, Rng}; use serde::*; + +use crate::public_key; pub const SEED_SIZE: usize = 32; fn public_key_from_base64<'de, D>(deserializer: D) -> Result @@ -76,35 +77,35 @@ pub enum Config { /// The pub-key in settings is the holoport key that is used for verifying login signatures settings: Settings, }, + #[serde(rename = "v3")] + V3 { + /// This is the Device Seed Bundle as a base64 string which is compatible with lair-keystore >=v0.0.8 + /// And is encoded with a password that will be needed to be used to decrypt it + device_bundle: String, + /// Derivation path of the seed in this config that was generated for a Master Seed + device_derivation_path: String, + // The revocation key is usually the /0 derivation path of the master seed + #[serde( + deserialize_with = "public_key_from_base64", + serialize_with = "to_base64" + )] + revocation_pub_key: VerifyingKey, + // /1 derivation path of the device bundle base36 encoded + holoport_id: String, + /// Holo registration code is used to identify and authenticate its users + registration_code: String, + /// The pub-key in settings is the holoport key that is used for verifying login signatures + settings: Settings, + }, } impl Config { pub fn new( - email: String, - password: String, - maybe_seed: Option, - ) -> Result<(Self, VerifyingKey), Error> { - let (seed, admin_keypair, holochain_public_key) = - generate_keypair(email.clone(), password, maybe_seed)?; - let admin = Admin { - email, - public_key: admin_keypair.verifying_key(), - }; - - Ok(( - Config::V1 { - seed, - settings: Settings { admin }, - }, - holochain_public_key, - )) - } - - pub fn new_v2( email: String, password: String, registration_code: String, - derivation_path: String, + revocation_pub_key: VerifyingKey, + device_derivation_path: String, device_bundle: String, device_pub_key: VerifyingKey, ) -> Result<(Self, VerifyingKey), Error> { @@ -113,10 +114,13 @@ impl Config { email, public_key: admin_keypair.verifying_key(), }; + let holoport_id = public_key::to_base36_id(&device_pub_key); Ok(( - Config::V2 { + Config::V3 { device_bundle, - derivation_path, + device_derivation_path, + revocation_pub_key, + holoport_id, registration_code, settings: Settings { admin }, }, @@ -126,26 +130,27 @@ impl Config { pub fn admin_public_key(&self) -> VerifyingKey { match self { - Config::V1 { settings, .. } | Config::V2 { settings, .. } => settings.admin.public_key, + Config::V1 { settings, .. } + | Config::V2 { settings, .. } + | Config::V3 { settings, .. } => settings.admin.public_key, } } } -fn generate_keypair( - email: String, - password: String, - maybe_seed: Option, -) -> Result<(Seed, SigningKey, VerifyingKey), Error> { - let master_seed = match maybe_seed { - None => OsRng::new()?.gen::(), - Some(s) => s, - }; - let master_secret_key = SigningKey::from_bytes(&master_seed); - let master_public_key = VerifyingKey::from(&master_secret_key); - - let admin_keypair = admin_keypair_from(master_public_key, &email, &password)?; - Ok((master_seed, admin_keypair, master_public_key)) -} +// fn generate_keypair( +// email: String, +// password: String, +// maybe_seed: Option, +// ) -> Result<(Seed, Keypair, VerifyingKey), Error> { +// let master_seed = match maybe_seed { +// None => OsRng::new()?.gen::(), +// Some(s) => s, +// }; +// let master_secret_key = SecretKey::from_bytes(&master_seed)?; +// let master_public_key = VerifyingKey::from(&master_secret_key); +// let admin_keypair = admin_keypair_from(master_public_key, &email, &password)?; +// Ok((master_seed, admin_keypair, master_public_key)) +// } pub fn admin_keypair_from( holochain_public_key: VerifyingKey, diff --git a/core/tests/configuration.rs b/core/tests/configuration.rs new file mode 100644 index 00000000..09eb1016 --- /dev/null +++ b/core/tests/configuration.rs @@ -0,0 +1,78 @@ +#[cfg(test)] +mod tests { + + use ed25519_dalek::VerifyingKey; + use hpos_config_core::Config; + + #[tokio::test(flavor = "multi_thread")] + async fn test_hpos_config() -> Result<(), String> { + // emulate the UI + + let master = hc_seed_bundle::UnlockedSeedBundle::new_random() + .await + .unwrap(); + + let passphrase = sodoken::BufRead::from(b"test-passphrase".to_vec()); + let revocation_bundle = master.derive(0).await.unwrap(); + let revocation_pub_key = revocation_bundle.get_sign_pub_key().read_lock().to_vec(); + + let device_derivation_path = 2; + let device_bundle = master.derive(device_derivation_path).await.unwrap(); + let device_bundle_encoded_bytes = device_bundle + .lock() + .add_pwhash_cipher(passphrase) + .lock() + .await + .unwrap(); + let device_bundle_base64 = base64::encode(&device_bundle_encoded_bytes); + + // derive the holoport ID + + let holoport_id = device_bundle.derive(1).await.unwrap(); + + let holoport_id = holoport_id.get_sign_pub_key().read_lock().to_vec(); + + // initialize a new Config struct + let email = "joel@holo.host".to_string(); + let password = "password".to_string(); + let registration_code = "registration-code".to_string(); + let rev_key_bytes = revocation_pub_key[0..32].try_into().unwrap(); + let revocation_pub_key = VerifyingKey::from_bytes(&rev_key_bytes).unwrap(); + let holoport_id_bytes = holoport_id[0..32].try_into().unwrap(); + let holoport_id = VerifyingKey::from_bytes(&holoport_id_bytes).unwrap(); + let hpos_config = Config::new( + email.clone(), + password, + registration_code, + revocation_pub_key, + device_derivation_path.to_string(), + device_bundle_base64.clone(), + holoport_id, + ) + .unwrap(); + + assert_eq!(hpos_config.1, holoport_id.clone()); + + println!("{}", serde_json::to_string_pretty(&hpos_config.0).unwrap()); + + if let Config::V3 { + device_bundle, + device_derivation_path, + revocation_pub_key, + holoport_id, + registration_code, + settings, + } = hpos_config.0 + { + assert_eq!(device_bundle, device_bundle_base64,); + assert_eq!(device_derivation_path, device_derivation_path.to_string()); + assert_eq!(revocation_pub_key, revocation_pub_key); + assert_eq!(holoport_id, holoport_id); + assert_eq!(registration_code, registration_code); + assert_eq!(settings.admin.email, email); + return Ok(()); + } else { + return Err("Expected V3 variant".to_string()); + } + } +} diff --git a/default.nix b/default.nix deleted file mode 100644 index adbdcd11..00000000 --- a/default.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ pkgs ? import ./nixpkgs.nix {} }: - -with pkgs; - -let - inherit (rust.packages.stable) rustPlatform; - inherit (darwin.apple_sdk.frameworks) CoreServices Security; -in - -{ - hpos-config-gen-cli = buildRustPackage rustPlatform { - name = "hpos-config-gen-cli"; - src = gitignoreSource ./.; - cargoDir = "gen-cli"; - - buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - - doCheck = false; - }; - - hpos-config-gen-web = buildRustPackage rustPlatform rec { - name = "hpos-config-gen-web"; - src = gitignoreSource ./.; - cargoDir = "gen-web"; - - nativeBuildInputs = with buildPackages; [ - nodejs-12_x - pkgconfig - (wasm-pack.override { inherit rustPlatform; }) - ]; - - buildInputs = [ openssl ]; - - buildPhase = '' - cp -r ${npmToNix { src = "${src}/${cargoDir}"; }} node_modules - chmod -R +w node_modules - chmod +x node_modules/.bin/webpack - patchShebangs node_modules - - npm run build - ''; - - installPhase = '' - mv dist $out - ''; - - doCheck = false; - }; - - hpos-config-into-base36-id = buildRustPackage rustPlatform { - name = "hpos-config-into-base36-id"; - src = gitignoreSource ./.; - cargoDir = "into-base36-id"; - - buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - - doCheck = false; - }; - - hpos-config-is-valid = buildRustPackage rustPlatform { - name = "hpos-config-is-valid"; - src = gitignoreSource ./.; - cargoDir = "is-valid"; - - buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - - doCheck = false; - }; -} diff --git a/gen-cli/src/main.rs b/gen-cli/src/main.rs index fe642c11..71fe467e 100644 --- a/gen-cli/src/main.rs +++ b/gen-cli/src/main.rs @@ -28,6 +28,7 @@ struct Args { flag_email: String, flag_password: String, flag_registration_code: String, + flag_revocation_pub_key: VerifyingKey, flag_derivation_path: String, flag_device_bundle: String, flag_seed_from: Option, @@ -52,10 +53,11 @@ fn main() -> Result<(), Error> { let secret_key = SigningKey::from_bytes(&seed); - let (config, public_key) = Config::new_v2( + let (config, public_key) = Config::new( args.flag_email, args.flag_password, args.flag_registration_code, + args.flag_revocation_pub_key, args.flag_derivation_path, args.flag_device_bundle, VerifyingKey::from(&secret_key), diff --git a/gen-web/package.json b/gen-web/package.json index 6aee3e6f..4873f923 100644 --- a/gen-web/package.json +++ b/gen-web/package.json @@ -20,7 +20,7 @@ }, "dependencies": { "@babel/runtime": "^7.15.4", - "@holochain/hc-seed-bundle": "0.0.3", + "@holochain/hc-seed-bundle": "0.1.1", "core-js": "^3.18.3", "crypto-browserify": "^3.12.0", "file-saver": "^2.0.2", diff --git a/gen-web/res/index.html b/gen-web/res/index.html index d258ca71..7763780a 100644 --- a/gen-web/res/index.html +++ b/gen-web/res/index.html @@ -21,27 +21,12 @@ src="assets/images/holo-banner-white.svg" />

Time for Liftoff!

You’re all set!

-
+

Context: -

- A registration code can be used to register either one HoloPort or many HoloPorts during Quickstart. If you don’t have your registration code, please register at https://register.holo.host/holo -

-

- Your passphrase is an important thing to remember since it will decrypt your seed file—keep it somewhere very safe! -

-

- Remember, you will need BOTH the seed and your passphrase to restore any keys that are created from this seed. -

-

- Host Console is a web interface where you can manage your HoloPort and hosting settings. -

This is where your public and private keys for your HoloPorts are generated. The keys are the basis of the cryptography in Holochain and Holo. Your private key is stored on an encrypted keystore your HoloPort, and your public key is your address on the Holo network and the first part of your web address for reaching your HoloPort. We also call that your HoloPort ID.

-

- When you insert the USB drive into your HoloPort, it will begin connecting to the Holo network. -

- Connecting your HoloPort to the Holo network + Registering your HoloPort Step 1: Registration Code @@ -121,13 +106,13 @@

Step 2: Enter a passphrase - Step 3: Generate a seed file + Step 3: Generate your master seed file and revocation key Step 4: Create Host Console credentials - Step 5: Create your keys and save them + Step 5: Generate the HoloPort configuration file Step 6: Connect to the Holo Network @@ -139,12 +124,12 @@

If you do not have a registration code you need to begin at https://register.holo.host/holo. Otherwise, click the “next” button and enter the registration code you received in your email.

Enter your email address and the registration code you received.

-

Make your passphrase as strong as possible. It should be long, include a mix of many different types of characters, and be hard to guess.

+

Make your passphrase as strong as possible. It should be long, include a mix of many different types of characters, and be hard to guess. Save it somewhere safe.

You can optionally turn off your internet while doing this for added security.

-

Click the button below to generate and save your seed file. You will need to save it to your hard drive or to a USB drive that is NOT the same USB drive used for your HoloPort.

-

Create a Host Console password for your primary HoloPort.

-

Click the button below to download the configuration file, and then move the file to the HoloPort USB drive. The filename must be for your HoloPort to read it.

-

Safely eject the USB from your computer, power on your HoloPort, and insert the USB into the associated HoloPort when the LED light is solid blue.

+

Click the button below to generate and save your master seed file and revocation key. You will need to save it to your hard drive or to a USB drive that is NOT the same USB drive used for your HoloPort.

+

Host Console is where you can manage your HoloPort and hosting settings. Create a Host Console password for your HoloPort.

+

Click the button below to download the configuration file that contains your device seed, and then move the file to the HoloPort USB drive. The filename must be for your HoloPort to read it.

+

Safely eject the USB from your computer, power on your HoloPort, and insert the USB into the associated HoloPort when the LED light is solid blue. Your HoloPort is now connecting to the Holo network.

Do you have additional HoloPorts that you’d like to register at this time?

@@ -169,13 +154,12 @@

-

Tip: Write down or store your passphrase in a password manager.

@@ -211,7 +195,6 @@

-

Note: If you have an additional HoloPort to register, you must continue to the next page to add it.

@@ -281,32 +264,13 @@

Generating Your Keys

-
The next two steps are where you create and save your seed file, which is the basis of your identity.
-
It is super important for you to save the seed file and the passphrase you create here somewhere safe—and somewhere you will remember. It will be used in the future if you need to regenerate passwords or if you need to register additional HoloPorts. You can disconnect from the Internet now if you would like, and continue using Quickstart.
+
The next two steps are where you create and save your master seed file and revocation key. It is super important for you to save the downloaded file and the passphrase you create here somewhere safe. It will be used in the future if you need to regenerate passwords or if you need to register additional HoloPorts.
- - diff --git a/gen-web/res/style.css b/gen-web/res/style.css index d3498018..868b4100 100644 --- a/gen-web/res/style.css +++ b/gen-web/res/style.css @@ -579,6 +579,17 @@ body.step6 .image-block-item { align-items: self-end; } +.modal-body div.vert-buttons { + display: flex; + flex-direction: column; + width: 320px; + height: 105px; + justify-content: space-between; + align-items: center; + margin-top: 16px; + margin-bottom: 0px; +} + .lower-right { margin-top: auto; margin-left: auto; @@ -633,8 +644,14 @@ button { } .modal-button { - color: #5C4DA6; - border-color: #5C4DA6; + color: #313C59; + cursor: pointer; + text-decoration: underline; + font-size: 16px; + background-color: #ffffff; + width: 151px; + height: 42px; + box-sizing: border-box; } .action-button, @@ -895,7 +912,7 @@ a { display: flex; } -#modal-passphrase-intro, #modal-passphrase-outro, #change-seed-modal { +#modal-passphrase-intro, #change-seed-modal { display: none; } diff --git a/gen-web/src/index.js b/gen-web/src/index.js index d0e7b43c..09423103 100644 --- a/gen-web/src/index.js +++ b/gen-web/src/index.js @@ -11,9 +11,13 @@ validatePassphrae } = await import('./validation') const { genConfigFileName, toBase64 } = await import('./utils') const SEED_FILE_NAME = 'master-seed' + const REVOCATION_KEY_FILE_NAME = 'revocation-key' const MEMBRANE_PROOF_SERVICE_URL = process.env.MEMBRANE_PROOF_SERVICE_URL + const REVOCATION_KEY_DEVICE_NUMBER = 0 + const HOLO_PORT_STARTING_DEVICE_NUMBER = 1 + let stepTracker = 0 let signalKeyGen = false let resetUserConfig = false @@ -21,7 +25,8 @@ let downloadSeedTracker = false let configFileBlob = '' let master - let deviceNumber = 0 + let revocation + let deviceNumber = HOLO_PORT_STARTING_DEVICE_NUMBER let deviceID let genSeedStartingHtml let downloadStartingHtml @@ -61,7 +66,6 @@ passwordCheckInputArea: document.querySelector('#password-check-form-item'), formErrorMessage: document.querySelector('#form-error-message'), downloadFileName: document.querySelector('#download-file'), - currentHoloportDescriptor: document.querySelector('#current-holoport-descriptor') } const nextButtonLoaderColumn = document.querySelector('#next-button-loader-column') @@ -120,9 +124,7 @@ return } seedPassphrase = inputs.seedPassphrase.value - if (!await confirmPassphraseWritten()) { - return - } + updateUiStep(3) updateProgressBar(2) break @@ -176,7 +178,7 @@ /* Communicate visually that something is happening in the background */ buttons.genSeed.classList.add('disabled') buttons.genSeed.disabled = true - buttons.genSeed.innerHTML = 'Saving Seed File...' + buttons.genSeed.innerHTML = 'Saving Seed & Key Files...' setTimeout(async () => { try { @@ -187,16 +189,10 @@ master = hcSeedBundle.UnlockedSeedBundle.newRandom({ bundleType: 'master' }) - master.setAppData({ - generate_by: "quickstart-v2.0" - }) - // we need the passphrase as a Uint8Array + // we need the passphrase as a Uint8Array const pw = (new TextEncoder()).encode(seedPassphrase) - // clear passphrase from memory - seedPassphrase = null - const encodedBytes = master.lock([ new hcSeedBundle.SeedCipherPwHash( hcSeedBundle.parseSecret(pw), 'minimum') @@ -206,18 +202,52 @@ console.log("Created master seed: ", master.signPubKey) const seedBlob = new Blob([toBase64(encodedBytes)], { type: 'text/plain' }) + filesaver.saveAs(seedBlob, SEED_FILE_NAME) } catch (e) { throw new Error(`Error saving config. Error: ${e}`) } + }, 1000) + + setTimeout(async () => { + try { + // setup bundler + await hcSeedBundle.seedBundleReady + + // we need the passphrase as a Uint8Array + const pw = (new TextEncoder()).encode(seedPassphrase) + + // clear passphrase from memory + seedPassphrase = null + + revocation = master.derive(REVOCATION_KEY_DEVICE_NUMBER, { + bundleType: 'revocation' + }) + + const revocationBytes = revocation.lock([ + new hcSeedBundle.SeedCipherPwHash( + hcSeedBundle.parseSecret(pw), 'minimum') + ]) + + // DEV MODE - check pub key for devices: + console.log("Created revocation seed: ", revocation.signPubKey) + + const revocationBlob = new Blob([toBase64(revocationBytes)], { type: 'text/plain' }) + + filesaver.saveAs(revocationBlob, REVOCATION_KEY_FILE_NAME) + + } catch (e) { + throw new Error(`Error saving revocation key. Error: ${e}`) + } + /* Clean State */ downloadSeedTracker = true buttons.genSeed.disabled = true - buttons.genSeed.innerHTML = 'Saved Seed File' + buttons.genSeed.innerHTML = 'Saved Seed & Key Files' verifySeedDownloadComplete(downloadSeedTracker) - }, 1000) + }, 2000) }, download: async () => { /* Communicate visually that something is happening in the background */ @@ -226,7 +256,7 @@ setTimeout(() => { try { - filesaver.saveAs(configFileBlob, genConfigFileName(deviceNumber, deviceID)) + filesaver.saveAs(configFileBlob, genConfigFileName(deviceID)) } catch (e) { throw new Error(`Error saving config. Error: ${e}`) } @@ -281,9 +311,6 @@ showModalPassphraseIntro: () => { document.querySelector('#modal-passphrase-intro').style.display = 'block' }, - showModalPassphraseOutro: () => { - document.querySelector('#modal-passphrase-outro').style.display = 'block' - }, closePassphraseIntro: () => { document.querySelector('#modal-passphrase-intro').style.display = 'none' }, @@ -297,7 +324,7 @@ downloadSeedTracker = false configFileBlob = '' master = undefined - deviceNumber = 0 + deviceNumber = HOLO_PORT_STARTING_DEVICE_NUMBER deviceID = undefined updateProgressBar(3, rewind) updateUiStep(2) @@ -310,7 +337,6 @@ loop: () => { deviceNumber++ downloadConfigTracker = false - inlineVariables.currentHoloportDescriptor.innerHTML = 'additional' updateProgressBar(6, true) updateProgressBar(5, true) updateUiStep(4) @@ -416,11 +442,11 @@ verifySeedDownloadComplete() } else if (stepTracker === 4) { inlineVariables.emailReadOnly.value = inputs.email.value.toLowerCase() - if (deviceNumber > 0) { + if (deviceNumber > HOLO_PORT_STARTING_DEVICE_NUMBER) { buttons.prevStep.disabled = true } } else if (stepTracker === 5) { - inlineVariables.downloadFileName.innerHTML = genConfigFileName(deviceNumber, deviceID) + inlineVariables.downloadFileName.innerHTML = genConfigFileName(deviceID) verifyDownloadComplete() } } @@ -452,7 +478,7 @@ document.body.className = 'step1a' break case -1: - if (deviceNumber === 0) { + if (deviceNumber === HOLO_PORT_STARTING_DEVICE_NUMBER) { document.body.className = 'step-exit-single' } else { document.body.className = 'step-exit-multiple' @@ -495,21 +521,6 @@ } } - const confirmPassphraseWritten = async () => { - click.showModalPassphraseOutro() - - const confirmed = await new Promise(resolve => { - buttons.hasWrittenPassphrase.onclick = () => { - resolve(true) - } - buttons.hasNotWrittenPassphrase.onclick = () => { - resolve(false) - } - }) - document.querySelector('#modal-passphrase-outro').style.display = 'none' - return confirmed - } - // Verifies a registration code by contacting the Holo Membrane Proof Service. // Returns `true` if successful. Returns a string for user error feedback if applicable. Otherwise throws. // @@ -517,6 +528,7 @@ // with an invalid registration code. The purpose is simply to prevent users from wasting time setting up a // HoloPort with the wrong code. const verifyRegistrationCode = async ({ registration_code, email }) => { + const response = await fetch(`${MEMBRANE_PROOF_SERVICE_URL}/registration/api/v1/verify-registration-code`, { method: 'POST', @@ -564,10 +576,7 @@ const deviceRoot = master.derive(deviceNumber, { bundleType: 'deviceRoot' }) - deviceRoot.setAppData({ - device_number: deviceNumber, - generate_by: "quickstart-v2.0" - }) + // encrypts it with password: pass let pubKey = deviceRoot.signPubKey const pw = (new TextEncoder()).encode('pass') @@ -576,11 +585,6 @@ hcSeedBundle.parseSecret(pw), 'minimum') ]) - // DEV MODE - check pub key for devices: - console.log("Created from master seed: ", master.signPubKey) - console.log(`Device ${deviceNumber}: ${toBase64(encodedBytes)}`) - console.log(`Device signPubkey: ${pubKey}`) - // pass seed into the blob let seed = { derivationPath: deviceNumber, @@ -614,8 +618,20 @@ * @param {Object} seed {derivationPath, deviceRoot, pubKey} */ const generateBlob = (user, seed) => { - const configData = config(user.email, user.password, user.registrationCode, seed.derivationPath.toString(), seed.deviceRoot, seed.pubKey) - const configBlob = new Blob([configData.config], { type: 'application/json' }) + + let configBlob + let configData + + try { + const derivationPath = seed.derivationPath.toString() + + + configData = config(user.email, user.password, user.registrationCode, revocation.signPubKey, derivationPath, seed.deviceRoot, seed.pubKey) + configBlob = new Blob([configData.config], { type: 'application/json' }) + } catch (e) { + inlineVariables.formErrorMessage.innerHTML = errorMessages.generateConfig + throw new Error(`Error executing generateBlob with an error. Error: ${e}`) + } /* NB: Do not delete! Keep the below in case we decide to use the HoloPort url it is available right here */ // console.log('Optional HoloPort url : ', configData.url) diff --git a/gen-web/src/lib.rs b/gen-web/src/lib.rs index 719438f2..d4b8e498 100644 --- a/gen-web/src/lib.rs +++ b/gen-web/src/lib.rs @@ -1,5 +1,5 @@ use ed25519_dalek::VerifyingKey; -use failure::{format_err, Error}; +use failure::Error; use hpos_config_core::{public_key, Config}; use serde::*; use wasm_bindgen::prelude::*; @@ -16,22 +16,28 @@ fn config_raw( email: String, password: String, registration_code: String, + revocation_pub_key: Vec, derivation_path: String, device_bundle: String, - device_pub_key: String, + device_pub_key: Vec, ) -> Result { - let bytes: [u8; 32] = - match (base64::decode_config(device_pub_key, base64::URL_SAFE_NO_PAD)?)[0..32].try_into() { - Ok(b) => b, - Err(_) => return Err(format_err!("Device pub key is not 32 bytes in size")), - }; + let device_pub_key: VerifyingKey = VerifyingKey::from_bytes( + &device_pub_key + .try_into() + .expect("Expected a Vec of length 32"), + )?; - let device_pub_key: VerifyingKey = VerifyingKey::from_bytes(&bytes)?; + let revocation_pub_key = VerifyingKey::from_bytes( + &revocation_pub_key + .try_into() + .expect("Expected a Vec of length 32"), + )?; - let (config, public_key) = Config::new_v2( + let (config, public_key) = Config::new( email, password, registration_code, + revocation_pub_key, derivation_path, device_bundle, device_pub_key, @@ -51,14 +57,16 @@ pub fn config( email: String, password: String, registration_code: String, + revocation_pub_key: Vec, derivation_path: String, device_bundle: String, - device_pub_key: String, + device_pub_key: Vec, ) -> Result { match config_raw( email, password, registration_code, + revocation_pub_key, derivation_path, device_bundle, device_pub_key, diff --git a/gen-web/src/utils.js b/gen-web/src/utils.js index 4134b8f8..7702a04c 100644 --- a/gen-web/src/utils.js +++ b/gen-web/src/utils.js @@ -15,7 +15,7 @@ export const toBase64 = (encodedBytes) => { } -const FILE_PREFIX = "hp" +const FILE_PREFIX = "hp-config" const FILE_TYPE = ".json" /** @@ -23,10 +23,7 @@ const FILE_TYPE = ".json" * @param {number} deviceNumber * @param {string} pubKey */ -export const genConfigFileName = (deviceNumber, pubKey) => { - if (deviceNumber == 0) { - return `${FILE_PREFIX}-primary-${pubKey.substring(0, 5)}${FILE_TYPE}` - } else { - return `${FILE_PREFIX}-secondary-${pubKey.substring(0, 5)}${FILE_TYPE}` - } +export const genConfigFileName = (pubKey) => { + return `${FILE_PREFIX}-${pubKey.substring(0, 5)}${FILE_TYPE}` + } \ No newline at end of file diff --git a/gen-web/yarn.lock b/gen-web/yarn.lock index aa8fde69..dba7465c 100644 --- a/gen-web/yarn.lock +++ b/gen-web/yarn.lock @@ -893,13 +893,18 @@ resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f" integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA== -"@holochain/hc-seed-bundle@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@holochain/hc-seed-bundle/-/hc-seed-bundle-0.0.3.tgz#34adaa8fcedf255eebdf29960b913e72cab35d69" - integrity sha512-cXLfbBMsqO1aQg/RBl66cOOhGZZObXeZ1sVhqBr1Ly/HPXoJDbQJ77BdSz/r8fn3fJE114ch8JK1ekrwAWLM3A== +"@holochain/hc-seed-bundle@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@holochain/hc-seed-bundle/-/hc-seed-bundle-0.1.1.tgz#b6fbfd0abaa2da7888ad7fdfaf54771d2423bb4f" + integrity sha512-ghHIndoNrhnzYCuN7THGVBHq5RnjNqypmjXK+LJYJ69W9tIAEuzPUymlHfK42sW4jh/LNQ83iqjVPHdJycjV1Q== dependencies: - libsodium-wrappers "^0.7.9" - tiny-msgpack "^1.0.2" + "@msgpack/msgpack" "^3.0.0-beta2" + libsodium-wrappers-sumo "^0.7.13" + +"@msgpack/msgpack@^3.0.0-beta2": + version "3.0.0-beta2" + resolved "https://registry.yarnpkg.com/@msgpack/msgpack/-/msgpack-3.0.0-beta2.tgz#5bccee30f84df220b33905e3d8249ba96deca0b7" + integrity sha512-y+l1PNV0XDyY8sM3YtuMLK5vE3/hkfId+Do8pLo/OPxfxuFAUwcGz3oiiUuV46/aBpwTzZ+mRWVMtlSKbradhw== "@types/eslint-scope@^3.7.0": version "3.7.3" @@ -3293,6 +3298,18 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +libsodium-sumo@^0.7.14: + version "0.7.14" + resolved "https://registry.yarnpkg.com/libsodium-sumo/-/libsodium-sumo-0.7.14.tgz#9a53e09944f092f603a1e1d4446414de0b3fb0fc" + integrity sha512-2nDge6qlAjcwyslAhWfVumlkeSNK5+WCfKa2/VEq9prvlT5vP2FR0m0o5hmKaYqfsZ4TQVj5czQsimZvXDB1CQ== + +libsodium-wrappers-sumo@^0.7.13: + version "0.7.14" + resolved "https://registry.yarnpkg.com/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.14.tgz#86301f14b37a77d847eb0396f2b83cdb1c47c480" + integrity sha512-0lm7ZwN5a95J2yUi8R1rgQeeaVDIWnvNzgVmXmZswis4mC+bQtbDrB+QpJlL4qklaKx3hVpJjoc6ubzJFiv64Q== + dependencies: + libsodium-sumo "^0.7.14" + libsodium-wrappers@^0.7.9: version "0.7.9" resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz#4ffc2b69b8f7c7c7c5594a93a4803f80f6d0f346" @@ -4800,11 +4817,6 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== -tiny-msgpack@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/tiny-msgpack/-/tiny-msgpack-1.0.2.tgz#78cb189e9d27b30de168284555548e298858edb3" - integrity sha1-eMsYnp0nsw3haChFVVSOKYhY7bM= - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" diff --git a/into-base36-id/src/main.rs b/into-base36-id/src/main.rs index 17e99061..cbcd1409 100644 --- a/into-base36-id/src/main.rs +++ b/into-base36-id/src/main.rs @@ -43,6 +43,9 @@ async fn main() -> Result<()> { ))?; println!("{}", public_key::to_base36_id(&secret.verifying_key())); } + Config::V3 { holoport_id, .. } => { + println!("{}", holoport_id); + } } Ok(()) diff --git a/is-valid/src/main.rs b/is-valid/src/main.rs index 3bd3e7c2..811fc087 100644 --- a/is-valid/src/main.rs +++ b/is-valid/src/main.rs @@ -6,5 +6,6 @@ fn main() -> Result<()> { match serde_json::from_reader(stdin())? { Config::V1 { .. } => Ok(()), Config::V2 { .. } => Ok(()), + Config::V3 { .. } => Ok(()), } } diff --git a/seed-bundle-explorer/Cargo.toml b/seed-bundle-explorer/Cargo.toml index ae3e5aa7..077cecb7 100644 --- a/seed-bundle-explorer/Cargo.toml +++ b/seed-bundle-explorer/Cargo.toml @@ -17,6 +17,8 @@ sodoken = "0.0.11" rmp-serde = "1.1.0" thiserror = "1.0" one_err = "0.0.8" +base36 = "0.0.1" [dev-dependencies] tokio = { workspace = true, features = [ "full" ] } +base64 = { workspace = true } diff --git a/seed-bundle-explorer/src/lib.rs b/seed-bundle-explorer/src/lib.rs index d66709cf..37eacba8 100644 --- a/seed-bundle-explorer/src/lib.rs +++ b/seed-bundle-explorer/src/lib.rs @@ -21,6 +21,20 @@ pub async fn holoport_public_key( let secret = unlock(device_bundle, passphrase).await?; Ok(secret.verifying_key()) } + Config::V3 { holoport_id, .. } => { + let value = match (base36::decode(&holoport_id) + .map_err(|err| SeedExplorerError::Generic(err.to_string()))?)[0..32] + .try_into() + { + Ok(b) => b, + Err(_) => { + return Err(SeedExplorerError::Generic( + "Holoport host public key is not 32 bytes in length".into(), + )) + } + }; + Ok(VerifyingKey::from_bytes(&value)?) + } } } @@ -31,7 +45,7 @@ pub async fn holoport_key( ) -> SeedExplorerResult { match config { Config::V1 { seed, .. } => Ok(SigningKey::from_bytes(seed)), - Config::V2 { device_bundle, .. } => { + Config::V2 { device_bundle, .. } | Config::V3 { device_bundle, .. } => { /* decode base64 string to locked device bundle password is pass for now @@ -52,12 +66,12 @@ pub async fn encoded_ed25519_keypair( let secret_key = SigningKey::from_bytes(seed); Ok(encrypt_key(&secret_key, &VerifyingKey::from(&secret_key))) } - Config::V2 { device_bundle, .. } => { + Config::V2 { device_bundle, .. } | Config::V3 { device_bundle, .. } => { /* decode base64 string to locked device bundle password is pass for now unlock it and get the signPubKey - Pass the Seed and PublicKey into `encrypt_key(seed, pubKey)` + Pass the Seed and VerifyingKey into `encrypt_key(seed, pubKey)` */ let secret = unlock(device_bundle, passphrase).await?; Ok(encrypt_key(&secret, &secret.verifying_key())) @@ -81,6 +95,7 @@ pub fn decoded_to_ed25519_keypair(blob: &String) -> SeedExplorerResult String { let mut encrypted_key = vec![ diff --git a/seed-bundle-explorer/tests/explorer.rs b/seed-bundle-explorer/tests/explorer.rs index ff80684e..d62dda30 100644 --- a/seed-bundle-explorer/tests/explorer.rs +++ b/seed-bundle-explorer/tests/explorer.rs @@ -20,10 +20,12 @@ mod tests { let registration_code: String = "registration-code".to_string(); let derivation_path: String = "1".to_string(); let device_bundle = "k6VoY3NiMJGWonB3xBCZ0R47aR6ctMScaYsrOLwRzSAAAcQY58NsOmNCDbniGsLgUhj5UoHjBrapiiDGxDGAa5Wqzm0pVuXGN106iyMHRk4dOf0iGWj65oCeB8-ZYXJdeflsVDY-DOuJaadfPZQExCyCrWRldmljZV9udW1iZXIAq2dlbmVyYXRlX2J5r3F1aWNrc3RhcnQtdjIuMA".to_string(); - let (config, _) = Config::new_v2( + let rev_key: [u8; 32] = [0 as u8; 32]; // TODO: Fill this in with something + let (config, _) = Config::new( email, password, registration_code, + VerifyingKey::from_bytes(&rev_key).unwrap(), derivation_path, device_bundle, get_mock_pub_key()?, diff --git a/seed-encoder/src/main.rs b/seed-encoder/src/main.rs index e2363a80..8b12e8ab 100644 --- a/seed-encoder/src/main.rs +++ b/seed-encoder/src/main.rs @@ -3,7 +3,7 @@ //! use anyhow::{Context, Result}; -use ed25519_dalek::SigningKey; +use ed25519_dalek::*; use hpos_config_core::*; use hpos_config_seed_bundle_explorer::{encrypt_key, unlock}; use std::path::PathBuf; @@ -46,6 +46,8 @@ async fn main() -> Result<()> { ))?; println!("{}", encrypt_key(&secret, &secret.verifying_key())); } + // todo!("V3 not implemented"), + Config::V3 { .. } => todo!("V3 not implemented"), } Ok(())