mirror of
https://github.com/fluencelabs/trust-graph
synced 2025-07-04 09:01:41 +00:00
Compare commits
1 Commits
compose-up
...
v0.1.3-hl-
Author | SHA1 | Date | |
---|---|---|---|
a207c52ce8 |
289
Cargo.lock
generated
289
Cargo.lock
generated
@ -39,9 +39,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.51"
|
||||
version = "1.0.52"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
|
||||
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
@ -143,7 +143,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -175,9 +175,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.8.0"
|
||||
version = "3.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
|
||||
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
||||
|
||||
[[package]]
|
||||
name = "byte-tools"
|
||||
@ -331,9 +331,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.1"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
|
||||
checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils",
|
||||
@ -352,9 +352,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.5"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
|
||||
checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"crossbeam-utils",
|
||||
@ -365,9 +365,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
|
||||
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"lazy_static",
|
||||
@ -395,7 +395,7 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array 0.14.5",
|
||||
"subtle 2.4.1",
|
||||
]
|
||||
|
||||
@ -417,7 +417,7 @@ checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"digest 0.9.0",
|
||||
"rand_core 0.5.1",
|
||||
"rand_core",
|
||||
"subtle 2.4.1",
|
||||
"zeroize",
|
||||
]
|
||||
@ -434,12 +434,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.13.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "757c0ded2af11d8e739c4daea1ac623dd1624b06c844cf3f5a39f1bdbd99bb12"
|
||||
checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4"
|
||||
dependencies = [
|
||||
"darling_core 0.13.0",
|
||||
"darling_macro 0.13.0",
|
||||
"darling_core 0.13.1",
|
||||
"darling_macro 0.13.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -458,9 +458,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.13.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c34d8efb62d0c2d7f60ece80f75e5c63c1588ba68032740494b0b9a996466e3"
|
||||
checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
@ -483,11 +483,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.13.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc"
|
||||
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
|
||||
dependencies = [
|
||||
"darling_core 0.13.0",
|
||||
"darling_core 0.13.1",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
@ -524,7 +524,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
dependencies = [
|
||||
"generic-array 0.14.4",
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -545,10 +545,10 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"ed25519",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"sha2 0.9.8",
|
||||
"sha2 0.9.9",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@ -570,9 +570,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.3.16"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3de9ad4541d99dc22b59134e7ff8dc3d6c988c89ecd7324bf10a8362b07a2afa"
|
||||
checksum = "44a5d80251b806a14cd3e4e1a582e912d5cbf6904ab19fdefbd7a56adca088e1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -648,6 +648,15 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.2.0"
|
||||
@ -716,14 +725,14 @@ dependencies = [
|
||||
"log",
|
||||
"multihash",
|
||||
"parking_lot 0.11.2",
|
||||
"pin-project 1.0.8",
|
||||
"pin-project 1.0.10",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"ring",
|
||||
"rw-stream-sink",
|
||||
"serde",
|
||||
"sha2 0.9.8",
|
||||
"sha2 0.9.9",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"unsigned-varint 0.7.1",
|
||||
@ -740,7 +749,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"futures",
|
||||
"log",
|
||||
"pin-project 1.0.8",
|
||||
"pin-project 1.0.10",
|
||||
"smallvec",
|
||||
"unsigned-varint 0.7.1",
|
||||
]
|
||||
@ -789,13 +798,13 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"quickcheck",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"ring",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sha2 0.9.8",
|
||||
"sha2 0.9.9",
|
||||
"signature",
|
||||
"thiserror",
|
||||
"zeroize",
|
||||
@ -819,9 +828,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"
|
||||
checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@ -834,9 +843,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
|
||||
checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@ -844,15 +853,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"
|
||||
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"
|
||||
checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
@ -862,15 +871,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"
|
||||
checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
|
||||
checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -879,15 +888,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"
|
||||
checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"
|
||||
checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72"
|
||||
|
||||
[[package]]
|
||||
name = "futures-timer"
|
||||
@ -897,9 +906,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
|
||||
checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@ -934,9 +943,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
@ -1085,9 +1094,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@ -1105,9 +1114,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "inventory"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1367fed6750ff2a5bcb967a631528303bb85631f167a75eb1bf7762d57eb7678"
|
||||
checksum = "aa2f6fdbc5fd6457ae78e0313ba2eb5cb509655bbcfe8c577096cdbae8ff621c"
|
||||
dependencies = [
|
||||
"ctor",
|
||||
"ghost",
|
||||
@ -1151,9 +1160,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
@ -1191,9 +1200,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.109"
|
||||
version = "0.2.112"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01"
|
||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
@ -1205,7 +1214,7 @@ dependencies = [
|
||||
"crunchy",
|
||||
"digest 0.8.1",
|
||||
"hmac-drbg",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"sha2 0.8.2",
|
||||
"subtle 2.4.1",
|
||||
"typenum",
|
||||
@ -1213,9 +1222,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.23.1"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abd5850c449b40bacb498b2bbdfaff648b1b055630073ba8db499caf2d0ea9f2"
|
||||
checksum = "d2cafc7c74096c336d9d27145f7ebd4f4b6f95ba16aa5a282387267e6925cb58"
|
||||
dependencies = [
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
@ -1539,9 +1548,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab"
|
||||
dependencies = [
|
||||
"digest 0.9.0",
|
||||
"generic-array 0.14.4",
|
||||
"generic-array 0.14.5",
|
||||
"multihash-derive",
|
||||
"sha2 0.9.8",
|
||||
"sha2 0.9.9",
|
||||
"unsigned-varint 0.5.1",
|
||||
]
|
||||
|
||||
@ -1619,9 +1628,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
|
||||
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
@ -1638,9 +1647,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
@ -1752,27 +1761,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "0.4.28"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f"
|
||||
checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909"
|
||||
dependencies = [
|
||||
"pin-project-internal 0.4.28",
|
||||
"pin-project-internal 0.4.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.0.8"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08"
|
||||
checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e"
|
||||
dependencies = [
|
||||
"pin-project-internal 1.0.8",
|
||||
"pin-project-internal 1.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "0.4.28"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e"
|
||||
checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1781,9 +1790,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.0.8"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
|
||||
checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1792,9 +1801,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
@ -1804,9 +1813,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.23"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1a3ea4f0dd7f1f3e512cf97bf100819aa547f36a6eccac8dbaae839eb92363e"
|
||||
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
|
||||
|
||||
[[package]]
|
||||
name = "polyplets"
|
||||
@ -1821,9 +1830,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
@ -1861,9 +1870,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.33"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
|
||||
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
@ -1938,15 +1947,15 @@ checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"rand 0.7.3",
|
||||
"rand_core 0.5.1",
|
||||
"rand",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.10"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
|
||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -1959,21 +1968,9 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.3",
|
||||
"rand_hc 0.3.1",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1983,17 +1980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.3",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2005,31 +1992,13 @@ dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
||||
dependencies = [
|
||||
"rand_core 0.6.3",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2167,9 +2136,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.26.1"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a82b0b91fad72160c56bf8da7a549b25d7c31109f52cc1437eac4c0ad2550a7"
|
||||
checksum = "4ba4d3462c8b2e4d7f4fcfcf2b296dc6b65404fbbc7b63daa37fd485c149daf7"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"fallible-iterator",
|
||||
@ -2202,15 +2171,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"pin-project 0.4.28",
|
||||
"pin-project 0.4.29",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.6"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"
|
||||
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
|
||||
|
||||
[[package]]
|
||||
name = "safe-transmute"
|
||||
@ -2308,9 +2277,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.72"
|
||||
version = "1.0.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
|
||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -2333,7 +2302,7 @@ version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e"
|
||||
dependencies = [
|
||||
"darling 0.13.0",
|
||||
"darling 0.13.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -2353,9 +2322,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.8"
|
||||
version = "0.9.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa"
|
||||
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0",
|
||||
"cfg-if 1.0.0",
|
||||
@ -2366,9 +2335,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "1.4.0"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788"
|
||||
checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
@ -2414,9 +2383,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.82"
|
||||
version = "1.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
|
||||
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2443,13 +2412,13 @@ checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.2.0"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
||||
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"fastrand",
|
||||
"libc",
|
||||
"rand 0.8.4",
|
||||
"redox_syscall 0.2.10",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
@ -2521,12 +2490,12 @@ dependencies = [
|
||||
"fluence-keypair",
|
||||
"log",
|
||||
"nonempty",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sha2 0.9.8",
|
||||
"sha2 0.9.9",
|
||||
"signature",
|
||||
"thiserror",
|
||||
]
|
||||
@ -2557,9 +2526,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.14.0"
|
||||
version = "1.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
|
||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
||||
|
||||
[[package]]
|
||||
name = "typetag"
|
||||
@ -2675,9 +2644,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
|
37
README.md
37
README.md
@ -2,7 +2,7 @@
|
||||
|
||||
Trust Graph is network-wide peer relationship layer. It's designed to be used to prioritize resources and control permissions in open networks. Being a decentralized graph of relationships, basically a Web of Trust, Trust Graph is distributed among all network peers.
|
||||
|
||||
Specifically, Trust Graph is used is used to prioritize connections from known peers to counteract Sybil attacks while still keeping network open by reserving resources for unknown peers.
|
||||
Specifically, Trust Graph is used to prioritize connections from known peers to counteract Sybil attacks while still keeping network open by reserving resources for unknown peers.
|
||||
|
||||
At the same time, Trust Graph can be used at the application level in various ways such as prioritization of service execution on authorized peers or to define an interconnected subnetwork among peers of a single protocol.
|
||||
|
||||
@ -14,7 +14,7 @@ See [example](./example):
|
||||
|
||||
## API
|
||||
|
||||
Low-level API is defined in the [trust-graph-api.aqua](./aqua/trust-graph-api.aqua) module.
|
||||
High-level API is defined in the [trust-graph-api.aqua](./aqua/trust-graph-api.aqua) module.
|
||||
|
||||
## Directory structure
|
||||
|
||||
@ -22,9 +22,9 @@ Low-level API is defined in the [trust-graph-api.aqua](./aqua/trust-graph-api.aq
|
||||
|
||||
- [`keypair`](./keypair) directory is an abstracted cryptographical layer (key pairs, public keys, signatures, etc.)
|
||||
|
||||
- [`service`](./service) is a package that provides `marine` API and could be compiled to a Wasm file. It is uses `SQLite` as storage.
|
||||
- [`service`](./service) is a package that provides `marine` API and could be compiled to a Wasm file. It is uses `SQLite` as storage
|
||||
|
||||
- [`example`](./example) is a `js` script that shows how to issue, sign trusts/revocations, export certificates and distinguish Fluence nodes
|
||||
- [`example`](./example) is a `js` script that shows how to use Trust Graph to label peers
|
||||
|
||||
- [`builtin-package`](./builtin-package) contains blueprint, configs and scripts for generation builtin package locally or via CI
|
||||
|
||||
@ -35,3 +35,32 @@ Low-level API is defined in the [trust-graph-api.aqua](./aqua/trust-graph-api.aq
|
||||
* [Aqua Book](https://fluence.dev/aqua-book/)
|
||||
* [Aqua Playground](https://github.com/fluencelabs/aqua-playground)
|
||||
* [Aqua repo](https://github.com/fluencelabs/aqua)
|
||||
|
||||
## How to use in Aqua
|
||||
|
||||
```
|
||||
import "@fluencelabs/trust-graph/trust-graph-api.aqua"
|
||||
import "@fluencelabs/trust-graph/trust-graph.aqua"
|
||||
|
||||
func my_function(peer_id: string) -> u32:
|
||||
on HOST_PEER_ID:
|
||||
result <- get_weight(peer_id)
|
||||
<- result
|
||||
```
|
||||
|
||||
## How to use is js
|
||||
1. Add the following to your dependencies
|
||||
- `@fluencelabs/trust-graph`
|
||||
- `@fluencelabs/aqua`
|
||||
- `@fluencelabs/aqua-lib`
|
||||
- `@fluencelabs/fluence`
|
||||
- `@fluencelabs/fluence-network-environment`
|
||||
|
||||
2. Import dependencies
|
||||
```typescript
|
||||
import * as tg from "./generated/export";
|
||||
import { Fluence, KeyPair } from "@fluencelabs/fluence";
|
||||
import { krasnodar, Node } from "@fluencelabs/fluence-network-environment";
|
||||
```
|
||||
3. Add root and issue root trust.
|
||||
4. For now, trusts/revocations can only be signed by client's private key.
|
@ -10,3 +10,5 @@
|
||||
all Fluence Labs relations. Trust from issuer key to any peer id means that this peer is official Fluence Labs peer.
|
||||
isFluencePeer method from [trust-graph-api.aqua](./aqua/trust-graph-api.aqua) module checks these relations. You can build your own
|
||||
structure of peers similarly.
|
||||
|
||||
`example_secret_key.ed25519` publicly available and used for test purposes.
|
||||
|
@ -1,4 +1,4 @@
|
||||
import get_trust_bytes, issue_trust from "../../aqua/trust-graph-api.aqua"
|
||||
import "@fluencelabs/trust-graph/trust-graph.aqua"
|
||||
export get_trust_bytes, issue_trust
|
||||
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
@ -7,3 +7,13 @@ func timestamp_sec(node: string) -> u64:
|
||||
on node:
|
||||
result <- Peer.timestamp_sec()
|
||||
<- result
|
||||
|
||||
func get_trust_bytes(node: string, issued_for_peer_id: string, expires_at_sec: u64, issued_at_sec: u64) -> GetTrustBytesResult:
|
||||
on node:
|
||||
result <- TrustGraph.get_trust_bytes(issued_for_peer_id, expires_at_sec, issued_at_sec)
|
||||
<- result
|
||||
|
||||
func issue_trust(node: string, issued_for_peer_id: string, expires_at_sec: u64, issued_at_sec: u64, trust_bytes: []u8) ->IssueTrustResult:
|
||||
on node:
|
||||
result <- TrustGraph.issue_trust(issued_for_peer_id, expires_at_sec, issued_at_sec, trust_bytes)
|
||||
<- result
|
||||
|
@ -52,21 +52,27 @@ async function main(environment: Node[]) {
|
||||
|
||||
let root_sk_b58 = fs.readFileSync("./root_secret_key.ed25519").toString();
|
||||
let issuer_sk_b58 = fs.readFileSync("./issuer_secret_key.ed25519").toString();
|
||||
let example_sk_b58 = fs.readFileSync("../example_secret_key.ed25519").toString();
|
||||
let root_kp = await KeyPair.fromEd25519SK(bs58.decode(root_sk_b58));
|
||||
let issuer_kp = await KeyPair.fromEd25519SK(bs58.decode(issuer_sk_b58));
|
||||
let example_kp = await KeyPair.fromEd25519SK(bs58.decode(example_sk_b58));
|
||||
console.log("Root private key: %s", root_sk_b58);
|
||||
console.log("Root peer id: %s", root_kp.Libp2pPeerId.toB58String());
|
||||
console.log("Issuer private key: %s", issuer_sk_b58);
|
||||
|
||||
let cur_time = await timestamp_sec(node);
|
||||
let expires_at = cur_time + 60 * 60 * 24 * 365;
|
||||
let certificates = [];
|
||||
let common_chain = [] as any;
|
||||
// self-signed root trust
|
||||
common_chain.push(await issue_trust_helper(node, root_kp, root_kp.Libp2pPeerId.toB58String(), root_kp.Libp2pPeerId.toB58String(), expires_at, cur_time));
|
||||
// from root to issuer
|
||||
common_chain.push(await issue_trust_helper(node, root_kp, root_kp.Libp2pPeerId.toB58String(), issuer_kp.Libp2pPeerId.toB58String(), expires_at, cur_time));
|
||||
// from root to example
|
||||
let trust = await issue_trust_helper(node, root_kp, root_kp.Libp2pPeerId.toB58String(), example_kp.Libp2pPeerId.toB58String(), expires_at, cur_time);
|
||||
let cert = {chain: [...common_chain, trust]};
|
||||
certificates.push(cert);
|
||||
|
||||
let certificates = [];
|
||||
for (let i = 0; i < krasnodar.length; i++) {
|
||||
// from issuer to node
|
||||
let trust = await issue_trust_helper(node, issuer_kp, issuer_kp.Libp2pPeerId.toB58String(), krasnodar[i].peerId, expires_at, cur_time);
|
||||
|
5136
admin/package-lock.json
generated
5136
admin/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,9 +13,9 @@
|
||||
"author": "Fluence Labs",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua": "0.5.0-246",
|
||||
"@fluencelabs/aqua-lib": "0.2.1",
|
||||
"@fluencelabs/fluence": "0.15.0",
|
||||
"@fluencelabs/aqua": "^0.5.2-257",
|
||||
"@fluencelabs/aqua-lib": "^0.3.2",
|
||||
"@fluencelabs/fluence": "^0.18.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.10",
|
||||
"@fluencelabs/trust-graph": "file:../aqua",
|
||||
"bs58": "^4.0.1"
|
||||
|
@ -1,78 +0,0 @@
|
||||
module TrustGraph declares *
|
||||
import "trust-graph.aqua"
|
||||
import "trust-graph-api.aqua"
|
||||
|
||||
func add_root_trust_wrapped(node: string, max_chain_len: u32, expires_at_sec: u64) -> ?string:
|
||||
on node:
|
||||
error <- add_root_trust(max_chain_len, expires_at_sec)
|
||||
<- error
|
||||
|
||||
func add_root_wrapped(node: string, peer_id: string, max_chain_len: u32) -> AddRootResult:
|
||||
on node:
|
||||
result <- add_root(peer_id, max_chain_len)
|
||||
<- result
|
||||
|
||||
func get_weight_wrapped(node: string, peer_id: string) -> WeightResult:
|
||||
on node:
|
||||
result <- get_weight(peer_id)
|
||||
<- result
|
||||
|
||||
func issue_trust_wrapped(node: string, issued_for_peer_id: string, expires_at_sec: u64) -> ?Trust, ?string:
|
||||
on node:
|
||||
result, error <- issue_trust(issued_for_peer_id, expires_at_sec)
|
||||
<- result, error
|
||||
|
||||
func add_trust_wrapped(node: string, issued_for_peer_id: string, expires_at_sec: u64) -> ?string:
|
||||
on node:
|
||||
error <- add_trust(issued_for_peer_id, expires_at_sec)
|
||||
<- error
|
||||
|
||||
func import_trust_wrapped(node: string, trust: Trust) -> ?string:
|
||||
on node:
|
||||
error <- import_trust(trust)
|
||||
<- error
|
||||
|
||||
func verify_trust_wrapped(node: string, trust: Trust, issuer_peer_id: string) -> VerifyTrustResult:
|
||||
on node:
|
||||
result <- verify_trust(trust, issuer_peer_id)
|
||||
<- result
|
||||
|
||||
func issue_revocation_wrapped(node: string, revoked_peer_id: string) -> ?Revocation, ?string:
|
||||
on node:
|
||||
result, error <- issue_revocation(revoked_peer_id)
|
||||
<- result, error
|
||||
|
||||
func revoke_wrapped(node: string, revoked_peer_id: string) -> ?string:
|
||||
on node:
|
||||
error <- revoke(revoked_peer_id)
|
||||
<- error
|
||||
|
||||
func import_revocation_wrapped(node: string, revocation: Revocation) -> ?string:
|
||||
on node:
|
||||
error <- import_revocation(revocation)
|
||||
<- error
|
||||
|
||||
func get_host_certs_from_wrapped(node: string, issuer: string) -> AllCertsResult:
|
||||
on node:
|
||||
result <- get_host_certs_from(issuer)
|
||||
<- result
|
||||
|
||||
func get_all_certs_wrapped(node: string, issued_for: string) -> AllCertsResult:
|
||||
on node:
|
||||
result <- get_all_certs(issued_for)
|
||||
<- result
|
||||
|
||||
func get_host_certs_wrapped(node: string) -> AllCertsResult:
|
||||
on node:
|
||||
result <- get_host_certs()
|
||||
<- result
|
||||
|
||||
func insert_cert_wrapped(node: string, certificate: Certificate) -> InsertResult:
|
||||
on node:
|
||||
result <- insert_cert(certificate)
|
||||
<- result
|
||||
|
||||
func isFluencePeer_wrapped(node: string) -> ?bool, ?string:
|
||||
on node:
|
||||
result, error <- isFluencePeer()
|
||||
<- result, error
|
8
aqua/misc.aqua
Normal file
8
aqua/misc.aqua
Normal file
@ -0,0 +1,8 @@
|
||||
import "trust-graph.aqua"
|
||||
|
||||
-- helpers for isFluencePeer
|
||||
service TrustOp("op"):
|
||||
array_length(a: []Trust) -> u32
|
||||
|
||||
service BoolOp("op"):
|
||||
array_length(a: []bool) -> u32
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@fluencelabs/trust-graph",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "Aqua Trust Graph API library",
|
||||
"files": [
|
||||
"*.aqua"
|
||||
|
@ -1,16 +1,17 @@
|
||||
import "trust-graph.aqua"
|
||||
import "misc.aqua"
|
||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
-- Set peer_id as a root to TG instance on current node
|
||||
-- Self-signed trust should be added in next call for correct behaviour
|
||||
-- `max_chain_len` specifies maximum chain length after root trust,
|
||||
-- if `max_chain_len` is zero there is no trusts except self-signed root trust in certificates for this root
|
||||
func add_root(peer_id: string, max_chain_len: u32) -> AddRootResult:
|
||||
weight_factor <- TrustGraph.get_weight_factor(max_chain_len)
|
||||
result <- TrustGraph.add_root(peer_id, weight_factor)
|
||||
<- result
|
||||
|
||||
func get_weight(peer_id: string) -> WeightResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_weight(peer_id, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Create and sign trust with %init_peer_id%'s private key
|
||||
func issue_trust(issued_for_peer_id: string, expires_at_sec: u64) -> ?Trust, ?string:
|
||||
issued_at_sec <- Peer.timestamp_sec()
|
||||
bytes <- TrustGraph.get_trust_bytes(issued_for_peer_id, expires_at_sec, issued_at_sec)
|
||||
@ -29,6 +30,7 @@ func issue_trust(issued_for_peer_id: string, expires_at_sec: u64) -> ?Trust, ?st
|
||||
error <<- bytes.error
|
||||
<- result, error
|
||||
|
||||
-- Issue trust and add to TG instance on current node
|
||||
func add_trust(issued_for_peer_id: string, expires_at_sec: u64) -> ?string:
|
||||
trust, issue_error <- issue_trust(issued_for_peer_id, expires_at_sec)
|
||||
|
||||
@ -43,6 +45,17 @@ func add_trust(issued_for_peer_id: string, expires_at_sec: u64) -> ?string:
|
||||
|
||||
<- error
|
||||
|
||||
-- Add trust to TG instance on current node
|
||||
func import_trust(trust: Trust) -> ?string:
|
||||
error: ?string
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
add_result <- TrustGraph.add_trust(trust, %init_peer_id%, timestamp_sec)
|
||||
if add_result.success != true:
|
||||
error <<- add_result.error
|
||||
|
||||
<- error
|
||||
|
||||
-- Set %init_peer_id% as a root and add self-signed trust to TG instance on current node
|
||||
func add_root_trust(max_chain_len: u32, expires_at_sec: u64) -> ?string:
|
||||
add_root_result <- add_root(%init_peer_id%, max_chain_len)
|
||||
error: *?string
|
||||
@ -56,20 +69,26 @@ func add_root_trust(max_chain_len: u32, expires_at_sec: u64) -> ?string:
|
||||
|
||||
<- error!
|
||||
|
||||
func import_trust(trust: Trust) -> ?string:
|
||||
error: ?string
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
add_result <- TrustGraph.add_trust(trust, %init_peer_id%, timestamp_sec)
|
||||
if add_result.success != true:
|
||||
error <<- add_result.error
|
||||
|
||||
<- error
|
||||
|
||||
-- Check signature and expiration time of trust
|
||||
func verify_trust(trust: Trust, issuer_peer_id: string) -> VerifyTrustResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.verify_trust(trust, issuer_peer_id, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Get the maximum weight of trust for one peer id
|
||||
-- Trust has weight if there is at least 1 trust chain from one of the roots
|
||||
func get_weight(peer_id: string) -> WeightResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_weight(peer_id, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Get maximum weight of trust among all chains which contain trust from `issuer`
|
||||
func get_weight_from(peer_id: string, issuer: string) -> WeightResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_weight_from(peer_id, issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Create revocation signed by %init_peer_id%
|
||||
func issue_revocation(revoked_peer_id: string) -> ?Revocation, ?string:
|
||||
issued_at_sec <- Peer.timestamp_sec()
|
||||
bytes <- TrustGraph.get_revocation_bytes(revoked_peer_id, issued_at_sec)
|
||||
@ -80,7 +99,7 @@ func issue_revocation(revoked_peer_id: string) -> ?Revocation, ?string:
|
||||
on %init_peer_id% via HOST_PEER_ID:
|
||||
signature <- Sig.sign(bytes.result)
|
||||
issue_result <- TrustGraph.issue_revocation(revoked_peer_id, %init_peer_id%, issued_at_sec, signature)
|
||||
if issue_result.success != true:
|
||||
if issue_result.success:
|
||||
result <<- issue_result.revocation
|
||||
else:
|
||||
error <<- issue_result.error
|
||||
@ -88,6 +107,8 @@ func issue_revocation(revoked_peer_id: string) -> ?Revocation, ?string:
|
||||
error <<- bytes.error
|
||||
<- result, error
|
||||
|
||||
-- Revoke all certificates on current node's TG instance
|
||||
-- which contain path from %init_peer_id% to `revoked_peer_id`
|
||||
func revoke(revoked_peer_id: string) -> ?string:
|
||||
revocation, issue_error <- issue_revocation(revoked_peer_id)
|
||||
|
||||
@ -96,13 +117,13 @@ func revoke(revoked_peer_id: string) -> ?string:
|
||||
error <<- issue_error!
|
||||
else:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
add_result <- TrustGraph.revoke(revocation!, timestamp_sec)
|
||||
if add_result.success != true:
|
||||
error <<- add_result.error
|
||||
revoke_result <- TrustGraph.revoke(revocation!, timestamp_sec)
|
||||
if revoke_result.success != true:
|
||||
error <<- revoke_result.error
|
||||
|
||||
<- error
|
||||
|
||||
|
||||
-- Import revocation to current node's TG instance
|
||||
func import_revocation(revocation: Revocation) -> ?string:
|
||||
error: ?string
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
@ -112,34 +133,37 @@ func import_revocation(revocation: Revocation) -> ?string:
|
||||
|
||||
<- error
|
||||
|
||||
-- Return all certificates issued for current node which contains trust from `issuer`
|
||||
func get_host_certs_from(issuer: string) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_host_certs_from(issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Return all certificates issued for given peer id
|
||||
func get_all_certs(issued_for: string) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_all_certs(issued_for, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Return all certificates issued for given peer id which contains trust from `issuer`
|
||||
func get_all_certs_from(issued_for: string, issuer: string) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_all_certs_from(issued_for, issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Return all certificates issued for current node
|
||||
func get_host_certs() -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_host_certs(timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Insert certificate to TG instance on current node
|
||||
func insert_cert(certificate: Certificate) -> InsertResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.insert_cert(certificate, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- helpers for isFluencePeer
|
||||
service TrustOp("op"):
|
||||
array_length(a: []Trust) -> u32
|
||||
|
||||
service BoolOp("op"):
|
||||
array_length(a: []bool) -> u32
|
||||
|
||||
-- returns `true` if current relay is identified as official Fluence Labs peer
|
||||
-- returns `true` if current node is identified as official Fluence Labs peer
|
||||
-- returns `false` otherwise
|
||||
func isFluencePeer() -> ?bool, ?string:
|
||||
certs_result <- get_host_certs_from("12D3KooWM45u7AQxsb4MuQJNYT3NWHHMLU7JTbBV66RTfF3KSzdR")
|
||||
|
@ -73,12 +73,14 @@ service TrustGraph("trust-graph"):
|
||||
add_root(peer_id: string, weight_factor: u32) -> AddRootResult
|
||||
add_trust(trust: Trust, issuer_peer_id: string, timestamp_sec: u64) -> AddTrustResult
|
||||
get_all_certs(issued_for: string, timestamp_sec: u64) -> AllCertsResult
|
||||
get_all_certs_from(issued_for: string, issuer: string, timestamp_sec: u64) -> AllCertsResult
|
||||
get_host_certs(timestamp_sec: u64) -> AllCertsResult
|
||||
get_host_certs_from(issuer: string, timestamp_sec: u64) -> AllCertsResult
|
||||
get_revocation_bytes(revoked_peer_id: string, revoked_at: u64) -> GetRevokeBytesResult
|
||||
get_trust_bytes(issued_for_peer_id: string, expires_at_sec: u64, issued_at_sec: u64) -> GetTrustBytesResult
|
||||
get_weight(peer_id: string, timestamp_sec: u64) -> WeightResult
|
||||
get_weight_factor(max_chain_len: u32) -> u32
|
||||
get_weight_from(peer_id: string, issuer: string, timestamp_sec: u64) -> WeightResult
|
||||
insert_cert(certificate: Certificate, timestamp_sec: u64) -> InsertResult
|
||||
insert_cert_raw(certificate: string, timestamp_sec: u64) -> InsertResult
|
||||
issue_revocation(revoked_peer_id: string, revoked_by_peer_id: string, revoked_at_sec: u64, signature_bytes: []u8) -> IssueRevocationResult
|
||||
|
@ -1,6 +1,9 @@
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("trust-graph" "add_root") ["12D3KooWNbZKaPWRZ8wgjGvrxdJFz9Fq5uVwkR6ERV1f74HhPdyB" 2] add_root_res)
|
||||
(seq
|
||||
(call relay ("trust-graph" "get_weight_factor") [5] weight_factor)
|
||||
(call relay ("trust-graph" "add_root") ["12D3KooWNbZKaPWRZ8wgjGvrxdJFz9Fq5uVwkR6ERV1f74HhPdyB" weight_factor] add_root_res)
|
||||
)
|
||||
(xor
|
||||
(match add_root_res.$.success! true
|
||||
(null)
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,23 +1,10 @@
|
||||
# Run example locally
|
||||
## Description
|
||||
This example shows how to use Trust Graph to label peers. There are some `trusted_computation` which can only be executed
|
||||
on labeled peer. The label is determined by the presence of certificate from `%init_peer_id` to this peer.
|
||||
|
||||
## Run example locally
|
||||
1. Go to `local-network`
|
||||
2. Run `docker compose up -d` to start Fluence node
|
||||
3. Go back to `../example`
|
||||
4. Run `npm i`
|
||||
5. Run `npm run start`
|
||||
|
||||
## How to use
|
||||
1. Add the following to your dependencies
|
||||
- `@fluencelabs/trust-graph`
|
||||
- `@fluencelabs/aqua`
|
||||
- `@fluencelabs/aqua-lib`
|
||||
- `@fluencelabs/fluence`
|
||||
- `@fluencelabs/fluence-network-environment`
|
||||
|
||||
2. Import dependencies
|
||||
```typescript
|
||||
import * as tg from "./generated/export";
|
||||
import { Fluence, KeyPair } from "@fluencelabs/fluence";
|
||||
import { krasnodar, Node } from "@fluencelabs/fluence-network-environment";
|
||||
```
|
||||
3. Add root and issue self-signed root trust.
|
||||
4. For now, you can sign trusts/revocations only on js side with KeyPair.
|
||||
|
@ -13,12 +13,15 @@ service TrustedComputation("op"):
|
||||
|
||||
func trusted_computation(node: string) -> ?u64:
|
||||
result: ?u64
|
||||
on node:
|
||||
certs_result <- get_host_certs_from(%init_peer_id%)
|
||||
-- on our trusted relay
|
||||
on HOST_PEER_ID:
|
||||
-- get all certificates issued for given node by our client's peer id
|
||||
certs_result <- get_all_certs_from(node, %init_peer_id%)
|
||||
if certs_result.success:
|
||||
len <- CertOp.array_length(certs_result.certificates)
|
||||
|
||||
if len != 0:
|
||||
result <- TrustedComputation.identity(5)
|
||||
-- if there is any certificate node is trusted and computation is possible
|
||||
if len != 0:
|
||||
on node:
|
||||
result <- TrustedComputation.identity(5)
|
||||
|
||||
<- result
|
||||
|
@ -1,13 +1,24 @@
|
||||
import "@fluencelabs/trust-graph/export.aqua"
|
||||
|
||||
export issue_trust_wrapped as issue_trust, verify_trust_wrapped as verify_trust, add_trust_wrapped as add_trust, import_trust_wrapped as import_trust
|
||||
export add_root_trust_wrapped as add_root_trust, add_root_wrapped as add_root, get_weight_wrapped as get_weight, get_all_certs_wrapped as get_all_certs, insert_cert_wrapped as insert_cert
|
||||
export issue_revocation_wrapped as issue_revocation, revoke_wrapped as revoke, isFluencePeer_wrapped as isFluencePeer
|
||||
|
||||
use add_root_trust, add_trust, revoke from "@fluencelabs/trust-graph/trust-graph-api.aqua" as TrustGraph
|
||||
export add_root_trust, add_trust, revoke
|
||||
import Peer from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
-- here we define wrappers with `on` for export functions used in script
|
||||
func add_root_trust(node: string, max_chain_len: u32, expires_at_sec: u64) -> ?string:
|
||||
on node:
|
||||
error <- TrustGraph.add_root_trust(max_chain_len, expires_at_sec)
|
||||
<- error
|
||||
|
||||
func add_trust(node: string, issued_for_peer_id: string, expires_at_sec: u64) -> ?string:
|
||||
on node:
|
||||
error <- TrustGraph.add_trust(issued_for_peer_id, expires_at_sec)
|
||||
<- error
|
||||
|
||||
func revoke(node: string, revoked_peer_id: string) -> ?string:
|
||||
on node:
|
||||
error <- TrustGraph.revoke(revoked_peer_id)
|
||||
<- error
|
||||
|
||||
func timestamp_sec() -> u64:
|
||||
on HOST_PEER_ID:
|
||||
result <- Peer.timestamp_sec()
|
||||
<- result
|
||||
|
||||
|
@ -19,6 +19,7 @@ import * as tg from "./generated/export";
|
||||
import {Fluence, FluencePeer, KeyPair} from "@fluencelabs/fluence";
|
||||
import {krasnodar, Node, testNet, stage} from "@fluencelabs/fluence-network-environment";
|
||||
import assert from "assert";
|
||||
import {add_root_trust} from "./generated/export";
|
||||
const bs58 = require('bs58');
|
||||
|
||||
let local: Node[] = [
|
||||
@ -39,47 +40,34 @@ let local: Node[] = [
|
||||
},
|
||||
];
|
||||
|
||||
async function add_roots() {
|
||||
let current_time = await tg.timestamp_sec();
|
||||
let far_future = current_time + 9999999;
|
||||
async function revoke_all(relay: string) {
|
||||
for (var node of local) {
|
||||
let error = await tg.add_root_trust(node.peerId, 2, far_future);
|
||||
console.log("Added root trust for %s", node.peerId)
|
||||
let error = await tg.revoke(relay, node.peerId);
|
||||
assert(error == null);
|
||||
}
|
||||
}
|
||||
|
||||
async function is_fluence_peer(node: string) {
|
||||
let [result, error] = await tg.isFluencePeer(node);
|
||||
|
||||
console.log("%s %s", result, error);
|
||||
if (error !== null) {
|
||||
console.error("Something went wrong: %s", error);
|
||||
} else {
|
||||
assert(result !== null);
|
||||
if (result) {
|
||||
console.log("Current relay %s identified as Fluence Labs' peer", Fluence.getStatus().relayPeerId)
|
||||
} else {
|
||||
console.log("Current relay %s is not Fluence Labs' peer", Fluence.getStatus().relayPeerId)
|
||||
}
|
||||
}
|
||||
async function add_root(relay: string) {
|
||||
let current_time = await tg.timestamp_sec();
|
||||
let far_future = current_time + 9999999;
|
||||
let error = await tg.add_root_trust(relay, 2, far_future);
|
||||
assert(error == null);
|
||||
}
|
||||
|
||||
async function add_new_trust_checked(node: string, issued_for_peer_id: string, expires_at_sec: number) {
|
||||
let error = await tg.add_trust(node, issued_for_peer_id, expires_at_sec);
|
||||
async function add_new_trust_checked(relay: string, issued_for_peer_id: string, expires_at_sec: number) {
|
||||
let error = await tg.add_trust(relay, issued_for_peer_id, expires_at_sec);
|
||||
if (error !== null) {
|
||||
console.error("%s", error);
|
||||
} else {
|
||||
console.log("Trust to node %s successfully added", node)
|
||||
console.log("Trust issued for %s successfully added", issued_for_peer_id)
|
||||
}
|
||||
}
|
||||
|
||||
async function revoke_checked(node: string, revoked_peer_id: string) {
|
||||
let error = await tg.revoke(node, revoked_peer_id);
|
||||
async function revoke_checked(relay: string, revoked_peer_id: string) {
|
||||
let error = await tg.revoke(relay, revoked_peer_id);
|
||||
if (error !== null) {
|
||||
console.error("%s", error);
|
||||
console.log("%s", error);
|
||||
} else {
|
||||
console.log("Trust to node %s revoked", node)
|
||||
console.log("Trust issued for %s revoked", revoked_peer_id)
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,48 +75,61 @@ async function exec_trusted_computation(node: string) {
|
||||
let result = await trusted_computation(node)
|
||||
|
||||
if (result !== null) {
|
||||
console.log("Trusted computation on node %s successful, result is %s", node, result)
|
||||
console.log("📗 Trusted computation on node %s successful, result is %s", node, result)
|
||||
} else {
|
||||
console.log("Trusted computation on node %s failed", node)
|
||||
console.log("📕 Trusted computation on node %s failed", node)
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("In this example we try to execute some trusted computations based on trusts");
|
||||
console.log("📘 Will connect to local nodes");
|
||||
// key from local-network/builtins_secret_key.ed25519 to connect as builtins owner
|
||||
let sk = bs58.decode("5FwE32bDcphFzuMca7Y2qW1gdR64fTBYoRNvD4MLE1hecDGhCMQGKn8aseMr5wRo4Xo2CRFdrEAawUNLYkgQD78K").slice(0, 32); // first 32 bytes - secret key, second - public key
|
||||
let builtins_keypair = await KeyPair.fromEd25519SK(sk);
|
||||
|
||||
await Fluence.start({ connectTo: local[0], KeyPair: builtins_keypair});
|
||||
let relay = local[0];
|
||||
await Fluence.start({ connectTo: relay, KeyPair: builtins_keypair});
|
||||
console.log(
|
||||
"📗 created a fluence peer %s with relay %s",
|
||||
Fluence.getStatus().peerId,
|
||||
Fluence.getStatus().relayPeerId
|
||||
);
|
||||
|
||||
await add_roots();
|
||||
let nodeA = local[0].peerId
|
||||
let nodeB = local[1].peerId
|
||||
let nodeC = local[2].peerId
|
||||
await revoke_checked(nodeB, nodeB);
|
||||
await exec_trusted_computation(nodeA);
|
||||
await exec_trusted_computation(nodeB);
|
||||
await exec_trusted_computation(nodeC);
|
||||
|
||||
let current_time = await tg.timestamp_sec();
|
||||
let far_future = current_time + 9999999;
|
||||
|
||||
await add_new_trust_checked(nodeB, nodeB, far_future);
|
||||
// clear all trusts from our peer id on relay
|
||||
await revoke_all(relay.peerId);
|
||||
// wait to be sure that last revocation will be older than future trusts at least on 1 second (because timestamp in secs)
|
||||
await new Promise(f => setTimeout(f, 1000));
|
||||
|
||||
await exec_trusted_computation(nodeA);
|
||||
await exec_trusted_computation(nodeB);
|
||||
await exec_trusted_computation(nodeC);
|
||||
// set our peer id as root to our relay
|
||||
await add_root(relay.peerId);
|
||||
|
||||
await revoke_checked(nodeB, nodeB);
|
||||
let nodeA = local[0].peerId
|
||||
let nodeB = local[1].peerId
|
||||
let nodeC = local[2].peerId
|
||||
|
||||
await exec_trusted_computation(nodeA);
|
||||
await exec_trusted_computation(nodeB);
|
||||
await exec_trusted_computation(nodeC);
|
||||
// try to exec computation on every node, will fail
|
||||
await exec_trusted_computation(nodeA); // fail
|
||||
await exec_trusted_computation(nodeB); // fail
|
||||
await exec_trusted_computation(nodeC); // fail
|
||||
|
||||
console.log("🌀 Issue trust to nodeB: %s", nodeB);
|
||||
await add_new_trust_checked(relay.peerId, nodeB, far_future);
|
||||
|
||||
await exec_trusted_computation(nodeA); // fail
|
||||
await exec_trusted_computation(nodeB); // success
|
||||
await exec_trusted_computation(nodeC); // fail
|
||||
|
||||
await new Promise(f => setTimeout(f, 1000));
|
||||
console.log("🚫 Revoke trust to nodeB");
|
||||
await revoke_checked(relay.peerId, nodeB);
|
||||
|
||||
await exec_trusted_computation(nodeA); // fail
|
||||
await exec_trusted_computation(nodeB); // fail
|
||||
await exec_trusted_computation(nodeC); // fail
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ services:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
WASM_LOG: info
|
||||
image: fluencelabs/node:latest
|
||||
image: fluencelabs/node:tg-hl-api_v345
|
||||
ports:
|
||||
- 7770:7770 # tcp
|
||||
- 9990:9990 # ws
|
||||
@ -29,7 +29,7 @@ services:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
WASM_LOG: info
|
||||
image: fluencelabs/node:latest
|
||||
image: fluencelabs/node:tg-hl-api_v345
|
||||
ports:
|
||||
- 7771:7771 # tcp
|
||||
- 9991:9991 # ws
|
||||
@ -51,7 +51,7 @@ services:
|
||||
RUST_BACKTRACE: full
|
||||
RUST_LOG: info,network=trace,aquamarine=info,aquamarine::actor=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,cranelift_codegen=info,wasmer_wasi=info,async_io=info,polling=info,wasmer_interface_types_fl=info,particle_server::behaviour::identify=info,libp2p_mplex=info,libp2p_identify=info,walrus=info,particle_protocol::libp2p_protocol::upgrade=info,kademlia::behaviour=info
|
||||
WASM_LOG: info
|
||||
image: fluencelabs/node:latest
|
||||
image: fluencelabs/node:tg-hl-api_v345
|
||||
ports:
|
||||
- 7772:7772 # tcp
|
||||
- 9992:9992 # ws
|
||||
|
@ -71,17 +71,40 @@ fn get_certs(
|
||||
tg: &mut TrustGraph<SQLiteStorage>,
|
||||
issued_for: String,
|
||||
timestamp_sec: u64,
|
||||
) -> Result<impl Iterator<Item = Certificate>, ServiceError> {
|
||||
) -> Result<Vec<Certificate>, ServiceError> {
|
||||
let public_key = extract_public_key(issued_for)?;
|
||||
let certs = tg.get_all_certs(public_key, Duration::from_secs(timestamp_sec))?;
|
||||
Ok(certs.into_iter().map(|c| c.into()))
|
||||
Ok(certs.into_iter().map(|c| c.into()).collect())
|
||||
}
|
||||
|
||||
fn get_certs_from(
|
||||
tg: &mut TrustGraph<SQLiteStorage>,
|
||||
issued_for: String,
|
||||
issuer: String,
|
||||
timestamp_sec: u64,
|
||||
) -> Result<Vec<Certificate>, ServiceError> {
|
||||
let issued_for_pk = extract_public_key(issued_for)?;
|
||||
let issuer_pk = extract_public_key(issuer)?;
|
||||
let certs =
|
||||
tg.get_all_certs_from(issued_for_pk, issuer_pk, Duration::from_secs(timestamp_sec))?;
|
||||
Ok(certs.into_iter().map(|c| c.into()).collect())
|
||||
}
|
||||
|
||||
#[marine]
|
||||
fn get_all_certs(issued_for: String, timestamp_sec: u64) -> AllCertsResult {
|
||||
with_tg(|tg| {
|
||||
check_timestamp_tetraplets(&marine_rs_sdk::get_call_parameters(), 1)?;
|
||||
get_certs(tg, issued_for, timestamp_sec).map(|iter| iter.collect())
|
||||
get_certs(tg, issued_for, timestamp_sec)
|
||||
})
|
||||
.into()
|
||||
}
|
||||
|
||||
#[marine]
|
||||
fn get_all_certs_from(issued_for: String, issuer: String, timestamp_sec: u64) -> AllCertsResult {
|
||||
with_tg(|tg| {
|
||||
let cp = get_call_parameters();
|
||||
check_timestamp_tetraplets(&cp, 1)?;
|
||||
get_certs_from(tg, issued_for, issuer, timestamp_sec)
|
||||
})
|
||||
.into()
|
||||
}
|
||||
@ -91,7 +114,7 @@ fn get_host_certs(timestamp_sec: u64) -> AllCertsResult {
|
||||
with_tg(|tg| {
|
||||
let cp = marine_rs_sdk::get_call_parameters();
|
||||
check_timestamp_tetraplets(&cp, 0)?;
|
||||
get_certs(tg, cp.host_id, timestamp_sec).map(|iter| iter.collect())
|
||||
get_certs(tg, cp.host_id, timestamp_sec)
|
||||
})
|
||||
.into()
|
||||
}
|
||||
@ -101,10 +124,7 @@ fn get_host_certs_from(issuer: String, timestamp_sec: u64) -> AllCertsResult {
|
||||
with_tg(|tg| {
|
||||
let cp = get_call_parameters();
|
||||
check_timestamp_tetraplets(&cp, 1)?;
|
||||
get_certs(tg, cp.host_id, timestamp_sec).map(|c| {
|
||||
c.filter(|cert: &Certificate| cert.chain.iter().any(|t| t.issued_for == issuer))
|
||||
.collect()
|
||||
})
|
||||
get_certs_from(tg, cp.host_id, issuer, timestamp_sec)
|
||||
})
|
||||
.into()
|
||||
}
|
||||
@ -121,6 +141,20 @@ fn get_weight(peer_id: String, timestamp_sec: u64) -> WeightResult {
|
||||
.into()
|
||||
}
|
||||
|
||||
#[marine]
|
||||
fn get_weight_from(peer_id: String, issuer: String, timestamp_sec: u64) -> WeightResult {
|
||||
with_tg(|tg| {
|
||||
check_timestamp_tetraplets(&marine_rs_sdk::get_call_parameters(), 1)?;
|
||||
let issued_for_pk = extract_public_key(peer_id.clone())?;
|
||||
let issuer_pk = extract_public_key(issuer)?;
|
||||
let weight =
|
||||
tg.weight_from(issued_for_pk, issuer_pk, Duration::from_secs(timestamp_sec))?;
|
||||
Ok(weight)
|
||||
})
|
||||
.map(|w| (w, peer_id))
|
||||
.into()
|
||||
}
|
||||
|
||||
#[marine]
|
||||
fn get_trust_bytes(
|
||||
issued_for_peer_id: String,
|
||||
|
@ -198,6 +198,29 @@ where
|
||||
Ok(max_weight)
|
||||
}
|
||||
|
||||
/// Get the maximum weight of trust for one public key.
|
||||
/// for all chains which contain `issuer`
|
||||
pub fn weight_from<P>(
|
||||
&mut self,
|
||||
issued_for: P,
|
||||
issuer: P,
|
||||
cur_time: Duration,
|
||||
) -> Result<u32, TrustGraphError>
|
||||
where
|
||||
P: Borrow<PublicKey>,
|
||||
{
|
||||
let mut max_weight = 0;
|
||||
|
||||
// get all possible certificates from the given public key to all roots in the graph
|
||||
// which contain `issuer`
|
||||
let certs = self.get_all_certs_from(issued_for, issuer, cur_time)?;
|
||||
if let Some(weight_factor) = self.certificates_weight_factor(certs)? {
|
||||
max_weight = std::cmp::max(max_weight, get_weight_from_factor(weight_factor))
|
||||
}
|
||||
|
||||
Ok(max_weight)
|
||||
}
|
||||
|
||||
/// Calculate weight from given certificates
|
||||
/// Returns None if there is no such public key
|
||||
/// or some trust between this key and a root key is revoked.
|
||||
@ -300,6 +323,27 @@ where
|
||||
Ok(terminated_chains)
|
||||
}
|
||||
|
||||
/// Get all possible certificates where `issued_for` will be the last element of the chain,
|
||||
/// all certificates contain `issuer`
|
||||
/// and one of the destinations is the root of this chain.
|
||||
pub fn get_all_certs_from<P>(
|
||||
&mut self,
|
||||
issued_for: P,
|
||||
issuer: P,
|
||||
cur_time: Duration,
|
||||
) -> Result<Vec<Certificate>, TrustGraphError>
|
||||
where
|
||||
P: Borrow<PublicKey>,
|
||||
{
|
||||
self.get_all_certs(issued_for, cur_time).map(|c| {
|
||||
c.into_iter()
|
||||
.filter(|cert: &Certificate| {
|
||||
cert.chain.iter().any(|t| t.issued_for.eq(issuer.borrow()))
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
/// Get all possible certificates where `issued_for` will be the last element of the chain
|
||||
/// and one of the destinations is the root of this chain.
|
||||
pub fn get_all_certs<P>(
|
||||
|
Reference in New Issue
Block a user