diff --git a/Cargo.lock b/Cargo.lock index 1e7b6b08c..1412b5470 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1460,7 +1460,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fdev" -version = "0.0.4" +version = "0.0.6" dependencies = [ "anyhow", "bincode", @@ -1479,7 +1479,7 @@ dependencies = [ "tar", "thiserror", "tokio", - "toml 0.8.0", + "toml 0.8.1", "tracing", "tracing-subscriber", "xz2", @@ -1531,13 +1531,12 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "pin-project", "spin 0.9.8", ] @@ -1558,7 +1557,7 @@ dependencies = [ [[package]] name = "freenet" -version = "0.0.4" +version = "0.0.6" dependencies = [ "anyhow", "arbitrary", @@ -1569,6 +1568,7 @@ dependencies = [ "bincode", "blake3", "bs58", + "byteorder", "bytes", "chacha20poly1305 0.10.1", "chrono", @@ -1599,6 +1599,7 @@ dependencies = [ "serde_with", "sqlx", "stretto", + "tar", "thiserror", "tokio", "tower-http", @@ -1608,11 +1609,14 @@ dependencies = [ "unsigned-varint", "uuid", "wasmer", + "xz2", ] [[package]] name = "freenet-macros" version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9fac5b43bee97b6ee49a376ca9e26eedf8bd581efcb176e4a534304f8b4279" dependencies = [ "proc-macro2", "quote", @@ -1621,7 +1625,9 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.0.5" +version = "0.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a408ccb448697333c9e3f8a935976c223db980d2fb6a076ae7c89851c6ed17a" dependencies = [ "arbitrary", "arrayvec", @@ -1635,23 +1641,19 @@ dependencies = [ "futures", "js-sys", "once_cell", - "rand", "semver", "serde", "serde-wasm-bindgen 0.6.0", "serde_bytes", "serde_json", "serde_with", - "tar", "thiserror", "tokio", "tokio-tungstenite", "tracing", "tracing-subscriber", "wasm-bindgen", - "wasmer", "web-sys", - "xz2", ] [[package]] @@ -2654,9 +2656,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.4" +version = "0.43.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0cf749abdc5ca1dce6296dc8ea0f012464dfcfd3ddd67ffc0cabd8241c4e1da" +checksum = "ab94183f8fc2325817835b57946deb44340c99362cd4606c0a5717299b2ba369" dependencies = [ "either", "fnv", @@ -4436,9 +4438,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -4602,9 +4604,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e58421b6bc416714d5115a2ca953718f6c621a51b68e4f4922aea5a4391a721" +checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" dependencies = [ "sqlx-core", "sqlx-macros", @@ -4615,9 +4617,9 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4cef4251aabbae751a3710927945901ee1d97ee96d757f6880ebb9a79bfd53" +checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" dependencies = [ "ahash 0.8.3", "atoi", @@ -4658,9 +4660,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208e3165167afd7f3881b16c1ef3f2af69fa75980897aac8874a0696516d12c2" +checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" dependencies = [ "proc-macro2", "quote", @@ -4671,9 +4673,9 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a4a8336d278c62231d87f24e8a7a74898156e34c1c18942857be2acb29c7dfc" +checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" dependencies = [ "dotenvy", "either", @@ -4696,9 +4698,9 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca69bf415b93b60b80dc8fda3cb4ef52b2336614d8da2de5456cc942a110482" +checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" dependencies = [ "atoi", "base64 0.21.4", @@ -4738,9 +4740,9 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0db2df1b8731c3651e204629dd55e52adbae0462fa1bdcbed56a2302c18181e" +checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" dependencies = [ "atoi", "base64 0.21.4", @@ -4777,9 +4779,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4c21bf34c7cae5b283efb3ac1bcc7670df7561124dc2f8bdc0b59be40f79a2" +checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" dependencies = [ "atoi", "flume", @@ -4951,18 +4953,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", @@ -5121,9 +5123,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c226a7bba6d859b63c92c4b4fe69c5b6b72d0cb897dbc8e6012298e6154cb56e" +checksum = "1bc1433177506450fe920e46a4f9812d0c211f5dd556da10e731a0a3dfa151f0" dependencies = [ "indexmap 2.0.0", "serde", @@ -5143,9 +5145,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff63e60a958cefbb518ae1fd6566af80d9d4be430a33f3723dfc47d1d411d95" +checksum = "ca676d9ba1a322c1b64eb8045a5ec5c0cfb0c9d08e15e9ff622589ad5221c8fe" dependencies = [ "indexmap 2.0.0", "serde", @@ -5661,9 +5663,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.33.1" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39de0723a53d3c8f54bed106cfbc0d06b3e4d945c5c5022115a61e3b29183ae" +checksum = "34180c89672b3e4825c3a8db4b61a674f1447afd5fe2445b2d22c3d8b6ea086c" dependencies = [ "leb128", ] @@ -5811,9 +5813,9 @@ dependencies = [ [[package]] name = "wast" -version = "65.0.1" +version = "65.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd8c1cbadf94a0b0d1071c581d3cfea1b7ed5192c79808dd15406e508dd0afb" +checksum = "a55a88724cf8c2c0ebbf32c8e8f4ac0d6aa7ba6d73a1cfd94b254aa8f894317e" dependencies = [ "leb128", "memchr", @@ -5823,9 +5825,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3209e35eeaf483714f4c6be93f4a03e69aad5f304e3fa66afa7cb90fe1c8051f" +checksum = "d83e1a8d86d008adc7bafa5cf4332d448699a08fcf2a715a71fbb75e2c5ca188" dependencies = [ "wast", ] diff --git a/Cargo.toml b/Cargo.toml index 518338449..3957663a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,8 @@ tracing = "0.1" tracing-subscriber = "0.3" wasmer = "4.2.0" -freenet-stdlib = "0.0.5" +# freenet-stdlib = { path = "./stdlib/rust/", version = "0.0.8" } +freenet-stdlib = { version = "0.0.7" } [profile.dev.package."*"] opt-level = 3 diff --git a/apps/freenet-email-app/Cargo.lock b/apps/freenet-email-app/Cargo.lock index 9336a3578..124fa2a08 100644 --- a/apps/freenet-email-app/Cargo.lock +++ b/apps/freenet-email-app/Cargo.lock @@ -131,9 +131,9 @@ dependencies = [ [[package]] name = "async-task" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" +checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" [[package]] name = "async-trait" @@ -172,9 +172,9 @@ dependencies = [ [[package]] name = "atomic-waker" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" @@ -267,17 +267,18 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" dependencies = [ "async-channel", "async-lock", "async-task", - "atomic-waker", - "fastrand", + "fastrand 2.0.1", + "futures-io", "futures-lite", - "log", + "piper", + "tracing", ] [[package]] @@ -448,15 +449,14 @@ dependencies = [ [[package]] name = "cocoa-foundation" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" dependencies = [ "bitflags", "block", "core-foundation", "core-graphics-types", - "foreign-types", "libc", "objc", ] @@ -479,9 +479,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] @@ -1042,6 +1042,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fdeflate" version = "0.3.0" @@ -1200,9 +1206,9 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.0.5" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb83503ad71922ceeaa56737c0a4a9da11520aaaf8ad6a89f43edb1154f02764" +checksum = "ebd193c150c4f7f9f44068ee7f5181d4c4374ceb1b37965e1edd968d3730f35a" dependencies = [ "arrayvec", "bincode", @@ -1294,7 +1300,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -2377,9 +2383,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "parking_lot" @@ -2510,6 +2516,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -2954,9 +2971,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" dependencies = [ "serde", ] @@ -3104,9 +3121,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3115,9 +3132,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3187,9 +3204,9 @@ dependencies = [ [[package]] name = "smallbox" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4679d6eef28b85020158619fc09769de89e90886c5de7157587d87cb72648faa" +checksum = "d92359f97e6b417da4328a970cf04a044db104fbd57f7d72cb7ff665bb8806af" [[package]] name = "smallvec" @@ -3454,18 +3471,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", @@ -3484,9 +3501,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa 1.0.9", @@ -3497,15 +3514,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -3562,9 +3579,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", @@ -3670,9 +3687,9 @@ dependencies = [ [[package]] name = "tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", "bytes", @@ -3782,9 +3799,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" diff --git a/apps/freenet-email-app/Cargo.toml b/apps/freenet-email-app/Cargo.toml index 70b6c3dd2..913d5fdee 100644 --- a/apps/freenet-email-app/Cargo.toml +++ b/apps/freenet-email-app/Cargo.toml @@ -20,5 +20,5 @@ serde = "1" serde_json = "1" once_cell = "1" -freenet-stdlib = { version = "0.0.5" } +freenet-stdlib = { version = "0.0.6" } freenet-aft-interface = { path = "../../modules/antiflood-tokens/interfaces" } diff --git a/apps/freenet-email-app/Makefile b/apps/freenet-email-app/Makefile index d92b27611..9bbc387d1 100644 --- a/apps/freenet-email-app/Makefile +++ b/apps/freenet-email-app/Makefile @@ -16,8 +16,11 @@ endif .PHONY: build clean +all: \ + $(MAKE) build-tool \ + $(MAKE) build + build: \ - build-tool \ generate-id-manager-key \ build-inbox \ build-webapp \ diff --git a/apps/freenet-email-app/README.md b/apps/freenet-email-app/README.md new file mode 100644 index 000000000..2acc42a24 --- /dev/null +++ b/apps/freenet-email-app/README.md @@ -0,0 +1,160 @@ +# Freenet Messaging App Setup Guide + +Freenet Messaging App is a descentralized messaging application that runs on top of Freenet. + +## Introduction + +This guide will walk you through the setup and launch of the email application on Freenet. +Currently, Freenet is still under development, so the application will communicate with a +local node, which simulates a node on the network. + +## Prerequisites + +- Install the latest version of Rust and Cargo (for Windows + see [here](https://rustup.rs/)): + ```bash + curl https://sh.rustup.rs -sSf | sh + ``` +- Install the Freeenet development tool (fdev) and a working Freenet kernel that can be used for local development. Use cargo to install it: + ```bash + cargo install freenet + cargo install fdev + ``` + +## Prepare the Freenet email contracts and delegates + +### Setup the identity management delegate + +This delegate is responsible for managing a user's contacts. It can store and +retrieve contact information, and can be used by other components to send messages +to contacts. + +This delegate is located inside the modules folder of freenet-core: + +- `freenet-core/` + - `modules/` + - `identity-management/` <-- here is located the identity management delegate + - `build/` <-- the generated folder that contains the compiled delegate binary with version + wasm code + - `src/` <-- this folder contains the source code of the delegate + - `Makefile` <-- this file contains the build instructions for the delegate + - ... + +To build the delegate, go to the `identity-management` folder and run the following command: + +```bash +make build +``` + +This command will compile the delegate and generate a binary file inside the `build/freenet/` folder. It +generates the build folder if it doesn't exist. In addition, the build command will generate: + +- `build/identity_management_code_hash` <-- this file contains the hash of the delegate's wasm code +- `build/identity-manager-key.private.pem` <-- this file contains a generated private key for the delegate +- `build/identity-manager-key.public.pem` <-- this file contains a generated public key for the delegate +- `build/identity-manager-params` <-- this file contains the parameters of the delegate, in that case, the delegate's + SecretKey. + +### Setup the anti-flood token system + +The Antiflood Token System (AFT) is a decentralized system aimed to provide a simple, but general purpose solution +to flooding, denial-of-service attacks, and spam. + +Is composed of one delegate, responsible for generating tokens, and a one contract that keeps track of the token +assignments. + +This system is located inside the modules folder of freenet-core: + +- `freenet-core/` + - `modules/` + - `antiflood-tokens/` <-- here is located the antiflood tokens system + - `contracts/` <-- this folder contains the contract source code + - `token-allocation-record/` <-- this folder contains the token allocation record contract + - `build/` <-- the generated folder that contains the compiled contract binary with version + wasm + code + - `src/` <-- this folder contains the source code of the contract + - ... + - `delegates/` <-- this folder contains the delegate source code + - `token-generator/` <-- this folder contains the token generator delegate + - `build/` <-- the generated folder that contains the compiled delegate binary with version + wasm + code + - `src/` <-- this folder contains the source code of the delegate + - ... + - `Makefile` <-- this file contains the build instructions for building the delegate and the contract + - ... + +To build the Antiflood Token System, go to the `antiflood-tokens` folder and run the following command: + +```bash +make build +``` + +This command will compile the contract and the delegate and generate a binary file inside the `build/freenet/` folder. +It generates the build folder if it doesn't exist. + +- `contracts/token-allocation-record/build/identity_management_code_hash` <-- this file contains the hash of the + contract's wasm code +- `delegates/token-generator/build/token_generator_code_hash` <-- this file contains the hash of the delegate's wasm + code + +### Setup the app + +After building the previous delegates and contracts, what remains is to prepare the app, both the web +and the contract that will be responsible for maintaining the inboxes. + +The app is located inside the `apps/freenet-email-app` folder: + +- `freenet-core/` + - `apps/` + - `freenet-email-app/` <-- here is located the email app + - `contracts/` <-- this folder contains the contract source code + - `inbox/` <-- this folder contains the email inbox contract + - `build/` <-- the generated folder that contains the compiled contract binary with version + wasm + code + - `src/` <-- this folder contains the source code of the contract + - ... + - `web/` <-- this folder contains the web app source code, web app built with Rust Dioxus framework + - `build/` <-- the generated folder that contains the compiled web app binary with version + wasm + code + - `container/` <-- this folder contains the web contract container, a simple contract associated + with the web app, as the state. + - `src/` <-- this folder contains the source code of the web app + - ... + - `Makefile` <-- this file contains the build instructions for building and running the web app, and + the local node. + +To build the email application, go to the `apps/freenet-email-app` folder and run the following command: + +```bash +make build +``` + +This command will compile the inbox and web contracts and the delegate, generate a binary files +inside the respective `build/freenet/` folders and publish the web contract. It generates the build folder if it doesn't +exist. + +After building the app, what remains is to run the local node and the web app. To do that, run the following command: + +1. Run the local node: + ```bash + make run-node + ``` +2. Run the web app: + ```bash + make run-web + ``` + +During the development process, changes inside the web app will be automatically reloaded if it is running. + +If you, instead, want to access the published app via the `build` command, go to your browser and write an URL like (with the node running): +`http://localhost:50509/contract/web/5zrr81Nbvk6PjkrXjXXFpDfrNZZvhx2JCc7BZTBHUKDo/` + +The hash may be different and you can get it when you run the build command. + +## Troubleshooting + +### Freenet node throws an error when trying to find some contract or delegate + +If any of the delegates or contracts definition change, is necessary to rebuild each of them and restart the node. +Probably the contract or delegate hash has changed and the node is trying to find the old version. + +If the error persists, we recommend to make a clean build of all the delegates and contracts, and restart the node. diff --git a/apps/freenet-microblogging/Makefile b/apps/freenet-microblogging/Makefile index f981e6280..e1b30e6c7 100644 --- a/apps/freenet-microblogging/Makefile +++ b/apps/freenet-microblogging/Makefile @@ -11,10 +11,10 @@ $(error CARGO_TARGET_DIR is not set) endif build: \ - webapp \ posts \ - publish-webapp \ - publish-posts + publish-posts \ + webapp \ + publish-webapp node: \ build-tool \ @@ -22,39 +22,26 @@ node: \ build-tool: cd $(FREENET_DIR)/crates/core && - cargo install --path --force $(FREENET_DIR)/crates/core - cargo install --path --force $(FREENET_DIR)/crates/fdev + cargo install --force --path $(FREENET_DIR)/crates/core + cargo install --force --path $(FREENET_DIR)/crates/fdev webapp: cd $(WEB_DIR) - npm i --force freenet-stdlib + npm i --force @freenetorg/freenet-stdlib npm run build - fdev build - cp ./build/freenet/freenet_microblogging_web ../../../crates/core/examples/ - cp ./build/freenet/contract-state ../../../crates/core/examples/freenet_microblogging_web_state publish-webapp: cd $(WEB_DIR) - fdev publish --code build/freenet/freenet_microblogging_web contract --state build/freenet/contract-state posts: cd $(POSTS_DIR) - fdev build - cp ./build/freenet/freenet_microblogging_posts ../../../../crates/core/examples/ - cp ./build/freenet/contract-state ../../../../crates/core/examples/freenet_microblogging_posts_state publish-posts: cd $(POSTS_DIR) - fdev publish --code build/freenet/freenet_microblogging_posts contract --state build/freenet/contract-state run-node: RUST_BACKTRACE=1 RUST_LOG=freenet=debug,locutus_core=debug,locutus_node=debug,info freenet local - -run: - cd $(FREENET_DIR) - cd crates/core/examples - cargo run --example contract_browsing diff --git a/apps/freenet-microblogging/web/package.json b/apps/freenet-microblogging/web/package.json index eacd1c714..4dda17a2e 100644 --- a/apps/freenet-microblogging/web/package.json +++ b/apps/freenet-microblogging/web/package.json @@ -1,7 +1,7 @@ { "dependencies": { + "@freenetorg/freenet-stdlib": "^0.0.8", "bootstrap": "5.3.1", - "freenet-stdlib": "file:../../../stdlib/typescript/dist/pack/freenet-stdlib.tgz", "module-alias": "^2.2.2" }, "main": "src/index.ts", diff --git a/apps/freenet-microblogging/web/src/index.ts b/apps/freenet-microblogging/web/src/index.ts index de4d923fd..2dd006b3c 100644 --- a/apps/freenet-microblogging/web/src/index.ts +++ b/apps/freenet-microblogging/web/src/index.ts @@ -12,10 +12,10 @@ import { UpdateData, DeltaUpdate, DelegateResponse, -} from "freenet-stdlib/websocket-interface"; +} from "@freenetorg/freenet-stdlib"; +import { UpdateDataType } from "@freenetorg/freenet-stdlib/common"; import "./scss/styles.scss"; -import { UpdateDataType } from "freenet-stdlib/common"; // import * as bootstrap from "bootstrap"; @@ -29,7 +29,7 @@ function getDocument(): Document { const DOCUMENT: Document = getDocument(); -const MODEL_CONTRACT = "Hz1TGDBXtD6c1E74shUWMm9EdXjDDbPY1JxdTZsK2xwc"; +const MODEL_CONTRACT = "AgWvW6kwUpMfZcuzSrVddzgfMK2uPPew2UtDCdob9bkj"; const KEY = ContractKey.fromInstanceId(MODEL_CONTRACT); function getState(hostResponse: GetResponse) { @@ -76,7 +76,7 @@ async function sendUpdate() { ); const update = new UpdateData(UpdateDataType.DeltaUpdate, delta); let updateRequest = new UpdateRequest(KEY, update); - await locutusApi.update(updateRequest); + await freenetApi.update(updateRequest); } } @@ -126,7 +126,7 @@ async function subscribeToUpdates() { KEY, new Array() ); - await locutusApi.subscribe(subscribe_request); + await freenetApi.subscribe(subscribe_request); } const handler = { @@ -146,14 +146,14 @@ const handler = { }; const API_URL = new URL(`ws://${location.host}/contract/command`); -const locutusApi = new FreenetWsApi(API_URL, handler); +const freenetApi = new FreenetWsApi(API_URL, handler); async function loadState() { const key = ContractKey.fromInstanceId(MODEL_CONTRACT); const fetchContract = false; const getRequest: GetRequest = new GetRequest(key, fetchContract); - await locutusApi.get(getRequest); + await freenetApi.get(getRequest); } window.addEventListener("load", function (_ev: Event) { diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 4d0f977b6..cbdb2ef0f 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "freenet" -version = "0.0.4" +version = "0.0.6" edition = "2021" rust-version = "1.71.1" publish = true @@ -21,6 +21,7 @@ arrayvec = { workspace = true } axum = { version = "0.6", default-features = false, features = ["ws", "tower-log", "matched-path", "headers", "query", "http1"] } bincode = "1" blake3 = { workspace = true } +byteorder = "1" bytes = "1" bs58 = "0.5" chacha20poly1305 = { workspace = true } @@ -66,6 +67,8 @@ ordered-float = "3.9.1" notify = "6" wasmer = { workspace = true, features = [ "sys"] } chrono = { workspace = true } +tar = { version = "0.4.38" } +xz2 = { version = "0.1" } # Tracing deps tracing = { version = "0.1", optional = true } @@ -75,14 +78,14 @@ tracing-opentelemetry = { version = "0.21.0", optional = true } tracing-subscriber = { version = "0.3.16", optional = true } # internal deps -freenet-stdlib = { path = "../../stdlib/rust", version = "0.0.5", features = ["net", "archive"] } +freenet-stdlib = { workspace = true, features = ["net"] } [dev-dependencies] tracing = "0.1" arbitrary = { version = "1", features = ["derive"] } itertools = "0.11" pico-args = "0.5" -freenet-stdlib = { path = "../../stdlib/rust", version = "0.0.5", features = ["testing", "net"] } +freenet-stdlib = { workspace = true, features = ["testing", "net"] } [features] default = ["websocket", "rocks_db", "trace"] diff --git a/crates/core/examples/freenet_microblogging_posts b/crates/core/examples/freenet_microblogging_posts deleted file mode 100644 index 1237850b9..000000000 Binary files a/crates/core/examples/freenet_microblogging_posts and /dev/null differ diff --git a/crates/core/examples/freenet_microblogging_posts_state b/crates/core/examples/freenet_microblogging_posts_state deleted file mode 100644 index 65b64b1f4..000000000 --- a/crates/core/examples/freenet_microblogging_posts_state +++ /dev/null @@ -1,10 +0,0 @@ -{ - "messages": [ - { - "author": "IDG", - "date": "2022-05-10T00:00:00Z", - "title": "Lore ipsum", - "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." - } - ] -} \ No newline at end of file diff --git a/crates/core/examples/freenet_microblogging_web b/crates/core/examples/freenet_microblogging_web deleted file mode 100644 index 9e2a5ff89..000000000 Binary files a/crates/core/examples/freenet_microblogging_web and /dev/null differ diff --git a/crates/core/examples/freenet_microblogging_web_state b/crates/core/examples/freenet_microblogging_web_state deleted file mode 100644 index cf40dd146..000000000 Binary files a/crates/core/examples/freenet_microblogging_web_state and /dev/null differ diff --git a/crates/core/src/bin/freenet.rs b/crates/core/src/bin/freenet.rs index 34d9997a4..aef4f7f60 100644 --- a/crates/core/src/bin/freenet.rs +++ b/crates/core/src/bin/freenet.rs @@ -16,6 +16,7 @@ async fn run(config: NodeConfig) -> Result<(), DynError> { async fn run_local(config: NodeConfig) -> Result<(), DynError> { let port = config.port; let ip = config.address; + freenet::config::Config::set_op_mode(OperationMode::Local); let executor = Executor::from_config(config).await?; let socket: SocketAddr = (ip, port).into(); freenet::server::local_node::run_local_node(executor, socket).await diff --git a/crates/core/src/server/app_packaging.rs b/crates/core/src/server/app_packaging.rs new file mode 100644 index 000000000..ce241ca4b --- /dev/null +++ b/crates/core/src/server/app_packaging.rs @@ -0,0 +1,125 @@ +//! Helper functions and types for dealing with HTTP gateway compatible contracts. +use std::{ + io::{Cursor, Read}, + path::Path, +}; + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use tar::{Archive, Builder}; +use xz2::read::{XzDecoder, XzEncoder}; + +#[derive(Debug, thiserror::Error)] +pub enum WebContractError { + #[error("unpacking error: {0}")] + UnpackingError(Box), + #[error(transparent)] + StoringError(std::io::Error), + #[error("file not found: {0}")] + FileNotFound(String), +} + +#[non_exhaustive] +pub struct WebApp { + pub metadata: Vec, + pub web: Vec, +} + +impl WebApp { + pub fn from_data( + metadata: Vec, + web: Builder>>, + ) -> Result { + let buf = web.into_inner().unwrap().into_inner(); + let mut encoder = XzEncoder::new(Cursor::new(buf), 6); + let mut compressed = vec![]; + encoder.read_to_end(&mut compressed).unwrap(); + Ok(Self { + metadata, + web: compressed, + }) + } + + pub fn pack(mut self) -> std::io::Result> { + let mut output = Vec::with_capacity( + self.metadata.len() + self.web.len() + (std::mem::size_of::() * 2), + ); + output.write_u64::(self.metadata.len() as u64)?; + output.append(&mut self.metadata); + output.write_u64::(self.web.len() as u64)?; + output.append(&mut self.web); + Ok(output) + } + + pub fn unpack(&mut self, dst: impl AsRef) -> Result<(), WebContractError> { + let mut decoded_web = self.decode_web(); + decoded_web + .unpack(dst) + .map_err(WebContractError::StoringError)?; + Ok(()) + } + + pub fn get_file(&mut self, path: &str) -> Result, WebContractError> { + let mut decoded_web = self.decode_web(); + for e in decoded_web + .entries() + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))? + { + let mut e = e.map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + if e.path() + .ok() + .filter(|p| p.to_string_lossy() == path) + .is_some() + { + let mut bytes = vec![]; + e.read_to_end(&mut bytes) + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + return Ok(bytes); + } + } + Err(WebContractError::FileNotFound(path.to_owned())) + } + + fn decode_web(&self) -> Archive> { + let decoder = XzDecoder::new(self.web.as_slice()); + Archive::new(decoder) + } +} + +impl<'a> TryFrom<&'a [u8]> for WebApp { + type Error = WebContractError; + + fn try_from(state: &'a [u8]) -> Result { + const MAX_METADATA_SIZE: u64 = 1024; + const MAX_WEB_SIZE: u64 = 1024 * 1024 * 100; + // Decompose the state and extract the compressed web interface + let mut state = Cursor::new(state); + + let metadata_size = state + .read_u64::() + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + if metadata_size > MAX_METADATA_SIZE { + return Err(WebContractError::UnpackingError( + format!("Exceeded metadata size of 1kB: {} bytes", metadata_size).into(), + )); + } + let mut metadata = vec![0; metadata_size as usize]; + state + .read_exact(&mut metadata) + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + + let web_size = state + .read_u64::() + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + if web_size > MAX_WEB_SIZE { + return Err(WebContractError::UnpackingError( + format!("Exceeded packed web size of 100MB: {} bytes", web_size).into(), + )); + } + let mut web = vec![0; web_size as usize]; + state + .read_exact(&mut web) + .map_err(|e| WebContractError::UnpackingError(Box::new(e)))?; + + Ok(Self { metadata, web }) + } +} diff --git a/crates/core/src/server/mod.rs b/crates/core/src/server/mod.rs index c46883ca9..730c2a4de 100644 --- a/crates/core/src/server/mod.rs +++ b/crates/core/src/server/mod.rs @@ -1,3 +1,4 @@ +pub(crate) mod app_packaging; pub(crate) mod errors; mod http_gateway; pub(crate) mod path_handlers; @@ -9,6 +10,8 @@ use freenet_stdlib::{ use crate::client_events::{AuthToken, ClientId, HostResult}; +pub use app_packaging::WebApp; + #[derive(Debug)] #[allow(clippy::large_enum_variant)] pub(crate) enum ClientConnection { @@ -70,7 +73,6 @@ pub mod local_node { mut executor: Executor, socket: SocketAddr, ) -> Result<(), DynError> { - crate::config::Config::set_op_mode(crate::local_node::OperationMode::Local); match socket.ip() { IpAddr::V4(ip) if !ip.is_loopback() => { return Err(format!("invalid ip: {ip}, expecting localhost").into()) diff --git a/crates/core/src/server/path_handlers.rs b/crates/core/src/server/path_handlers.rs index de6d62516..02b341d7c 100644 --- a/crates/core/src/server/path_handlers.rs +++ b/crates/core/src/server/path_handlers.rs @@ -7,15 +7,16 @@ use bytes::Bytes; use freenet_stdlib::{ client_api::{ClientRequest, ContractRequest, ContractResponse, HostResponse}, prelude::*, - web::{WebApp, WebContractError}, }; use tokio::{fs::File, io::AsyncReadExt, sync::mpsc}; use crate::client_events::AuthToken; use super::{ - errors::WebSocketApiError, http_gateway::HttpGatewayRequest, ClientConnection, - HostCallbackResult, + app_packaging::{WebApp, WebContractError}, + errors::WebSocketApiError, + http_gateway::HttpGatewayRequest, + ClientConnection, HostCallbackResult, }; const ALPHABET: &str = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; diff --git a/crates/fdev/Cargo.toml b/crates/fdev/Cargo.toml index dd8f1d6ec..54ffc8b47 100644 --- a/crates/fdev/Cargo.toml +++ b/crates/fdev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fdev" -version = "0.0.4" +version = "0.0.6" edition = "2021" rust-version = "1.71.1" publish = true @@ -31,5 +31,5 @@ toml = { version = "0.8", features = ["default", "preserve_order"] } xz2 = "0.1" # internal -freenet = { path = "../core", version = "0.0.4" } -freenet-stdlib = { path = "../../stdlib/rust", version = "0.0.5" } +freenet = { path = "../core", version = "0.0.6" } +freenet-stdlib = { workspace = true } diff --git a/crates/fdev/src/build.rs b/crates/fdev/src/build.rs index 8930ed50f..1fd431ba7 100644 --- a/crates/fdev/src/build.rs +++ b/crates/fdev/src/build.rs @@ -1,3 +1,4 @@ +use freenet::server::WebApp; use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; use std::{ @@ -10,8 +11,6 @@ use std::{ }; use tar::Builder; -use freenet_stdlib::web::WebApp; - use crate::{ config::{BuildToolCliConfig, PackageType}, util::pipe_std_streams, @@ -31,34 +30,34 @@ pub fn build_package(cli_config: BuildToolCliConfig, cwd: &Path) -> Result<(), D fn compile_rust_wasm_lib(cli_config: &BuildToolCliConfig, work_dir: &Path) -> Result<(), DynError> { let package_type = cli_config.package_type; - const RUST_TARGET_ARGS: &[&str] = &["build", "--release", "--lib", "--target"]; + const RUST_TARGET_ARGS: &[&str] = &["build", "--lib", "--target"]; + let release: &[&str] = if cli_config.debug { + &[] + } else { + &["--release"] + }; let target = WASM_TARGET; + let cmd_args = cli_config + .features + .as_ref() + .iter() + .flat_map(|x| ["--features", x.as_str()]) + .chain(release.iter().copied()) + .collect::>(); use std::io::IsTerminal; let cmd_args = if std::io::stdout().is_terminal() && std::io::stderr().is_terminal() { RUST_TARGET_ARGS .iter() .copied() .chain([target, "--color", "always"]) - .chain( - cli_config - .features - .as_ref() - .iter() - .flat_map(|x| ["--features", x.as_str()]), - ) + .chain(cmd_args) .collect::>() } else { RUST_TARGET_ARGS .iter() .copied() .chain([target]) - .chain( - cli_config - .features - .as_ref() - .iter() - .flat_map(|x| ["--features", x.as_str()]), - ) + .chain(cmd_args) .collect::>() }; @@ -79,7 +78,7 @@ fn compile_rust_wasm_lib(cli_config: &BuildToolCliConfig, work_dir: &Path) -> Re fn get_out_lib( work_dir: &Path, - _cli_config: &BuildToolCliConfig, + cli_config: &BuildToolCliConfig, ) -> Result<(String, PathBuf), DynError> { const ERR: &str = "Cargo.toml definition incorrect"; @@ -100,6 +99,11 @@ fn get_out_lib( .as_str() .ok_or_else(|| Error::MissConfiguration(ERR.into()))? .replace('-', "_"); + let opt_dir = if !cli_config.debug { + "release" + } else { + "debug" + }; let output_lib = env::var("CARGO_TARGET_DIR") .map_err(|e| { println!("Missing environment variable `CARGO_TARGET_DIR"); @@ -107,7 +111,7 @@ fn get_out_lib( })? .parse::()? .join(target) - .join("release") + .join(opt_dir) .join(&package_name) .with_extension("wasm"); Ok((package_name, output_lib)) @@ -132,6 +136,7 @@ mod contract { compile_contract(&config, &cli_config, cwd)?; match config.contract.c_type.unwrap_or(ContractType::Standard) { ContractType::WebApp => { + println!("Packaging standard Freenet web app contract type"); let embedded = if let Some(d) = config.webapp.as_ref().and_then(|a| a.dependencies.as_ref()) { let deps = include_deps(d)?; @@ -141,7 +146,10 @@ mod contract { }; build_web_state(&config, embedded, cwd)? } - ContractType::Standard => build_generic_state(&mut config, cwd)?, + ContractType::Standard => { + println!("Packaging generic contract type"); + build_generic_state(&mut config, cwd)? + } } Ok(()) } diff --git a/crates/fdev/src/config.rs b/crates/fdev/src/config.rs index 8d1554646..f1d63c703 100644 --- a/crates/fdev/src/config.rs +++ b/crates/fdev/src/config.rs @@ -105,8 +105,13 @@ pub struct BuildToolCliConfig { #[arg(long, value_parser = parse_version, default_value_t=Version::new(0, 0, 1))] pub(crate) version: Version, + /// Output object type. #[arg(long, value_enum, default_value_t=PackageType::default())] pub(crate) package_type: PackageType, + + /// Compile in debug mode instead of release. + #[arg(long)] + pub(crate) debug: bool, } #[derive(Default, Debug, Clone, Copy, ValueEnum)] @@ -131,6 +136,7 @@ impl Default for BuildToolCliConfig { features: None, version: Version::new(0, 0, 1), package_type: PackageType::default(), + debug: false, } } } diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index bd4c03f95..9f7ba6df9 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -1,6 +1,6 @@ # Getting Started -This tutorial will show you how to build decentralized software on Freenet. +This tutorial will show you how to build decentralized software on Freenet. For a similar working and up to date example check the `freenet-microblogging` app (located in under the `apps/freenet-microblogging` directory in the `freenet-core` repository). @@ -15,7 +15,7 @@ Mac (for Windows see [here](https://rustup.rs)): curl https://sh.rustup.rs -sSf | sh ``` -### Freenet Dev Tool (LDT) +### Freenet development tool (fdev) Once you have a working installation of Cargo you can install the Freenet dev tools: @@ -200,19 +200,21 @@ import { PutResponse, UpdateNotification, UpdateResponse, + DelegateResponse, } from "@freenetorg/freenet-stdlib/websocket-interface"; const handler = { - onPut: (_response: PutResponse) => {}, - onGet: (_response: GetResponse) => {}, - onUpdate: (_up: UpdateResponse) => {}, - onUpdateNotification: (_notif: UpdateNotification) => {}, + onContractPut: (_response: PutResponse) => {}, + onContractGet: (_response: GetResponse) => {}, + onContractUpdate: (_up: UpdateResponse) => {}, + onContractUpdateNotification: (_notif: UpdateNotification) => {}, + onDelegateResponse: (_response: DelegateResponse) => {}, onErr: (err: HostError) => {}, onOpen: () => {}, }; const API_URL = new URL(`ws://${location.host}/contract/command/`); -const locutusApi = new FreenetWsApi(API_URL, handler); +const freenetApi = new FreenetWsApi(API_URL, handler); const CONTRACT = "DCBi7HNZC3QUZRiZLFZDiEduv5KHgZfgBk8WwTiheGq1"; @@ -221,7 +223,7 @@ async function loadState() { key: Key.fromSpec(CONTRACT), fetch_contract: false, }; - await locutusApi.get(getRequest); + await freenetApi.get(getRequest); } ``` @@ -238,7 +240,7 @@ const handler = { }; const API_URL = new URL(`ws://${location.host}/contract/command/`); -const locutusApi = new LocutusWsApi(API_URL, handler); +const freenetApi = new FreenetWsApi(API_URL, handler); ``` This type provides a convenient interface to the WebSocket API. It receives an @@ -253,7 +255,7 @@ async function loadState() { key: Key.fromSpec(CONTRACT), fetch_contract: false, }; - await locutusApi.get(getRequest); + await freenetApi.get(getRequest); } ``` @@ -331,9 +333,10 @@ render them in our browser. We can do that, for example, using the API: ```typescript function getUpdateNotification(notification: UpdateNotification) { let decoder = new TextDecoder("utf8"); - let updatesBox = document.getElementById("updates") as HTMLPreElement; - let newUpdate = decoder.decode(Uint8Array.from(notification.update)); - let newUpdateJson = JSON.parse(newUpdate); + let updatesBox = DOCUMENT.getElementById("updates") as HTMLPreElement; + let delta = notification.update?.updateData as DeltaUpdate; + let newUpdate = decoder.decode(Uint8Array.from(delta.delta)); + let newUpdateJson = JSON.parse(newUpdate.replace("\x00", "")); updatesBox.textContent = updatesBox.textContent + newUpdateJson; } ``` diff --git a/modules/antiflood-tokens/Cargo.lock b/modules/antiflood-tokens/Cargo.lock index 014ba0ae6..bf70303ea 100644 --- a/modules/antiflood-tokens/Cargo.lock +++ b/modules/antiflood-tokens/Cargo.lock @@ -297,9 +297,9 @@ checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" [[package]] name = "atomic-waker" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" @@ -671,9 +671,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.4" +version = "4.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d7b8d5ec32af0fadc644bf1fd509a688c2103b185644bb1e29d164e0703136" +checksum = "824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3" dependencies = [ "clap_builder", "clap_derive", @@ -681,9 +681,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.4" +version = "4.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5179bb514e4d7c2051749d8fcefa2ed6d06a9f4e6d69faf3805f5d80b8cf8d56" +checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab" dependencies = [ "anstream", "anstyle", @@ -717,9 +717,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] @@ -1456,7 +1456,7 @@ dependencies = [ [[package]] name = "freenet" -version = "0.0.4" +version = "0.0.5" dependencies = [ "anyhow", "arrayvec", @@ -1477,7 +1477,7 @@ dependencies = [ "dashmap", "directories", "either", - "freenet-stdlib 0.0.5", + "freenet-stdlib 0.0.6", "futures", "itertools", "libp2p", @@ -1512,7 +1512,7 @@ dependencies = [ "bincode", "bs58", "chrono", - "freenet-stdlib 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freenet-stdlib 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand", "rsa", "serde", @@ -1543,7 +1543,7 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.0.5" +version = "0.0.6" dependencies = [ "arrayvec", "bincode", @@ -1575,9 +1575,9 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.0.5" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb83503ad71922ceeaa56737c0a4a9da11520aaaf8ad6a89f43edb1154f02764" +checksum = "ebd193c150c4f7f9f44068ee7f5181d4c4374ceb1b37965e1edd968d3730f35a" dependencies = [ "arbitrary", "arrayvec", @@ -1607,7 +1607,7 @@ dependencies = [ "bincode", "chrono", "freenet-aft-interface", - "freenet-stdlib 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freenet-stdlib 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "rsa", "serde", "serde_json", @@ -1624,7 +1624,7 @@ dependencies = [ "chrono", "freenet", "freenet-aft-interface", - "freenet-stdlib 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "freenet-stdlib 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "rand", "rand_chacha", @@ -2076,9 +2076,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" dependencies = [ "equivalent", "hashbrown 0.14.0", @@ -2366,9 +2366,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.40.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef7dd7b09e71aac9271c60031d0e558966cdb3253ba0308ab369bb2de80630d0" +checksum = "dd44289ab25e4c9230d9246c475a22241e301b23e8f4061d3bdef304a1a99713" dependencies = [ "either", "fnv", @@ -2521,9 +2521,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.43.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd5ee3270229443a2b34b27ed0cb7470ef6b4a6e45e54e89a8771fa683bab48" +checksum = "e702d75cd0827dfa15f8fd92d15b9932abe38d10d21f47c50438c71dd1b5dae3" dependencies = [ "either", "futures", @@ -2580,9 +2580,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.3" +version = "0.43.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28016944851bd73526d3c146aabf0fa9bbe27c558f080f9e5447da3a1772c01a" +checksum = "ab94183f8fc2325817835b57946deb44340c99362cd4606c0a5717299b2ba369" dependencies = [ "either", "fnv", @@ -2778,9 +2778,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" @@ -3307,9 +3307,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "parking_lot" @@ -3388,9 +3388,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" dependencies = [ "memchr", "thiserror", @@ -3399,9 +3399,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" dependencies = [ "pest", "pest_generator", @@ -3409,9 +3409,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" dependencies = [ "pest", "pest_meta", @@ -3422,9 +3422,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" dependencies = [ "once_cell", "pest", @@ -3910,9 +3910,9 @@ dependencies = [ [[package]] name = "rend" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" +checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" dependencies = [ "bytecheck", ] @@ -4099,9 +4099,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.5" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a27e3b59326c16e23d30aeb7a36a24cc0d29e71d68ff611cdfb4a01d013bed" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -4178,9 +4178,9 @@ checksum = "4c309e515543e67811222dbc9e3dd7e1056279b782e1dacffe4242b718734fb6" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" dependencies = [ "serde", ] @@ -4269,7 +4269,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.0.1", "serde", "serde_json", "serde_with_macros", @@ -4290,9 +4290,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -4301,9 +4301,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -4312,9 +4312,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b" dependencies = [ "lazy_static", ] @@ -4588,18 +4588,18 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", @@ -4640,9 +4640,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -4653,15 +4653,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -4723,9 +4723,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", @@ -4961,9 +4961,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", "bytes", @@ -5134,9 +5134,9 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" @@ -5250,9 +5250,9 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" -version = "0.33.1" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39de0723a53d3c8f54bed106cfbc0d06b3e4d945c5c5022115a61e3b29183ae" +checksum = "34180c89672b3e4825c3a8db4b61a674f1447afd5fe2445b2d22c3d8b6ea086c" dependencies = [ "leb128", ] @@ -5400,9 +5400,9 @@ dependencies = [ [[package]] name = "wast" -version = "65.0.1" +version = "65.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd8c1cbadf94a0b0d1071c581d3cfea1b7ed5192c79808dd15406e508dd0afb" +checksum = "a55a88724cf8c2c0ebbf32c8e8f4ac0d6aa7ba6d73a1cfd94b254aa8f894317e" dependencies = [ "leb128", "memchr", @@ -5412,9 +5412,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3209e35eeaf483714f4c6be93f4a03e69aad5f304e3fa66afa7cb90fe1c8051f" +checksum = "d83e1a8d86d008adc7bafa5cf4332d448699a08fcf2a715a71fbb75e2c5ca188" dependencies = [ "wast", ] diff --git a/modules/antiflood-tokens/Cargo.toml b/modules/antiflood-tokens/Cargo.toml index bbdc2ab32..2de61b3d1 100644 --- a/modules/antiflood-tokens/Cargo.toml +++ b/modules/antiflood-tokens/Cargo.toml @@ -6,7 +6,7 @@ resolver = "2" bincode = { version = "1" } bs58 = "0.5" chrono = { version = "0.4.23", default-features = false } -freenet-stdlib = { version = "0.0.5" } +freenet-stdlib = { version = "0.0.6" } rsa = { version = "0.9.2", default-features = false, features = ["serde", "pem"] } serde = { version = "1" } serde_json = { version = "1" } diff --git a/modules/antiflood-tokens/delegates/token-generator/Cargo.toml b/modules/antiflood-tokens/delegates/token-generator/Cargo.toml index 66999778c..6c51293fb 100644 --- a/modules/antiflood-tokens/delegates/token-generator/Cargo.toml +++ b/modules/antiflood-tokens/delegates/token-generator/Cargo.toml @@ -27,7 +27,7 @@ chacha20poly1305 = "0.10" rand = { version = "0.8", features = ["std"] } rand_chacha = { version = "0.3" } freenet-stdlib = { workspace = true, features = ["testing"] } -freenet = { path = "../../../../crates/core", version = "0.0.4" } +freenet = { path = "../../../../crates/core", version = "0.0.5" } tracing-subscriber = { version = "0.3.16", features = ["env-filter", "fmt"] } [lib] diff --git a/modules/antiflood-tokens/delegates/token-generator/src/lib.rs b/modules/antiflood-tokens/delegates/token-generator/src/lib.rs index 022f0e441..8a5d383e0 100644 --- a/modules/antiflood-tokens/delegates/token-generator/src/lib.rs +++ b/modules/antiflood-tokens/delegates/token-generator/src/lib.rs @@ -62,9 +62,6 @@ impl DelegateInterface for TokenDelegate { InboundDelegateMsg::GetSecretResponse(GetSecretResponse { .. }) => Err( DelegateError::Other("unexpected message type: get secret".into()), ), - InboundDelegateMsg::RandomBytes(_) => Err(DelegateError::Other( - "unexpected message type: radom bytes".into(), - )), InboundDelegateMsg::GetSecretRequest(_) => unreachable!(), } } diff --git a/modules/antiflood-tokens/delegates/token-generator/src/tests.rs b/modules/antiflood-tokens/delegates/token-generator/src/tests.rs index f3dabe996..149bb92b9 100644 --- a/modules/antiflood-tokens/delegates/token-generator/src/tests.rs +++ b/modules/antiflood-tokens/delegates/token-generator/src/tests.rs @@ -12,7 +12,7 @@ mod token_assignment { .unwrap() .and_hms_opt(0, 0, 0) .unwrap(); - DateTime::::from_utc(naive, Utc) + DateTime::::from_naive_utc_and_offset(naive, Utc) } const TEST_TIER: Tier = Tier::Day1; diff --git a/modules/antiflood-tokens/delegates/token-generator/tests/integration_test.rs b/modules/antiflood-tokens/delegates/token-generator/tests/integration_test.rs.bkp similarity index 100% rename from modules/antiflood-tokens/delegates/token-generator/tests/integration_test.rs rename to modules/antiflood-tokens/delegates/token-generator/tests/integration_test.rs.bkp diff --git a/modules/antiflood-tokens/interfaces/src/lib.rs b/modules/antiflood-tokens/interfaces/src/lib.rs index e3f033f36..da7fd6d9b 100644 --- a/modules/antiflood-tokens/interfaces/src/lib.rs +++ b/modules/antiflood-tokens/interfaces/src/lib.rs @@ -314,7 +314,7 @@ fn get_date(y: i32, m: u32, d: u32) -> DateTime { .unwrap() .and_hms_opt(0, 0, 0) .unwrap(); - DateTime::::from_utc(naive, Utc) + DateTime::::from_naive_utc_and_offset(naive, Utc) } #[non_exhaustive] diff --git a/modules/identity-management/Cargo.lock b/modules/identity-management/Cargo.lock index 00f2eb3f6..cf8e849bb 100644 --- a/modules/identity-management/Cargo.lock +++ b/modules/identity-management/Cargo.lock @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "freenet-stdlib" -version = "0.0.5" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb83503ad71922ceeaa56737c0a4a9da11520aaaf8ad6a89f43edb1154f02764" +checksum = "ebd193c150c4f7f9f44068ee7f5181d4c4374ceb1b37965e1edd968d3730f35a" dependencies = [ "arrayvec", "bincode", @@ -587,9 +587,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "ad227c3af19d4914570ad36d30409928b75967c298feb9ea1969db3a610bb14e" dependencies = [ "equivalent", "hashbrown 0.14.0", @@ -874,9 +874,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" dependencies = [ "serde", ] @@ -931,7 +931,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.0.0", + "indexmap 2.0.1", "serde", "serde_json", "serde_with_macros", @@ -962,9 +962,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -973,9 +973,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b" dependencies = [ "lazy_static", ] @@ -1040,18 +1040,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", @@ -1070,9 +1070,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -1083,15 +1083,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] diff --git a/modules/identity-management/Cargo.toml b/modules/identity-management/Cargo.toml index 47302c3af..185a32542 100644 --- a/modules/identity-management/Cargo.toml +++ b/modules/identity-management/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] p384 = { version = "0.13", default-features = false, features = ["serde", "pem", "pkcs8", "arithmetic"] } -freenet-stdlib = { version = "0.0.5" } +freenet-stdlib = { version = "0.0.6" } serde = "1" serde_json = "1" diff --git a/stdlib b/stdlib index 6cd278094..3284f0f9d 160000 --- a/stdlib +++ b/stdlib @@ -1 +1 @@ -Subproject commit 6cd278094b77f2cd11c0ca2c7e1458c6e78a5cf8 +Subproject commit 3284f0f9d6fb0e14e562be2fd1f842ed46b360a7