mirror of
https://github.com/fluencelabs/trust-graph
synced 2025-07-05 09:31:38 +00:00
Compare commits
10 Commits
v0.1.6-hl-
...
v3.0.3
Author | SHA1 | Date | |
---|---|---|---|
b9a996eba8 | |||
7fbaaaa8f9 | |||
aa72fdab64 | |||
b9fbbbcafb | |||
7c72a59bef | |||
5609740216 | |||
58648d7037 | |||
048406aa02 | |||
b76954782b | |||
c2f63cb41e |
6
.cargo/config
Normal file
6
.cargo/config
Normal file
@ -0,0 +1,6 @@
|
||||
[http]
|
||||
timeout = 30 # timeout for each HTTP request, in seconds
|
||||
multiplexing = false # HTTP/2 multiplexing
|
||||
|
||||
[net]
|
||||
retry = 50 # network retries
|
@ -1,38 +0,0 @@
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
docker: circleci/docker@1.5.0
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
docker:
|
||||
- image: circleci/rust:latest
|
||||
resource_class: xlarge
|
||||
environment:
|
||||
RUST_BACKTRACE: 1
|
||||
steps:
|
||||
- checkout
|
||||
- run: |
|
||||
sudo bash .github/download_marine.sh
|
||||
- restore_cache:
|
||||
keys:
|
||||
- trust-graph00-{{ checksum "./Cargo.lock" }}-{{ checksum "./keypair/Cargo.lock" }}
|
||||
- run: |
|
||||
rustup target add wasm32-wasi
|
||||
cargo test --no-fail-fast --release --all-features --
|
||||
cd ./service
|
||||
./build.sh
|
||||
mkdir data
|
||||
cargo test --no-fail-fast --release --all-features -- --test-threads=1
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.cargo
|
||||
- ~/.rustup
|
||||
key: trust-graph00-{{ checksum "./Cargo.lock" }-{{ checksum "./service/Cargo.lock" }}}-{{ checksum "./keypair/Cargo.lock" }}
|
||||
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
CircleCI:
|
||||
jobs:
|
||||
- Build
|
2
.github/download_marine.sh
vendored
2
.github/download_marine.sh
vendored
@ -3,7 +3,7 @@ set -o pipefail -o errexit -o nounset
|
||||
set -x
|
||||
|
||||
MARINE_RELEASE="https://api.github.com/repos/fluencelabs/marine/releases/latest"
|
||||
OUT_DIR=/usr/local/bin
|
||||
OUT_DIR=~/.bin
|
||||
|
||||
# get metadata about release
|
||||
curl -s -H "Accept: application/vnd.github.v3+json" $MARINE_RELEASE |
|
||||
|
5
.github/workflows/changelog_config.json
vendored
5
.github/workflows/changelog_config.json
vendored
@ -1,5 +1,6 @@
|
||||
{
|
||||
"template": "${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
|
||||
"template": "## Changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
|
||||
"pr_template": "- #${{NUMBER}} ${{TITLE}}",
|
||||
"empty_template": "- no changes"
|
||||
"empty_template": "## No changes since ${{FROM_TAG}}",
|
||||
"sort": "DESC"
|
||||
}
|
||||
|
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
@ -6,9 +6,9 @@ on:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
npm-publish:
|
||||
release:
|
||||
name: "Publish"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: builder
|
||||
container: rust
|
||||
defaults:
|
||||
run:
|
||||
@ -30,36 +30,43 @@ jobs:
|
||||
- name: Download marine
|
||||
run: bash $GITHUB_WORKSPACE/.github/download_marine.sh
|
||||
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '11'
|
||||
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-v01-${{ hashFiles('**/package-lock.json') }}
|
||||
key: ${{ runner.os }}-node-v03-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-v01-
|
||||
${{ runner.os }}-node-v03-
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "15"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
~/.cargo/bin
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly-2021-09-01
|
||||
target: wasm32-wasi
|
||||
override: true
|
||||
- name: Install Rust
|
||||
working-directory: ./service
|
||||
run: |
|
||||
rustup toolchain install nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup default nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup override set nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup target add wasm32-wasi --toolchain nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
|
||||
### Build
|
||||
- name: trust-graph.wasm
|
||||
- name: Build trust-graph
|
||||
working-directory: ./service
|
||||
run: ./build.sh
|
||||
|
||||
@ -69,7 +76,7 @@ jobs:
|
||||
npm i
|
||||
npm run build
|
||||
|
||||
- name: Create builtin distribution package
|
||||
- name: Create distribution package
|
||||
run: |
|
||||
./builtin-package/package.sh
|
||||
|
||||
@ -81,15 +88,15 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
## Publish
|
||||
- name: Release
|
||||
### Publish
|
||||
- name: Release to GitHub
|
||||
id: release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: trust-graph ${{ env.RELEASE_VERSION }}
|
||||
tag_name: ${{ env.RELEASE_VERSION }}
|
||||
files: |
|
||||
trust-graph.tar.gz
|
||||
./trust-graph.tar.gz
|
||||
body: ${{steps.changelog.outputs.changelog}}
|
||||
draft: false
|
||||
prerelease: false
|
||||
@ -98,9 +105,9 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
### Publish Aqua API
|
||||
- name: Publish Aqua API
|
||||
- name: Publish Aqua API to NPM
|
||||
run: |
|
||||
npm version ${{ env.RELEASE_VERSION }} --allow-same-version
|
||||
npm version ${{ env.RELEASE_VERSION }}
|
||||
npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@ -141,7 +148,7 @@ jobs:
|
||||
with:
|
||||
workflow: update_service
|
||||
repo: fluencelabs/node-distro
|
||||
ref: 'tg-hl-api'
|
||||
ref: 'main'
|
||||
token: ${{ secrets.PERSONAL_TOKEN }}
|
||||
inputs: '{
|
||||
"name": "trust-graph",
|
||||
|
89
.github/workflows/rust_ci.yml
vendored
Normal file
89
.github/workflows/rust_ci.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
name: Rust CI
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: cargo nextest
|
||||
runs-on: builder
|
||||
container: rust
|
||||
defaults:
|
||||
run:
|
||||
working-directory: service
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- run: mkdir -p ~/.bin
|
||||
- run: echo "~/.bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install Rust
|
||||
working-directory: ./service
|
||||
run: |
|
||||
rustup toolchain install nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup default nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup override set nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
rustup target add wasm32-wasi --toolchain nightly-2022-01-16-x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Download jq
|
||||
run: |
|
||||
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o ~/.bin/jq
|
||||
chmod +x ~/.bin/jq
|
||||
|
||||
- name: Download marine
|
||||
run: bash $GITHUB_WORKSPACE/.github/download_marine.sh
|
||||
|
||||
- name: Build
|
||||
run: ./build.sh
|
||||
|
||||
- run: cargo install --locked cargo-nextest --version 0.9.22
|
||||
- run: cargo nextest run --release --all-features --no-fail-fast --retries 10 --test-threads 10
|
||||
|
||||
lints:
|
||||
name: Lints
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Run cargo fmt
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
- name: Run cargo clippy
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -Z unstable-options --all
|
||||
continue-on-error: true # do not fail for now
|
8
.github/workflows/tag.yml
vendored
8
.github/workflows/tag.yml
vendored
@ -10,8 +10,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get branch
|
||||
run: |
|
||||
BRANCH=${GITHUB_REF#refs/*/}
|
||||
SANITIZED=$(echo "$BRANCH" | sed -e 's/[^a-zA-Z0-9-]/-/g')
|
||||
echo "BRANCH=$SANITIZED" >> $GITHUB_ENV
|
||||
|
||||
- name: Bump version and push tag
|
||||
id: tag_version
|
||||
uses: mathieudutour/github-tag-action@v5.5
|
||||
with:
|
||||
append_to_pre_release_tag: ${{ env.BRANCH }}
|
||||
github_token: ${{ secrets.PERSONAL_TOKEN }}
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,3 +16,5 @@ example/src/generated/**
|
||||
example/generated/**
|
||||
admin/src/generated/**
|
||||
admin/generated/**
|
||||
|
||||
target
|
||||
|
502
Cargo.lock
generated
502
Cargo.lock
generated
@ -23,7 +23,7 @@ version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom 0.2.3",
|
||||
"getrandom 0.2.4",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
@ -39,9 +39,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.52"
|
||||
version = "1.0.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3"
|
||||
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
@ -64,6 +64,12 @@ dependencies = [
|
||||
"asn1_der_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "asn1_der"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21"
|
||||
|
||||
[[package]]
|
||||
name = "asn1_der_derive"
|
||||
version = "0.1.2"
|
||||
@ -82,9 +88,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.63"
|
||||
version = "0.3.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6"
|
||||
checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
@ -95,6 +101,12 @@ dependencies = [
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.3"
|
||||
@ -146,6 +158,15 @@ dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-padding"
|
||||
version = "0.1.5"
|
||||
@ -379,6 +400,15 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
|
||||
dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-mac"
|
||||
version = "0.7.0"
|
||||
@ -417,7 +447,7 @@ checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"digest 0.9.0",
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
"subtle 2.4.1",
|
||||
"zeroize",
|
||||
]
|
||||
@ -527,6 +557,17 @@ dependencies = [
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.0",
|
||||
"crypto-common",
|
||||
"generic-array 0.14.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ed25519"
|
||||
version = "1.3.0"
|
||||
@ -545,7 +586,7 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"ed25519",
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"sha2 0.9.9",
|
||||
@ -570,9 +611,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.3.17"
|
||||
version = "0.3.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44a5d80251b806a14cd3e4e1a582e912d5cbf6904ab19fdefbd7a56adca088e1"
|
||||
checksum = "56047058e1ab118075ca22f9ecd737bcc961aa3566a3019cb71388afa280bd8a"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -600,9 +641,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "eyre"
|
||||
version = "0.6.5"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "221239d1d5ea86bf5d6f91c9d6bc3646ffe471b08ff9b0f91c44f115ac969d2b"
|
||||
checksum = "bc225d8f637923fe585089fcf03e705c222131232d2c1fb622e84ecf725d0eb8"
|
||||
dependencies = [
|
||||
"indenter",
|
||||
"once_cell",
|
||||
@ -650,18 +691,18 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.6.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
version = "0.2.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||
checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
|
||||
|
||||
[[package]]
|
||||
name = "fluence-app-service"
|
||||
@ -705,73 +746,6 @@ dependencies = [
|
||||
"wasmer-wasi-fl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-fork-libp2p-core"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ffef53cfb8b873bf75998669b0aedd5212907d29d8be8e7915c4695967c40d"
|
||||
dependencies = [
|
||||
"asn1_der",
|
||||
"bs58 0.4.0",
|
||||
"ed25519-dalek",
|
||||
"either",
|
||||
"fluence-fork-multistream-select",
|
||||
"fluence-fork-parity-multiaddr",
|
||||
"fnv",
|
||||
"futures",
|
||||
"futures-timer",
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"log",
|
||||
"multihash",
|
||||
"parking_lot 0.11.2",
|
||||
"pin-project 1.0.10",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"rand",
|
||||
"ring",
|
||||
"rw-stream-sink",
|
||||
"serde",
|
||||
"sha2 0.9.9",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"unsigned-varint 0.7.1",
|
||||
"void",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-fork-multistream-select"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34dacd25fddb6fed5c3fa6109fb29e4eea49b731a2548e09f4e54620fa4d6310"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures",
|
||||
"log",
|
||||
"pin-project 1.0.10",
|
||||
"smallvec",
|
||||
"unsigned-varint 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-fork-parity-multiaddr"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06228daafbf129ef49806f15779857012c01d49658930d086498e78f12191da7"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"bs58 0.4.0",
|
||||
"byteorder",
|
||||
"data-encoding",
|
||||
"multihash",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"unsigned-varint 0.7.1",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-it-types"
|
||||
version = "0.3.1"
|
||||
@ -787,18 +761,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fluence-keypair"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"asn1_der",
|
||||
"asn1_der 0.6.3",
|
||||
"bs58 0.3.1",
|
||||
"ed25519",
|
||||
"ed25519-dalek",
|
||||
"eyre",
|
||||
"fluence-fork-libp2p-core",
|
||||
"lazy_static",
|
||||
"libsecp256k1",
|
||||
"libp2p-core",
|
||||
"libsecp256k1 0.3.5",
|
||||
"quickcheck",
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"ring",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
@ -964,9 +938,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
|
||||
checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
@ -1052,6 +1026,16 @@ dependencies = [
|
||||
"digest 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
|
||||
dependencies = [
|
||||
"crypto-mac 0.8.0",
|
||||
"digest 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac-drbg"
|
||||
version = "0.2.0"
|
||||
@ -1060,7 +1044,18 @@ checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b"
|
||||
dependencies = [
|
||||
"digest 0.8.1",
|
||||
"generic-array 0.12.4",
|
||||
"hmac",
|
||||
"hmac 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac-drbg"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1"
|
||||
dependencies = [
|
||||
"digest 0.9.0",
|
||||
"generic-array 0.14.5",
|
||||
"hmac 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1114,9 +1109,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "inventory"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa2f6fdbc5fd6457ae78e0313ba2eb5cb509655bbcfe8c577096cdbae8ff621c"
|
||||
checksum = "ce6b5d8c669bfbad811d95ddd7a1c6cf9cfdbf2777e59928b6f3fa8ff54f72a0"
|
||||
dependencies = [
|
||||
"ctor",
|
||||
"ghost",
|
||||
@ -1166,9 +1161,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.55"
|
||||
version = "0.3.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
|
||||
checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@ -1200,9 +1195,44 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.112"
|
||||
version = "0.2.116"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||
checksum = "565dbd88872dbe4cc8a46e527f26483c1d1f7afa6b884a3bd6cd893d4f98da74"
|
||||
|
||||
[[package]]
|
||||
name = "libp2p-core"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a24250cce58fb6ccb32e26647c1c25b48b6f7bd2d6fb3d6dba72001a6694b385"
|
||||
dependencies = [
|
||||
"asn1_der 0.7.5",
|
||||
"bs58 0.4.0",
|
||||
"ed25519-dalek",
|
||||
"either",
|
||||
"fnv",
|
||||
"futures",
|
||||
"futures-timer",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
"libsecp256k1 0.7.0",
|
||||
"log",
|
||||
"multiaddr",
|
||||
"multihash",
|
||||
"multistream-select",
|
||||
"parking_lot 0.11.2",
|
||||
"pin-project 1.0.10",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"rand 0.8.4",
|
||||
"ring",
|
||||
"rw-stream-sink",
|
||||
"sha2 0.10.1",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"unsigned-varint",
|
||||
"void",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
@ -1213,13 +1243,61 @@ dependencies = [
|
||||
"arrayref",
|
||||
"crunchy",
|
||||
"digest 0.8.1",
|
||||
"hmac-drbg",
|
||||
"rand",
|
||||
"hmac-drbg 0.2.0",
|
||||
"rand 0.7.3",
|
||||
"sha2 0.8.2",
|
||||
"subtle 2.4.1",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"base64",
|
||||
"digest 0.9.0",
|
||||
"hmac-drbg 0.3.0",
|
||||
"libsecp256k1-core",
|
||||
"libsecp256k1-gen-ecmult",
|
||||
"libsecp256k1-gen-genmult",
|
||||
"rand 0.8.4",
|
||||
"serde",
|
||||
"sha2 0.9.9",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-core"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
"digest 0.9.0",
|
||||
"subtle 2.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-ecmult"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsecp256k1-gen-genmult"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c"
|
||||
dependencies = [
|
||||
"libsecp256k1-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.23.2"
|
||||
@ -1241,9 +1319,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
|
||||
checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
@ -1542,16 +1620,34 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multihash"
|
||||
version = "0.13.2"
|
||||
name = "multiaddr"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab"
|
||||
checksum = "48ee4ea82141951ac6379f964f71b20876d43712bea8faf6dd1a375e08a46499"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"bs58 0.4.0",
|
||||
"byteorder",
|
||||
"data-encoding",
|
||||
"multihash",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
"unsigned-varint",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multihash"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8"
|
||||
dependencies = [
|
||||
"digest 0.9.0",
|
||||
"generic-array 0.14.5",
|
||||
"multihash-derive",
|
||||
"sha2 0.9.9",
|
||||
"unsigned-varint 0.5.1",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1577,6 +1673,20 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multistream-select"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures",
|
||||
"log",
|
||||
"pin-project 1.0.10",
|
||||
"smallvec",
|
||||
"unsigned-varint",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.15.0"
|
||||
@ -1696,7 +1806,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api 0.4.5",
|
||||
"lock_api 0.4.6",
|
||||
"parking_lot_core 0.8.5",
|
||||
]
|
||||
|
||||
@ -1751,9 +1861,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
||||
checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap",
|
||||
@ -1879,9 +1989,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2"
|
||||
checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost-derive",
|
||||
@ -1889,30 +1999,32 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-build"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3"
|
||||
checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"heck",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.3",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"multimap",
|
||||
"petgraph",
|
||||
"prost",
|
||||
"prost-types",
|
||||
"regex",
|
||||
"tempfile",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prost-derive"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4"
|
||||
checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools 0.9.0",
|
||||
"itertools 0.10.3",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -1920,9 +2032,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prost-types"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb"
|
||||
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost",
|
||||
@ -1947,15 +2059,15 @@ checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"log",
|
||||
"rand",
|
||||
"rand_core",
|
||||
"rand 0.7.3",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.14"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
|
||||
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -1968,9 +2080,21 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
"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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1980,7 +2104,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1992,13 +2126,31 @@ 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.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2125,9 +2277,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rmp-serde"
|
||||
version = "0.15.1"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f74489002493a9984ee753ebd049552a1c82f0740e347ee9fc57c907fb19f83"
|
||||
checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"rmp",
|
||||
@ -2164,6 +2316,12 @@ dependencies = [
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
|
||||
|
||||
[[package]]
|
||||
name = "rw-stream-sink"
|
||||
version = "0.2.1"
|
||||
@ -2228,9 +2386,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.118"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@ -2266,9 +2424,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.118"
|
||||
version = "1.0.136"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
|
||||
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2277,9 +2435,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.74"
|
||||
version = "1.0.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
|
||||
checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -2288,10 +2446,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "1.6.4"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b44be9227e214a0420707c9ca74c2d4991d9955bae9415a8f93f05cebf561be5"
|
||||
checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
"serde",
|
||||
"serde_with_macros",
|
||||
]
|
||||
@ -2333,6 +2492,17 @@ dependencies = [
|
||||
"opaque-debug 0.3.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99c3bd8169c58782adad9290a9af5939994036b76187f7b4f0e6de91dbbfc0ec"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"cpufeatures",
|
||||
"digest 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "1.5.0"
|
||||
@ -2347,9 +2517,9 @@ checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
|
||||
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
@ -2383,9 +2553,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.85"
|
||||
version = "1.0.86"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
|
||||
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2486,11 +2656,11 @@ dependencies = [
|
||||
"bs58 0.3.1",
|
||||
"derivative",
|
||||
"failure",
|
||||
"fluence-fork-libp2p-core",
|
||||
"fluence-keypair",
|
||||
"libp2p-core",
|
||||
"log",
|
||||
"nonempty",
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -2502,14 +2672,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "trust-graph-wasm"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bincode",
|
||||
"boolinator",
|
||||
"bs58 0.3.1",
|
||||
"fluence-fork-libp2p-core",
|
||||
"fluence-keypair",
|
||||
"libp2p-core",
|
||||
"log",
|
||||
"marine-rs-sdk",
|
||||
"marine-rs-sdk-test",
|
||||
@ -2587,12 +2757,6 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "unsigned-varint"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35"
|
||||
|
||||
[[package]]
|
||||
name = "unsigned-varint"
|
||||
version = "0.7.1"
|
||||
@ -2623,7 +2787,7 @@ version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.3",
|
||||
"getrandom 0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2694,9 +2858,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
|
||||
checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
@ -2704,9 +2868,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
|
||||
checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
@ -2719,9 +2883,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
|
||||
checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@ -2729,9 +2893,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
|
||||
checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2742,9 +2906,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.78"
|
||||
version = "0.2.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
|
||||
checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2"
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-clif-backend-fl"
|
||||
@ -2945,9 +3109,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.55"
|
||||
version = "0.3.56"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
|
||||
checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@ -2955,9 +3119,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.2.2"
|
||||
version = "4.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9"
|
||||
checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2"
|
||||
dependencies = [
|
||||
"either",
|
||||
"lazy_static",
|
||||
@ -2988,18 +3152,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.4.3"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619"
|
||||
checksum = "4062c749be08d90be727e9c5895371c3a0e49b90ba2b9592dc7afda95cc2b719"
|
||||
dependencies = [
|
||||
"zeroize_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize_derive"
|
||||
version = "1.2.2"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73"
|
||||
checksum = "81e8f13fef10b63c06356d65d416b070798ddabcadc10d3ece0c5be9b3c7eddb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -8,10 +8,10 @@ license = "Apache-2.0"
|
||||
repository = "https://github.com/fluencelabs/trust-graph"
|
||||
|
||||
[dependencies]
|
||||
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.27.2", features = ["secp256k1"] }
|
||||
serde = { version = "=1.0.118", features = ["derive"] }
|
||||
libp2p-core = { version = "0.31", default-features = false, features = [ "secp256k1" ] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
|
||||
fluence-keypair = { path = "./keypair", version = "0.5.0" }
|
||||
fluence-keypair = { path = "./keypair", version = "0.6.0" }
|
||||
serde_json = "1.0.58"
|
||||
bs58 = "0.3.1"
|
||||
failure = "0.1.6"
|
||||
|
@ -77,11 +77,16 @@ func my_function(peer_id: string) -> u32:
|
||||
let max_chain_len = 2;
|
||||
let far_future = tg.timestamp_sec() + 9999999999;
|
||||
let error = await tg.add_root_trust(relay, peer_id, max_chain_len, far_future);
|
||||
assert(error == null)
|
||||
if (error !== null) {
|
||||
console.log(error);
|
||||
}
|
||||
```
|
||||
5. For now, trusts/revocations can only be signed with the client's private key.
|
||||
Keypair specification will be available soon.
|
||||
```typescript
|
||||
// issue signed trust
|
||||
let error = await tg.issue_trust(relay, peer_id, issued_for_peer_id, expires_at_sec);
|
||||
if (error !== null) {
|
||||
console.log(error);
|
||||
}
|
||||
```
|
||||
|
@ -62,20 +62,21 @@ async function main(environment: Node[]) {
|
||||
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));
|
||||
let root_trust = 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));
|
||||
let issuer_trust = 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[0], trust]};
|
||||
certificates.push(cert);
|
||||
let example_trust = await issue_trust_helper(node, root_kp, root_kp.Libp2pPeerId.toB58String(), example_kp.Libp2pPeerId.toB58String(), expires_at, cur_time);
|
||||
|
||||
// cert for example key
|
||||
certificates.push({chain: [root_trust, example_trust]});
|
||||
|
||||
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);
|
||||
let cert = {chain: [...common_chain, trust]};
|
||||
let node_trust = await issue_trust_helper(node, issuer_kp, issuer_kp.Libp2pPeerId.toB58String(), krasnodar[i].peerId, expires_at, cur_time);
|
||||
// cert for every krasnodar node
|
||||
let cert = {chain: [root_trust, issuer_trust, node_trust]};
|
||||
certificates.push(cert);
|
||||
}
|
||||
|
||||
|
16
admin/package-lock.json
generated
16
admin/package-lock.json
generated
@ -10,7 +10,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua": "^0.5.2-257",
|
||||
"@fluencelabs/aqua-lib": "^0.3.2",
|
||||
"@fluencelabs/aqua-lib": "^0.3.4",
|
||||
"@fluencelabs/fluence": "^0.18.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.10",
|
||||
"@fluencelabs/trust-graph": "file:../aqua",
|
||||
@ -22,7 +22,7 @@
|
||||
},
|
||||
"../aqua": {
|
||||
"name": "@fluencelabs/trust-graph",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.3.1"
|
||||
@ -133,9 +133,9 @@
|
||||
"integrity": "sha512-H2Q4gIvociUxc4J2mwmH0D+mrU2N2Z+enKCHgBCanMVEE2wZDsZ80GTbDKsQjEq+gpqbnJIk8lJBYW6lyvLJTg=="
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua-lib": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.3.2.tgz",
|
||||
"integrity": "sha512-8+NKFwRg9SFzpbac1SvvTWcOgHhMoYZwRyb93qJRcNFaN7xjRcA8v0i6CF7Mkjno1zH3xixC9J44+LKQd8uvzA=="
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.3.4.tgz",
|
||||
"integrity": "sha512-DH7TZgflTJDxK18URlELnHI65jYtZf7b5e25gjRL9AiT/nvdodQqSvCcdVKK/jvhPy9q3RXM/rOcHfqh5mmpSQ=="
|
||||
},
|
||||
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/aqua-lib": {
|
||||
"version": "0.2.1",
|
||||
@ -4345,9 +4345,9 @@
|
||||
}
|
||||
},
|
||||
"@fluencelabs/aqua-lib": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.3.2.tgz",
|
||||
"integrity": "sha512-8+NKFwRg9SFzpbac1SvvTWcOgHhMoYZwRyb93qJRcNFaN7xjRcA8v0i6CF7Mkjno1zH3xixC9J44+LKQd8uvzA=="
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.3.4.tgz",
|
||||
"integrity": "sha512-DH7TZgflTJDxK18URlELnHI65jYtZf7b5e25gjRL9AiT/nvdodQqSvCcdVKK/jvhPy9q3RXM/rOcHfqh5mmpSQ=="
|
||||
},
|
||||
"@fluencelabs/avm": {
|
||||
"version": "0.20.0",
|
||||
|
@ -14,7 +14,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua": "^0.5.2-257",
|
||||
"@fluencelabs/aqua-lib": "^0.3.2",
|
||||
"@fluencelabs/aqua-lib": "^0.3.4",
|
||||
"@fluencelabs/fluence": "^0.18.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.10",
|
||||
"@fluencelabs/trust-graph": "file:../aqua",
|
||||
|
39
aqua/labelling.aqua
Normal file
39
aqua/labelling.aqua
Normal file
@ -0,0 +1,39 @@
|
||||
import "misc.aqua"
|
||||
import get_host_certs_from from "trust-graph-api.aqua"
|
||||
|
||||
alias Error: string
|
||||
|
||||
-- TrustGraph builtin distributed with predefined certificates which used to identify Fluence Labs peers.
|
||||
-- Each certificate contains 3 trusts: self-signed fluence root trust, trust for label trust and trust to target peer.
|
||||
--
|
||||
-- Usage:
|
||||
-- on target_node:
|
||||
-- result, error <- isFluencePeer()
|
||||
--
|
||||
-- Returns:
|
||||
-- `true, nil` if `target_node` is identified as official Fluence Labs peer
|
||||
-- `false, nil` otherwise
|
||||
--
|
||||
-- Errors:
|
||||
-- if get_host_certs_from failed, `nil, error_msg` is returned
|
||||
func isFluencePeer() -> ?bool, ?Error:
|
||||
fluence_root_peer_id = "12D3KooWNbZKaPWRZ8wgjGvrxdJFz9Fq5uVwkR6ERV1f74HhPdyB"
|
||||
label_peer_id = "12D3KooWM45u7AQxsb4MuQJNYT3NWHHMLU7JTbBV66RTfF3KSzdR"
|
||||
|
||||
result: ?bool
|
||||
error: *Error
|
||||
-- get all certs issued by `label_peer_id` to current host
|
||||
certs_result <- get_host_certs_from(label_peer_id)
|
||||
|
||||
if certs_result.success:
|
||||
for cert <- certs_result.certificates:
|
||||
len <- TrustOp.array_length(cert.chain)
|
||||
if len == 3:
|
||||
if cert.chain!0.issued_for == fluence_root_peer_id:
|
||||
if cert.chain!1.issued_for == label_peer_id:
|
||||
result <<- true
|
||||
if result == nil:
|
||||
result <<- false
|
||||
else:
|
||||
error <<- certs_result.error
|
||||
<- result, error
|
@ -1,8 +1,15 @@
|
||||
import "trust-graph.aqua"
|
||||
|
||||
alias Error: string
|
||||
|
||||
-- helpers for isFluencePeer
|
||||
service TrustOp("op"):
|
||||
array_length(a: []Trust) -> u32
|
||||
|
||||
service BoolOp("op"):
|
||||
array_length(a: []bool) -> u32
|
||||
|
||||
-- check if error is not nil and append to error_stream
|
||||
func append_error(error_stream: *Error, error: ?Error):
|
||||
if error != nil:
|
||||
error_stream <<- error!
|
||||
|
9345
aqua/package-lock.json
generated
9345
aqua/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
"*.aqua"
|
||||
],
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-lib": "^0.3.1"
|
||||
"@fluencelabs/aqua-lib": "^0.5.2"
|
||||
},
|
||||
"scripts": {
|
||||
"generate-aqua": "../service/build.sh",
|
||||
@ -31,6 +31,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/fluencelabs/trust-graph#readme",
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "^0.5.2-257"
|
||||
"@fluencelabs/aqua": "^0.7.4-322"
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import "trust-graph.aqua"
|
||||
import Sig, Peer, PeerId from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
import "misc.aqua"
|
||||
import Sig, Peer from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
import "trust-graph.aqua"
|
||||
|
||||
alias PeerId: string
|
||||
alias Error: string
|
||||
|
||||
-- Set peer_id as a root to TG instance on current node
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Set `peer_id` as a root
|
||||
-- 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
|
||||
@ -13,126 +13,146 @@ func set_root(peer_id: PeerId, max_chain_len: u32) -> SetRootResult:
|
||||
result <- TrustGraph.set_root(peer_id, max_chain_len)
|
||||
<- result
|
||||
|
||||
-- Create and sign trust
|
||||
-- Call context: %init_peer_id%
|
||||
-- Create on relay and sign trust on client
|
||||
-- If `issuer` is not %init_peer_id%, Sig service with `issuer` peer id as service id should be defined
|
||||
-- Errors:
|
||||
-- If TrustGraph.get_trust_bytes or TrustGraph.issue_trust fails, (nil, error) is returned.
|
||||
func issue_trust(issuer: PeerId, issued_for: PeerId, expires_at_sec: u64) -> ?Trust, ?Error:
|
||||
-- after marine-web release this will be done on %init_peer_id%
|
||||
on HOST_PEER_ID:
|
||||
issued_at_sec <- Peer.timestamp_sec()
|
||||
bytes <- TrustGraph.get_trust_bytes(issued_for, expires_at_sec, issued_at_sec)
|
||||
|
||||
result: ?Trust
|
||||
error: ?string
|
||||
error: *Error
|
||||
if bytes.success:
|
||||
if issuer != %init_peer_id%:
|
||||
Sig issuer
|
||||
else:
|
||||
Sig "sig"
|
||||
|
||||
signature <- Sig.sign(bytes.result)
|
||||
sig_res <- Sig.sign(bytes.result)
|
||||
|
||||
if sig_res.success:
|
||||
on HOST_PEER_ID:
|
||||
issue_result <- TrustGraph.issue_trust(issued_for, expires_at_sec, issued_at_sec, signature)
|
||||
issue_result <- TrustGraph.issue_trust(issued_for, expires_at_sec, issued_at_sec, sig_res.signature!)
|
||||
if issue_result.success:
|
||||
result <<- issue_result.trust
|
||||
else:
|
||||
error <<- issue_result.error
|
||||
else:
|
||||
error <<- sig_res.error!
|
||||
else:
|
||||
error <<- bytes.error
|
||||
<- result, error
|
||||
|
||||
-- Add trust to TG instance on current node
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Add trust to TG
|
||||
-- Errors:
|
||||
-- If TrustGraph.add_trust fails, error is returned.
|
||||
func import_trust(trust: Trust, issuer: PeerId) -> ?Error:
|
||||
error: ?string
|
||||
error: *Error
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
add_result <- TrustGraph.add_trust(trust, issuer, timestamp_sec)
|
||||
if add_result.success != true:
|
||||
error <<- add_result.error
|
||||
<- error
|
||||
|
||||
-- Call context: %init_peer_id%
|
||||
-- Issue trust and add to TG instance on `node`
|
||||
-- If `issuer` is not %init_peer_id%, Sig service with `issuer` peer id as service id should be defined
|
||||
-- Errors:
|
||||
-- If issue_trust or import_trust fails, error is returned.
|
||||
func add_trust(node: PeerId, issuer: PeerId, issued_for: PeerId, expires_at_sec: u64) -> ?Error:
|
||||
trust, issue_error <- issue_trust(issuer, issued_for, expires_at_sec)
|
||||
|
||||
error: *?Error
|
||||
if trust == nil:
|
||||
error <<- issue_error
|
||||
error: *Error
|
||||
if issue_error != nil:
|
||||
error <<- issue_error!
|
||||
else:
|
||||
on node:
|
||||
error <- import_trust(trust!, issuer)
|
||||
|
||||
<- error!
|
||||
import_error <- import_trust(trust!, issuer)
|
||||
append_error(error, import_error)
|
||||
<- error
|
||||
|
||||
-- Call context: %init_peer_id%
|
||||
-- Set `peer_id` as a root and add self-signed trust to TG instance on `node`
|
||||
-- If `peer_id` is not %init_peer_id%, Sig service with `peer_id` as service id should be defined
|
||||
-- Errors:
|
||||
-- If issue_trust, import_trust or set_root fails, error is returned.
|
||||
func add_root_trust(node: PeerId, peer_id: PeerId, max_chain_len: u32, expires_at_sec: u64) -> ?Error:
|
||||
trust, issue_error <- issue_trust(peer_id, peer_id, expires_at_sec)
|
||||
|
||||
error: *?Error
|
||||
if trust == nil:
|
||||
error <<- issue_error
|
||||
error: *Error
|
||||
if issue_error != nil:
|
||||
error <<- issue_error!
|
||||
else:
|
||||
on node:
|
||||
set_root_result <- set_root(peer_id, max_chain_len)
|
||||
if set_root_result.success:
|
||||
error <- import_trust(trust!, peer_id)
|
||||
import_error <- import_trust(trust!, peer_id)
|
||||
append_error(error, import_error)
|
||||
else:
|
||||
-- converting string to ?string
|
||||
tmp: *string
|
||||
tmp <<- set_root_result.error
|
||||
error <<- tmp
|
||||
error <<- set_root_result.error
|
||||
|
||||
<- error!
|
||||
<- error
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Check signature and expiration time of trust
|
||||
func verify_trust(trust: Trust, issuer: PeerId) -> VerifyTrustResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.verify_trust(trust, issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Get the maximum weight of trust for one peer id
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Get the maximum weight of trust for `peer_id`
|
||||
-- Trust has weight if there is at least 1 trust chain from one of the roots
|
||||
func get_weight(peer_id: PeerId) -> 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`
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Get maximum weight of trust for `peer_id` among all chains which contain trust from `issuer`
|
||||
func get_weight_from(peer_id: PeerId, issuer: PeerId) -> WeightResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_weight_from(peer_id, issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Call context: %init_peer_id%
|
||||
-- Create revocation signed by %init_peer_id%
|
||||
-- If `revoked_by` is not %init_peer_id%, Sig service with `revoked_by` peer id as service id should be defined
|
||||
-- Errors:
|
||||
-- If TrustGraph.get_revocation_bytes or TrustGraph.issue_revocation fails, (nil, error) is returned.
|
||||
func issue_revocation(revoked_by: PeerId, revoked: PeerId) -> ?Revocation, ?Error:
|
||||
-- after marine-web release this will be done on %init_peer_id%
|
||||
on HOST_PEER_ID:
|
||||
issued_at_sec <- Peer.timestamp_sec()
|
||||
bytes <- TrustGraph.get_revocation_bytes(revoked, issued_at_sec)
|
||||
|
||||
result: ?Revocation
|
||||
error: ?string
|
||||
error: *Error
|
||||
if bytes.success:
|
||||
if revoked_by != %init_peer_id%:
|
||||
Sig revoked_by
|
||||
else:
|
||||
Sig "sig"
|
||||
|
||||
signature <- Sig.sign(bytes.result)
|
||||
sig_res <- Sig.sign(bytes.result)
|
||||
|
||||
if sig_res.success:
|
||||
on HOST_PEER_ID:
|
||||
issue_result <- TrustGraph.issue_revocation(revoked_by, revoked, issued_at_sec, signature)
|
||||
issue_result <- TrustGraph.issue_revocation(revoked_by, revoked, issued_at_sec, sig_res.signature!)
|
||||
if issue_result.success:
|
||||
result <<- issue_result.revocation
|
||||
else:
|
||||
error <<- issue_result.error
|
||||
else:
|
||||
error <<- sig_res.error!
|
||||
else:
|
||||
error <<- bytes.error
|
||||
<- result, error
|
||||
|
||||
-- Import revocation to current node's TG instance
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Import revocation to TG
|
||||
-- Errors:
|
||||
-- If TrustGraph.revoke fails, error is returned.
|
||||
func import_revocation(revocation: Revocation) -> ?Error:
|
||||
error: ?string
|
||||
error: *Error
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
add_result <- TrustGraph.revoke(revocation, timestamp_sec)
|
||||
if add_result.success != true:
|
||||
@ -140,68 +160,55 @@ func import_revocation(revocation: Revocation) -> ?Error:
|
||||
|
||||
<- error
|
||||
|
||||
-- Call context: %init_peer_id%
|
||||
-- Revoke all certificates on `node` TG instance
|
||||
-- which contain path from %init_peer_id% to `revoked_peer_id`
|
||||
-- If `revoked_by` is not %init_peer_id%, Sig service with `revoked_by` peer id as service id should be defined
|
||||
-- Errors:
|
||||
-- if issue_revocation or import_revocation fails, error is returned.
|
||||
func revoke(node: PeerId, revoked_by: PeerId, revoked: PeerId) -> ?Error:
|
||||
revocation, issue_error <- issue_revocation(revoked_by, revoked)
|
||||
|
||||
error: *?string
|
||||
error: *Error
|
||||
if revocation == nil:
|
||||
error <<- issue_error
|
||||
error <<- issue_error!
|
||||
else:
|
||||
on node:
|
||||
error <- import_revocation(revocation!)
|
||||
|
||||
<- error!
|
||||
|
||||
|
||||
import_error <- import_revocation(revocation!)
|
||||
append_error(error, import_error)
|
||||
<- error
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Return all certificates issued for current node which contains trust from `issuer`
|
||||
func get_host_certs_from(issuer: PeerId) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_host_certs_from(issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Return all certificates issued for given peer id
|
||||
func get_all_certs(issued_for: PeerId) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_all_certs(issued_for, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- Return all certificates issued for given peer id which contains trust from `issuer`
|
||||
func get_all_certs_from(issued_for: PeerId, issuer: PeerId) -> AllCertsResult:
|
||||
timestamp_sec <- Peer.timestamp_sec()
|
||||
result <- TrustGraph.get_all_certs_from(issued_for, issuer, timestamp_sec)
|
||||
<- result
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- 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
|
||||
|
||||
-- Call context: any node with registered `trust-graph` service
|
||||
-- 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
|
||||
|
||||
-- returns `true` if current node is identified as official Fluence Labs peer
|
||||
-- returns `false` otherwise
|
||||
func isFluencePeer() -> ?bool, ?Error:
|
||||
certs_result <- get_host_certs_from("12D3KooWM45u7AQxsb4MuQJNYT3NWHHMLU7JTbBV66RTfF3KSzdR")
|
||||
result: ?bool
|
||||
error: ?string
|
||||
if certs_result.success:
|
||||
for cert <- certs_result.certificates:
|
||||
len <- TrustOp.array_length(cert.chain)
|
||||
if len == 3:
|
||||
if cert.chain!0.issued_for == "12D3KooWNbZKaPWRZ8wgjGvrxdJFz9Fq5uVwkR6ERV1f74HhPdyB":
|
||||
if cert.chain!1.issued_for == "12D3KooWM45u7AQxsb4MuQJNYT3NWHHMLU7JTbBV66RTfF3KSzdR":
|
||||
result <<- true
|
||||
if result == nil:
|
||||
result <<- false
|
||||
else:
|
||||
error <<- certs_result.error
|
||||
<- result, error
|
||||
|
@ -1,5 +1,6 @@
|
||||
(seq
|
||||
(seq
|
||||
; set fluence root peer id as TG root
|
||||
(call relay ("trust-graph" "set_root") ["12D3KooWNbZKaPWRZ8wgjGvrxdJFz9Fq5uVwkR6ERV1f74HhPdyB" 5] add_root_res)
|
||||
(xor
|
||||
(match add_root_res.$.success! true
|
||||
@ -14,6 +15,7 @@
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("peer" "timestamp_sec") [] cur_time)
|
||||
; insert all certificates from on_start.json
|
||||
(call relay ("trust-graph" "insert_cert") [i cur_time] insert_result)
|
||||
)
|
||||
(xor
|
||||
|
@ -11,8 +11,9 @@ service CertOp("op"):
|
||||
service TrustedComputation("op"):
|
||||
identity(s: u64) -> u64
|
||||
|
||||
func trusted_computation(node: string) -> ?u64:
|
||||
func trusted_computation(node: string) -> ?u64, ?string:
|
||||
result: ?u64
|
||||
error: ?string
|
||||
-- on our trusted relay
|
||||
on HOST_PEER_ID:
|
||||
-- get all certificates issued for given node by our client's peer id
|
||||
@ -23,5 +24,8 @@ func trusted_computation(node: string) -> ?u64:
|
||||
if len != 0:
|
||||
on node:
|
||||
result <- TrustedComputation.identity(5)
|
||||
|
||||
<- result
|
||||
else:
|
||||
error <<- "there is no certs for this peer"
|
||||
else:
|
||||
error <<- certs_result.error
|
||||
<- result, error
|
||||
|
@ -1,5 +1,6 @@
|
||||
module Export
|
||||
import add_root_trust, add_trust, revoke from "@fluencelabs/trust-graph/trust-graph-api.aqua"
|
||||
export add_root_trust, add_trust, revoke
|
||||
export add_root_trust, add_trust, revoke, timestamp_sec
|
||||
import Peer from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||
|
||||
alias PeerId: string
|
||||
@ -8,6 +9,3 @@ func timestamp_sec() -> u64:
|
||||
on HOST_PEER_ID:
|
||||
result <- Peer.timestamp_sec()
|
||||
<- result
|
||||
|
||||
service Sig:
|
||||
sign(msg: []u8) -> []u8
|
||||
|
@ -19,7 +19,6 @@ 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, registerSig} from "./generated/export";
|
||||
const bs58 = require('bs58');
|
||||
|
||||
let local: Node[] = [
|
||||
@ -43,15 +42,18 @@ let local: Node[] = [
|
||||
async function revoke_all(relay: string, revoked_by: string) {
|
||||
for (var node of local) {
|
||||
let error = await tg.revoke(relay, revoked_by, node.peerId);
|
||||
if (error !== null) {
|
||||
console.log(error)
|
||||
assert(error == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
async function add_root(relay: string, peer_id: string) {
|
||||
let current_time = await tg.timestamp_sec();
|
||||
let far_future = current_time + 9999999;
|
||||
let error = await tg.add_root_trust(relay, peer_id, 2, far_future);
|
||||
assert(error == null);
|
||||
if (error !== null) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
async function add_new_trust_checked(relay: string, issuer: string, issued_for_peer_id: string, expires_at_sec: number) {
|
||||
@ -73,12 +75,12 @@ async function revoke_checked(relay: string, revoked_by: string, revoked_peer_id
|
||||
}
|
||||
|
||||
async function exec_trusted_computation(node: string) {
|
||||
let result = await trusted_computation(node)
|
||||
let [result, error] = await trusted_computation(node)
|
||||
|
||||
if (result !== null) {
|
||||
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, error:", node, error)
|
||||
}
|
||||
}
|
||||
|
||||
|
8294
example/package-lock.json
generated
8294
example/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,14 +13,14 @@
|
||||
"author": "Fluence Labs",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua": "^0.5.2-257",
|
||||
"@fluencelabs/aqua-lib": "^0.3.2",
|
||||
"@fluencelabs/fluence": "^0.18.0",
|
||||
"@fluencelabs/aqua-lib": "^0.5.2",
|
||||
"@fluencelabs/fluence": "^0.23.0",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.10",
|
||||
"@fluencelabs/trust-graph": "file:../aqua",
|
||||
"@fluencelabs/trust-graph": "3.0.2",
|
||||
"bs58": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.5.2"
|
||||
"typescript": "^4.5.2",
|
||||
"@fluencelabs/aqua": "^0.7.4-325"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fluence-keypair"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
description = "identity"
|
||||
@ -8,7 +8,7 @@ license = "Apache-2.0"
|
||||
repository = "https://github.com/fluencelabs/trust-graph"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "=1.0.118", features = ["derive"] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
serde_json = "1.0.58"
|
||||
bs58 = "0.3.1"
|
||||
ed25519-dalek = { version = "1.0.1", features = ["serde", "std"] }
|
||||
@ -23,7 +23,7 @@ asn1_der = "0.6.1"
|
||||
sha2 = "0.9.1"
|
||||
zeroize = "1"
|
||||
serde_bytes = "0.11"
|
||||
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.27.2", features = ["secp256k1"]}
|
||||
libp2p-core = { version = "0.31", default-features = false, features = [ "secp256k1" ] }
|
||||
eyre = "0.6.5"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
|
3
keypair/rust-toolchain.toml
Normal file
3
keypair/rust-toolchain.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2022-01-16"
|
||||
targets = [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu" ]
|
@ -109,7 +109,7 @@ impl PublicKey {
|
||||
}
|
||||
|
||||
pub fn to_peer_id(&self) -> PeerId {
|
||||
PeerId::from_public_key(self.clone().into())
|
||||
PeerId::from_public_key(&self.clone().into())
|
||||
}
|
||||
|
||||
pub fn get_key_format(&self) -> KeyFormat {
|
||||
@ -164,13 +164,26 @@ impl TryFrom<libp2p_core::PeerId> for PublicKey {
|
||||
type Error = DecodingError;
|
||||
|
||||
fn try_from(peer_id: libp2p_core::PeerId) -> Result<Self, Self::Error> {
|
||||
Ok(peer_id
|
||||
.as_public_key()
|
||||
.ok_or(DecodingError::PublicKeyNotInlined(peer_id.to_base58()))?
|
||||
Ok(as_public_key(&peer_id)
|
||||
.ok_or_else(|| DecodingError::PublicKeyNotInlined(peer_id.to_base58()))?
|
||||
.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert PeerId to libp2p's PublicKey
|
||||
fn as_public_key(peer_id: &PeerId) -> Option<libp2p_core::PublicKey> {
|
||||
use libp2p_core::multihash;
|
||||
|
||||
let mhash = peer_id.as_ref();
|
||||
|
||||
match multihash::Code::try_from(mhash.code()) {
|
||||
Ok(multihash::Code::Identity) => {
|
||||
libp2p_core::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -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:tg-hl-api_v345
|
||||
image: fluencelabs/node:latest
|
||||
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:tg-hl-api_v345
|
||||
image: fluencelabs/node:latest
|
||||
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:tg-hl-api_v345
|
||||
image: fluencelabs/node:latest
|
||||
ports:
|
||||
- 7772:7772 # tcp
|
||||
- 9992:9992 # ws
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2021-09-01"
|
||||
channel = "nightly-2022-01-16"
|
||||
targets = [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu" ]
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "trust-graph-wasm"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
description = "trust graph wasm"
|
||||
@ -12,11 +12,11 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
trust-graph = { version = "0.3.0", path = "../." }
|
||||
fluence-keypair = { version = "0.5.0", path = "../keypair" }
|
||||
fluence-keypair = { version = "0.6.0", path = "../keypair" }
|
||||
marine-rs-sdk = { version = "0.6.14", features = ["logger"] }
|
||||
marine-sqlite-connector = "0.5.2"
|
||||
|
||||
libp2p-core = { package = "fluence-fork-libp2p-core", version = "0.27.2", features = ["secp256k1"]}
|
||||
libp2p-core = { version = "0.31", default-features = false, features = [ "secp256k1" ] }
|
||||
|
||||
log = "0.4.8"
|
||||
anyhow = "1.0.31"
|
||||
|
@ -1,3 +1,3 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2021-09-01"
|
||||
channel = "nightly-2022-01-16"
|
||||
targets = [ "x86_64-apple-darwin", "x86_64-unknown-linux-gnu" ]
|
@ -40,7 +40,7 @@ pub struct Certificate {
|
||||
impl From<trust_graph::Certificate> for Certificate {
|
||||
fn from(c: trust_graph::Certificate) -> Self {
|
||||
let chain: Vec<Trust> = c.chain.into_iter().map(|t| t.into()).collect();
|
||||
return Certificate { chain };
|
||||
Certificate { chain }
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,10 +51,10 @@ impl TryFrom<Certificate> for trust_graph::Certificate {
|
||||
let chain: Result<Vec<trust_graph::Trust>, DtoConversionError> = c
|
||||
.chain
|
||||
.into_iter()
|
||||
.map(|t| trust_graph::Trust::try_from(t))
|
||||
.map(trust_graph::Trust::try_from)
|
||||
.collect();
|
||||
let chain = chain?;
|
||||
return Ok(trust_graph::Certificate { chain });
|
||||
Ok(trust_graph::Certificate { chain })
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,12 +85,12 @@ impl TryFrom<Trust> for trust_graph::Trust {
|
||||
let signature = Signature::from_bytes(KeyFormat::from_str(&t.sig_type)?, signature);
|
||||
let expires_at = Duration::from_secs(t.expires_at);
|
||||
let issued_at = Duration::from_secs(t.issued_at);
|
||||
return Ok(trust_graph::Trust {
|
||||
Ok(trust_graph::Trust {
|
||||
issued_for,
|
||||
expires_at,
|
||||
signature,
|
||||
issued_at,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,13 +101,13 @@ impl From<trust_graph::Trust> for Trust {
|
||||
let signature = bs58::encode(raw_signature.bytes).into_string();
|
||||
let expires_at = t.expires_at.as_secs();
|
||||
let issued_at = t.issued_at.as_secs();
|
||||
return Trust {
|
||||
Trust {
|
||||
issued_for,
|
||||
expires_at,
|
||||
signature,
|
||||
sig_type: raw_signature.sig_type.into(),
|
||||
issued_at,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,12 +142,12 @@ impl TryFrom<Revocation> for trust_graph::Revocation {
|
||||
let signature = bs58::decode(&r.signature).into_vec()?;
|
||||
let signature = Signature::from_bytes(KeyFormat::from_str(&r.sig_type)?, signature);
|
||||
let revoked_at = Duration::from_secs(r.revoked_at);
|
||||
return Ok(trust_graph::Revocation {
|
||||
Ok(trust_graph::Revocation {
|
||||
pk: revoked_pk,
|
||||
revoked_at,
|
||||
revoked_by: revoked_by_pk,
|
||||
signature,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,12 +158,12 @@ impl From<trust_graph::Revocation> for Revocation {
|
||||
let raw_signature = r.signature.get_raw_signature();
|
||||
let signature = bs58::encode(raw_signature.bytes).into_string();
|
||||
let revoked_at = r.revoked_at.as_secs();
|
||||
return Revocation {
|
||||
Revocation {
|
||||
revoked_peer_id,
|
||||
revoked_at,
|
||||
signature,
|
||||
sig_type: raw_signature.sig_type.into(),
|
||||
revoked_by,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,31 @@ mod results;
|
||||
mod service_api;
|
||||
mod storage_impl;
|
||||
mod tests;
|
||||
/*
|
||||
_initialize function that calls __wasm_call_ctors is required to mitigade memory leak
|
||||
that is described in https://github.com/WebAssembly/wasi-libc/issues/298
|
||||
|
||||
In short, without this code rust wraps every export function
|
||||
with __wasm_call_ctors/__wasm_call_dtors calls. This causes memory leaks. When compiler sees
|
||||
an explicit call to __wasm_call_ctors in _initialize function, it disables export wrapping.
|
||||
|
||||
TODO: remove when updating to marine-rs-sdk with fix
|
||||
*/
|
||||
extern "C" {
|
||||
pub fn __wasm_call_ctors();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
fn _initialize() {
|
||||
unsafe {
|
||||
__wasm_call_ctors();
|
||||
}
|
||||
}
|
||||
//------------------------------
|
||||
pub static TRUSTED_TIMESTAMP: (&str, &str) = ("peer", "timestamp_sec");
|
||||
|
||||
pub fn main() {
|
||||
_initialize(); // As __wasm_call_ctors still does necessary work, we call it at the start of the module
|
||||
WasmLoggerBuilder::new()
|
||||
.with_log_level(log::LevelFilter::Trace)
|
||||
.build()
|
||||
|
@ -15,7 +15,7 @@ use std::time::Duration;
|
||||
use trust_graph::TrustGraph;
|
||||
|
||||
#[marine]
|
||||
/// could set only a owner of a trust graph service
|
||||
/// Only service owner can set roots
|
||||
fn set_root(peer_id: String, max_chain_len: u32) -> SetRootResult {
|
||||
let call_parameters: CallParameters = marine_rs_sdk::get_call_parameters();
|
||||
let init_peer_id = call_parameters.init_peer_id;
|
||||
@ -27,10 +27,10 @@ fn set_root(peer_id: String, max_chain_len: u32) -> SetRootResult {
|
||||
})
|
||||
.into()
|
||||
} else {
|
||||
return SetRootResult {
|
||||
SetRootResult {
|
||||
success: false,
|
||||
error: ServiceError::NotOwner.to_string(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ fn get_all_certs(issued_for: String, timestamp_sec: u64) -> AllCertsResult {
|
||||
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)?;
|
||||
check_timestamp_tetraplets(&cp, 2)?;
|
||||
get_certs_from(tg, issued_for, issuer, timestamp_sec)
|
||||
})
|
||||
.into()
|
||||
|
@ -272,7 +272,7 @@ impl Storage for SQLiteStorage {
|
||||
statement.bind(6, &Value::Binary(relation.signature().encode()))?;
|
||||
|
||||
statement.next()?;
|
||||
Ok({})
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_root_weight_factor(&self, pk: &PK) -> Result<Option<WeightFactor>, Self::Error> {
|
||||
@ -309,7 +309,7 @@ impl Storage for SQLiteStorage {
|
||||
])?;
|
||||
|
||||
cursor.next()?;
|
||||
Ok({})
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn root_keys(&self) -> Result<Vec<PK>, Self::Error> {
|
||||
|
@ -887,4 +887,40 @@ mod service_tests {
|
||||
assert_eq!(*trust, trusts[i].trust);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_all_cert_from() {
|
||||
let mut trust_graph = ServiceInterface::new();
|
||||
clear_env();
|
||||
let (key_pairs, trusts) =
|
||||
generate_trust_chain_with_len(&mut trust_graph, 5, HashMap::new());
|
||||
|
||||
let cur_time = current_time();
|
||||
let root_peer_id = key_pairs[0].get_peer_id();
|
||||
set_root_peer_id(&mut trust_graph, root_peer_id, 10);
|
||||
|
||||
for auth in trusts.iter() {
|
||||
add_trust_checked(&mut trust_graph, auth.trust.clone(), auth.issuer, cur_time);
|
||||
}
|
||||
|
||||
let cp = get_correct_timestamp_cp_with_host_id(
|
||||
2,
|
||||
key_pairs.last().unwrap().get_peer_id().to_base58(),
|
||||
);
|
||||
let certs = trust_graph.get_all_certs_from_cp(
|
||||
key_pairs[4].get_peer_id().to_base58(),
|
||||
key_pairs[3].get_peer_id().to_base58(),
|
||||
cur_time,
|
||||
cp,
|
||||
);
|
||||
|
||||
assert!(certs.success, "{}", certs.error);
|
||||
let certs = certs.certificates;
|
||||
assert_eq!(certs.len(), 1);
|
||||
assert_eq!(certs[0].chain.len(), 5);
|
||||
|
||||
for (i, trust) in certs[0].chain.iter().enumerate() {
|
||||
assert_eq!(*trust, trusts[i].trust);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,14 +74,26 @@ impl Certificate {
|
||||
Self { chain }
|
||||
}
|
||||
|
||||
pub fn new_from_root_trust(root_trust: Trust, issued_trust: Trust, cur_time: Duration) -> Result<Self, CertificateError> {
|
||||
pub fn new_from_root_trust(
|
||||
root_trust: Trust,
|
||||
issued_trust: Trust,
|
||||
cur_time: Duration,
|
||||
) -> Result<Self, CertificateError> {
|
||||
Trust::verify(&root_trust, &root_trust.issued_for, cur_time).map_err(MalformedRoot)?;
|
||||
Trust::verify(&issued_trust, &root_trust.issued_for, cur_time).map_err(|e| VerificationError(1, e))?;
|
||||
Trust::verify(&issued_trust, &root_trust.issued_for, cur_time)
|
||||
.map_err(|e| VerificationError(1, e))?;
|
||||
|
||||
Ok(Self { chain: vec![root_trust, issued_trust] })
|
||||
Ok(Self {
|
||||
chain: vec![root_trust, issued_trust],
|
||||
})
|
||||
}
|
||||
|
||||
pub fn issue_with_trust(issued_by: PublicKey, trust: Trust, extend_cert: &Certificate, cur_time: Duration) -> Result<Self, CertificateError> {
|
||||
pub fn issue_with_trust(
|
||||
issued_by: PublicKey,
|
||||
trust: Trust,
|
||||
extend_cert: &Certificate,
|
||||
cur_time: Duration,
|
||||
) -> Result<Self, CertificateError> {
|
||||
if trust.expires_at.lt(&trust.issued_at) {
|
||||
return Err(ExpirationError {
|
||||
expires_at: format!("{:?}", trust.expires_at),
|
||||
@ -89,7 +101,11 @@ impl Certificate {
|
||||
});
|
||||
}
|
||||
|
||||
Certificate::verify(extend_cert, &[extend_cert.chain[0].issued_for.clone()], cur_time)?;
|
||||
Certificate::verify(
|
||||
extend_cert,
|
||||
&[extend_cert.chain[0].issued_for.clone()],
|
||||
cur_time,
|
||||
)?;
|
||||
// check if `issued_by` is allowed to issue a certificate (i.e., there’s a trust for it in a chain)
|
||||
let mut previous_trust_num: i32 = -1;
|
||||
for pk_id in 0..extend_cert.chain.len() {
|
||||
@ -114,7 +130,6 @@ impl Certificate {
|
||||
Ok(Self { chain: new_chain })
|
||||
}
|
||||
|
||||
|
||||
/// Creates new certificate with root trust (self-signed public key) from a key pair.
|
||||
#[allow(dead_code)]
|
||||
pub fn issue_root(
|
||||
@ -151,7 +166,11 @@ impl Certificate {
|
||||
}
|
||||
|
||||
// first, verify given certificate
|
||||
Certificate::verify(extend_cert, &[extend_cert.chain[0].issued_for.clone()], cur_time)?;
|
||||
Certificate::verify(
|
||||
extend_cert,
|
||||
&[extend_cert.chain[0].issued_for.clone()],
|
||||
cur_time,
|
||||
)?;
|
||||
|
||||
let issued_by_pk = issued_by.public();
|
||||
|
||||
|
@ -48,7 +48,6 @@ pub struct Revocation {
|
||||
}
|
||||
|
||||
impl Revocation {
|
||||
#[allow(dead_code)]
|
||||
pub fn new(
|
||||
revoked_by: PublicKey,
|
||||
pk: PublicKey,
|
||||
@ -64,7 +63,6 @@ impl Revocation {
|
||||
}
|
||||
|
||||
/// Creates new revocation signed by a revoker.
|
||||
#[allow(dead_code)]
|
||||
pub fn create(revoker: &KeyPair, to_revoke: PublicKey, revoked_at: Duration) -> Self {
|
||||
let msg = Revocation::signature_bytes(&to_revoke, revoked_at);
|
||||
let signature = revoker.sign(&msg).unwrap();
|
||||
|
@ -95,7 +95,7 @@ impl From<TrustGraphError> for String {
|
||||
}
|
||||
|
||||
fn get_weight_factor(max_chain_len: u32) -> u32 {
|
||||
MAX_WEIGHT_FACTOR.checked_sub(max_chain_len).unwrap_or(0u32)
|
||||
MAX_WEIGHT_FACTOR.saturating_sub(max_chain_len)
|
||||
}
|
||||
|
||||
pub fn get_weight_from_factor(wf: WeightFactor) -> u32 {
|
||||
|
Reference in New Issue
Block a user