Compare commits

..

25 Commits

Author SHA1 Message Date
80bf4aa4ff chore: release master (#117) 2023-07-04 20:33:47 +03:00
80757e6352 chore(deps): update dependency @fluencelabs/aqua to ^0.10.0 (#71)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:51:30 +03:00
f2c3b2a13c fix(deps): update dependency @fluencelabs/trust-graph to v3.1.2 (#69)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:51:01 +03:00
4f657f9dae fix(deps): update dependency @fluencelabs/aqua-lib to ^0.6.0 (#67)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:49:20 +03:00
725d3f8f48 fix(deps): update rust crate marine-rs-sdk-test to 0.10.0 (#106)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:48:56 +03:00
1fb02e4827 chore(deps): update rust crate lazy_static to 1.4 (#108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:48:12 +03:00
a37bda37a2 chore(deps): update rust crate built to 0.6.0 (#115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-04 19:47:55 +03:00
ee330a715a fix(keypair): deserialize libp2p keypair from secret key (#116)
* fix: Ed25519 keypair

* Update keypair/src/key_pair.rs

Co-authored-by: folex <0xdxdy@gmail.com>

---------

Co-authored-by: folex <0xdxdy@gmail.com>
2023-07-04 19:47:26 +03:00
c22eab38c1 chore: release master (#113) 2023-06-30 11:15:20 +03:00
3692d6898d chore: Revert "chore: release master (#111)" (#114)
Revert "chore: release master (#111)"

This reverts commit 3a5f23741f.
2023-06-30 11:03:02 +03:00
3a5f23741f chore: release master (#111) 2023-06-29 20:35:37 +03:00
b10991501d fix: changed build.sh for test ci & release (#112) 2023-06-29 11:28:41 -06:00
d80a43bcff revert: release master (#110)
Revert "chore: release master (#104)"

This reverts commit a7ea41ed4d.
2023-06-29 19:51:42 +03:00
a7ea41ed4d chore: release master (#104) 2023-06-29 19:31:25 +03:00
d04120bacf feat: update libp2p identity (#109) 2023-06-29 19:21:14 +03:00
3ba3855892 feat: add distro crate [fixes NET-463] (#93)
* add distro crate

---------

Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
2023-06-20 14:07:53 +02:00
f7ef0f8da0 fix(keypair): update description (#105) 2023-05-16 10:40:47 -06:00
2001f900fa fix(deps): update rust crate derivative to 2.2.0 (#88)
fix(deps): update rust crate derivative to 2.2.0

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-16 10:26:55 -06:00
412b8ba725 chore: update libp2p (#103)
deps: update libp2p
2023-05-16 19:24:03 +03:00
a7abe87c09 chore: release master (#102) 2023-05-09 17:59:08 +04:00
1a26a6809e feat: dummy to trigger release (#101) 2023-05-09 17:46:41 +04:00
93161afe0c feat: fix builtin package path (#100) 2023-05-09 16:37:48 +03:00
11fd2de7b6 chore: release master (#99) 2023-05-09 16:55:01 +04:00
a8fdb4472e feat: fix trust-graph package (#98) 2023-05-09 15:25:49 +04:00
56d0ea27bd chore: Fix update in rust-peer-distro (#97)
Fix update in rust-peer-distro
2023-05-08 18:38:53 +03:00
32 changed files with 2488 additions and 775 deletions

View File

@ -14,7 +14,8 @@
"components": [
"trust-graph",
"trust-graph-api",
"trust-graph-wasm"
"trust-graph-wasm",
"distro"
]
}
],
@ -31,6 +32,9 @@
},
"keypair": {
"component": "keypair"
},
"distro": {
"component": "distro"
}
}
}

View File

@ -1,6 +1,7 @@
{
"trust-graph": "0.4.3",
"aqua": "0.4.3",
"service": "0.4.3",
"keypair": "0.10.1"
"trust-graph": "0.4.7",
"aqua": "0.4.7",
"service": "0.4.7",
"keypair": "0.10.3",
"distro": "0.4.7"
}

View File

@ -17,6 +17,7 @@ jobs:
trust-graph-api-release-created: ${{ steps.release.outputs['aqua--release_created'] }}
trust-graph-release-created: ${{ steps.release.outputs['trust-graph--release_created'] }}
trust-graph-tag-name: ${{ steps.release.outputs['trust-graph--tag_name'] }}
trust-graph-version: ${{ steps.release.outputs['trust-graph--version'] }}
steps:
- name: Run release-please
@ -70,7 +71,6 @@ jobs:
- name: Build
run: ./build.sh
working-directory: service
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v1.3.0
@ -139,7 +139,7 @@ jobs:
token: ${{ secrets.PERSONAL_TOKEN }}
inputs: '{
"name": "trust-graph",
"version": "${{ needs.release-please.outputs.version }}",
"version": "${{ needs.release-please.outputs.trust-graph-version }}",
"url": "https://github.com/fluencelabs/trust-graph/releases/download/${{ needs.release-please.outputs.trust-graph-tag-name }}/trust-graph.tar.gz",
"sha256": "${{ steps.sha.outputs.sha256 }}"
}'

View File

@ -23,7 +23,6 @@ jobs:
uses: fluencelabs/setup-marine@v1
- name: Build
working-directory: ./service
run: ./build.sh
- name: Run cargo clippy
@ -42,7 +41,8 @@ jobs:
env:
NEXTEST_RETRIES: 10
NEXTEST_TEST_THREADS: 10
run: cargo nextest run --release --all-features --no-fail-fast
# exclude distro since at this point we don't have compiled wasms which are required for compilation
run: cargo nextest run --release --all-features --no-fail-fast --workspace --exclude trust-graph-distro
- name: Setup node
uses: actions/setup-node@v3

2
.gitignore vendored
View File

@ -2,6 +2,8 @@ service/target
service/artifacts
builtin-package/*.wasm
trust-graph.tar.gz
distro/trust-graph-service
distro/target
**/*.rs.bk
**/.idea

1057
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,9 @@
members = [
"trust-graph",
"keypair",
"service"
"service",
"distro"
]
[workspace.dependencies]
libp2p-identity = { version = "0.1.0", default-features = false, features = ["peerid", "rsa", "ed25519", "secp256k1", "multihash"] }
libp2p-identity = { version = "0.2.1", default-features = false }

140
admin/package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua": "^0.9.1-374",
"@fluencelabs/aqua": "^0.10.0",
"@fluencelabs/aqua-lib": "^0.6.0",
"@fluencelabs/fluence": "^0.27.5",
"@fluencelabs/fluence-network-environment": "^1.0.13",
@ -22,13 +22,13 @@
},
"../aqua": {
"name": "@fluencelabs/trust-graph",
"version": "0.2.2",
"version": "0.4.6",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua-lib": "^0.5.2"
"@fluencelabs/aqua-lib": "^0.7.0"
},
"devDependencies": {
"@fluencelabs/aqua": "^0.7.4-322"
"@fluencelabs/aqua": "^0.10.3"
}
},
"../aqua/node_modules/@fluencelabs/aqua": {
@ -687,13 +687,13 @@
}
},
"node_modules/@fluencelabs/aqua": {
"version": "0.9.1-374",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.9.1-374.tgz",
"integrity": "sha512-jF6oVE4h7bP/dQArKEfsy4UxbQbzACfVIBY/TFUL5D3np4ssjxrh15Y3gl1PwSWjlaPcDeFvAuStmcqfYQmLqQ==",
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
"dependencies": {
"@fluencelabs/aqua-ipfs": "0.5.8",
"@fluencelabs/aqua-ipfs": "0.5.9",
"@fluencelabs/aqua-lib": "0.6.0",
"@fluencelabs/fluence": "0.27.5",
"@fluencelabs/fluence": "0.28.0",
"@fluencelabs/fluence-network-environment": "1.0.13",
"ipfs-http-client": "50.1.2"
},
@ -703,9 +703,9 @@
}
},
"node_modules/@fluencelabs/aqua-ipfs": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
"dependencies": {
"@fluencelabs/aqua-lib": "^0.5.2"
}
@ -720,6 +720,57 @@
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.6.0.tgz",
"integrity": "sha512-ifjtCM93KO3LhzPkMxqmXhwLmrg/scjOiyTihEVg7ns5N+BVzaK1eWzdOdqGdl9ZVoah43pdlQUepEo7VdRmsw=="
},
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/avm": {
"version": "0.35.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
},
"node_modules/@fluencelabs/aqua/node_modules/@fluencelabs/fluence": {
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
"deprecated": "fluencelabs/fluence is deprecated in favor of a thinner CDN-distributed .js bundle, please see the following link for installation instructions https://github.com/fluencelabs/js-client#installation",
"dependencies": {
"@fluencelabs/avm": "0.35.3",
"@fluencelabs/connection": "0.2.0",
"@fluencelabs/interfaces": "0.1.0",
"@fluencelabs/keypair": "0.2.0",
"@fluencelabs/marine-js": "0.3.37",
"async": "3.2.4",
"base64-js": "^1.5.1",
"browser-or-node": "2.0.0",
"bs58": "5.0.0",
"buffer": "^6.0.3",
"cids": "1.1.9",
"loglevel": "1.8.1",
"multiformats": "9.9.0",
"peer-id": "0.16.0",
"platform": "^1.3.6",
"rxjs": "^7.5.5",
"ts-pattern": "3.3.3",
"uuid": "8.3.2"
},
"bin": {
"copy-marine": "dist/tools/copyMarine.js"
},
"engines": {
"node": ">=10",
"pnpm": ">=3"
}
},
"node_modules/@fluencelabs/aqua/node_modules/base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"node_modules/@fluencelabs/aqua/node_modules/bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
"integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==",
"dependencies": {
"base-x": "^4.0.0"
}
},
"node_modules/@fluencelabs/avm": {
"version": "0.31.10",
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.31.10.tgz",
@ -7936,21 +7987,66 @@
}
},
"@fluencelabs/aqua": {
"version": "0.9.1-374",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.9.1-374.tgz",
"integrity": "sha512-jF6oVE4h7bP/dQArKEfsy4UxbQbzACfVIBY/TFUL5D3np4ssjxrh15Y3gl1PwSWjlaPcDeFvAuStmcqfYQmLqQ==",
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua/-/aqua-0.10.3.tgz",
"integrity": "sha512-v7Jy+KzZkUm7NuUgrp7UQ8gxuhykxuTU3JigCdxiZMcG3/zD+OtHzsSggVLxVjDP7CKuTcjEKZSCxObwHp/Tpw==",
"requires": {
"@fluencelabs/aqua-ipfs": "0.5.8",
"@fluencelabs/aqua-ipfs": "0.5.9",
"@fluencelabs/aqua-lib": "0.6.0",
"@fluencelabs/fluence": "0.27.5",
"@fluencelabs/fluence": "0.28.0",
"@fluencelabs/fluence-network-environment": "1.0.13",
"ipfs-http-client": "50.1.2"
},
"dependencies": {
"@fluencelabs/avm": {
"version": "0.35.3",
"resolved": "https://registry.npmjs.org/@fluencelabs/avm/-/avm-0.35.3.tgz",
"integrity": "sha512-Y5mPPCmAUUKc5CDO12IL8mGEreWa7maVdX0MWCAH4+GvfLPFN1FxOMSKRYEtvkyVEL88pc9pd8cm5IRCBkFthg=="
},
"@fluencelabs/fluence": {
"version": "0.28.0",
"resolved": "https://registry.npmjs.org/@fluencelabs/fluence/-/fluence-0.28.0.tgz",
"integrity": "sha512-SXb2vjTj8m/nw4jEILV0tu9VIFprGo8mNb2nOB5btxdsOI8GzQZkpGzTLrSd/+UagIo2GdxAu0GhBP8dxZXaqg==",
"requires": {
"@fluencelabs/avm": "0.35.3",
"@fluencelabs/connection": "0.2.0",
"@fluencelabs/interfaces": "0.1.0",
"@fluencelabs/keypair": "0.2.0",
"@fluencelabs/marine-js": "0.3.37",
"async": "3.2.4",
"base64-js": "^1.5.1",
"browser-or-node": "2.0.0",
"bs58": "5.0.0",
"buffer": "^6.0.3",
"cids": "1.1.9",
"loglevel": "1.8.1",
"multiformats": "9.9.0",
"peer-id": "0.16.0",
"platform": "^1.3.6",
"rxjs": "^7.5.5",
"ts-pattern": "3.3.3",
"uuid": "8.3.2"
}
},
"base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
"integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==",
"requires": {
"base-x": "^4.0.0"
}
}
}
},
"@fluencelabs/aqua-ipfs": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.8.tgz",
"integrity": "sha512-jKlyGBm8oJAIQ3Ags58oJ8QVTlCYSvZQVTnX2SnugGXWVwt4+9qtqtvNT5MvWKK3M9lCFDbJJy/qVTjzPJlaiw==",
"version": "0.5.9",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-ipfs/-/aqua-ipfs-0.5.9.tgz",
"integrity": "sha512-Vg7pYv4gEreOKfvzKEL5FchGqSKwat7JyKpqJO6h+FC5S1bl76UkI507+ExhijmUbQGznop8G33XFxyUi6q5SQ==",
"requires": {
"@fluencelabs/aqua-lib": "^0.5.2"
},
@ -8100,8 +8196,8 @@
"@fluencelabs/trust-graph": {
"version": "file:../aqua",
"requires": {
"@fluencelabs/aqua": "^0.7.4-322",
"@fluencelabs/aqua-lib": "^0.5.2"
"@fluencelabs/aqua": "^0.10.3",
"@fluencelabs/aqua-lib": "^0.7.0"
},
"dependencies": {
"@fluencelabs/aqua": {

View File

@ -13,7 +13,7 @@
"author": "Fluence Labs",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua": "^0.9.1-374",
"@fluencelabs/aqua": "^0.10.0",
"@fluencelabs/aqua-lib": "^0.6.0",
"@fluencelabs/fluence": "^0.27.5",
"@fluencelabs/fluence-network-environment": "^1.0.13",

View File

@ -1,5 +1,33 @@
# Changelog
## [0.4.7](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.6...trust-graph-api-v0.4.7) (2023-07-04)
### Miscellaneous Chores
* **trust-graph-api:** Synchronize trust-graph, wasm and api versions
## [0.4.6](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.5...trust-graph-api-v0.4.6) (2023-06-30)
### Reverts
* release master ([#110](https://github.com/fluencelabs/trust-graph/issues/110)) ([d80a43b](https://github.com/fluencelabs/trust-graph/commit/d80a43bcff721aff8fadf3d2d5c252804ce27a6c))
## [0.4.5](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.4...trust-graph-api-v0.4.5) (2023-05-09)
### Miscellaneous Chores
* **trust-graph-api:** Synchronize trust-graph, wasm and api versions
## [0.4.4](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.3...trust-graph-api-v0.4.4) (2023-05-09)
### Miscellaneous Chores
* **trust-graph-api:** Synchronize trust-graph, wasm and api versions
## [0.4.3](https://github.com/fluencelabs/trust-graph/compare/trust-graph-api-v0.4.1...trust-graph-api-v0.4.3) (2023-05-08)

View File

@ -1,12 +1,12 @@
{
"name": "@fluencelabs/trust-graph",
"version": "0.4.3",
"version": "0.4.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@fluencelabs/trust-graph",
"version": "0.4.3",
"version": "0.4.7",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua-lib": "^0.7.0"

View File

@ -1,6 +1,6 @@
{
"name": "@fluencelabs/trust-graph",
"version": "0.4.3",
"version": "0.4.7",
"description": "Aqua Trust Graph API library",
"files": [
"*.aqua"

15
build.sh Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# set current working directory to script directory to run script from everywhere
cd "$(dirname "$0")"
./service/build.sh
TARGET="distro/trust-graph-service/"
mkdir -p "$TARGET"
cp -v ./distro/init_certs.json service/artifacts/trust-graph.wasm service/artifacts/sqlite3.wasm distro/Config.toml "$TARGET"
cd distro
cargo build

View File

@ -3,10 +3,10 @@ set -o pipefail -o nounset -o errexit
# set current working directory to script directory to run script from everywhere
cd "$(dirname "$0")"
PACKAGE_DIR="$(pwd)/../package"
PACKAGE_DIR="$(pwd)/../package/trust-graph"
(
rm -f $PACKAGE_DIR/*
rm -rf $PACKAGE_DIR/*
mkdir -p $PACKAGE_DIR
)
@ -34,8 +34,8 @@ echo "{}" | jq --arg trust_graph_cid "$TRUST_GRAPH_CID" --arg sqlite_cid "$SQLIT
(
echo "*** create builtin distribution package ***"
cd $PACKAGE_DIR
(tar cf - * | gzip) > ../trust-graph.tar.gz
cd $PACKAGE_DIR/..
tar -f ../trust-graph.tar.gz -zcv ./trust-graph
)
echo "*** done ***"

20
distro/CHANGELOG.md Normal file
View File

@ -0,0 +1,20 @@
# Changelog
## [0.4.7](https://github.com/fluencelabs/trust-graph/compare/distro-v0.4.6...distro-v0.4.7) (2023-07-04)
### Miscellaneous Chores
* **distro:** Synchronize trust-graph, wasm and api versions
## [0.4.6](https://github.com/fluencelabs/trust-graph/compare/distro-v0.4.5...distro-v0.4.6) (2023-06-30)
### Features
* add distro crate [fixes NET-463] ([#93](https://github.com/fluencelabs/trust-graph/issues/93)) ([3ba3855](https://github.com/fluencelabs/trust-graph/commit/3ba3855892ae355962212a0a42099dd9f9820800))
### Reverts
* release master ([#110](https://github.com/fluencelabs/trust-graph/issues/110)) ([d80a43b](https://github.com/fluencelabs/trust-graph/commit/d80a43bcff721aff8fadf3d2d5c252804ce27a6c))

18
distro/Cargo.toml Normal file
View File

@ -0,0 +1,18 @@
[package]
name = "trust-graph-distro"
version = "0.4.7"
edition = "2021"
build = "build.rs"
license = "Apache-2.0"
include = [ "/src", "build.rs", "Cargo.toml", "trust-graph-service"]
description = "Distribution package for the trust-graph service"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
maplit = "1.0.2"
serde = "1.0.160"
serde_json = "1.0.96"
lazy_static = "1.4.0"
[build-dependencies]
built = "0.6.0"

14
distro/Config.toml Normal file
View File

@ -0,0 +1,14 @@
modules_dir = "."
[[module]]
name = "sqlite3"
logger_enabled = true
[module.wasi]
mapped_dirs = { "tmp" = "data" }
[[module]]
name = "trust-graph"
logger_enabled = true
[module.wasi]
mapped_dirs = { "tmp" = "data" }

3
distro/build.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information")
}

1
distro/init_certs.json Normal file

File diff suppressed because one or more lines are too long

60
distro/src/lib.rs Normal file
View File

@ -0,0 +1,60 @@
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
#[cfg(not(feature = "cargo-clippy"))]
pub const TRUST_GRAPH_WASM: &[u8] = include_bytes!("../trust-graph-service/trust-graph.wasm");
#[cfg(feature = "cargo-clippy")]
pub const TRUST_GRAPH_WASM: &[u8] = &[];
#[cfg(not(feature = "cargo-clippy"))]
pub const SQLITE_WASM: &[u8] = include_bytes!("../trust-graph-service/sqlite3.wasm");
#[cfg(feature = "cargo-clippy")]
pub const SQLITE_WASM: &[u8] = &[];
#[cfg(not(feature = "cargo-clippy"))]
pub const CONFIG: &[u8] = include_bytes!("../trust-graph-service/Config.toml");
#[cfg(feature = "cargo-clippy")]
pub const CONFIG: &[u8] = &[];
#[cfg(not(feature = "cargo-clippy"))]
pub const KRAS_CERTS_JSON: &str = include_str!("../trust-graph-service/init_certs.json");
#[cfg(feature = "cargo-clippy")]
pub const KRAS_CERTS_JSON: &str = "{}";
pub mod build_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
pub use build_info::PKG_VERSION as VERSION;
pub fn modules() -> std::collections::HashMap<&'static str, &'static [u8]> {
maplit::hashmap! {
"sqlite3" => SQLITE_WASM,
"trust-graph" => TRUST_GRAPH_WASM,
}
}
#[derive(Deserialize, Serialize)]
pub struct Certs {
pub root_node: String,
pub max_chain_length: u32,
pub certs: Vec<Cert>,
}
#[derive(Deserialize, Serialize)]
pub struct Cert {
pub chain: Vec<Trust>,
}
#[derive(Deserialize, Serialize)]
pub struct Trust {
pub issued_for: String,
pub expires_at: u64,
pub signature: String,
pub sig_type: String,
pub issued_at: u64,
}
lazy_static! {
pub static ref KRAS_CERTS: Certs = serde_json::from_str(KRAS_CERTS_JSON).unwrap();
}

1518
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,14 @@
"author": "Fluence Labs",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua-lib": "^0.5.2",
"@fluencelabs/aqua-lib": "^0.6.0",
"@fluencelabs/fluence": "^0.23.0",
"@fluencelabs/fluence-network-environment": "^1.0.10",
"@fluencelabs/trust-graph": "3.0.2",
"@fluencelabs/trust-graph": "3.1.2",
"bs58": "^4.0.1"
},
"devDependencies": {
"typescript": "^4.5.2",
"@fluencelabs/aqua": "^0.7.4-325"
"@fluencelabs/aqua": "^0.10.0"
}
}

View File

@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.3](https://github.com/fluencelabs/trust-graph/compare/keypair-v0.10.2...keypair-v0.10.3) (2023-07-04)
### Bug Fixes
* **keypair:** deserialize libp2p keypair from secret key ([#116](https://github.com/fluencelabs/trust-graph/issues/116)) ([ee330a7](https://github.com/fluencelabs/trust-graph/commit/ee330a715a902e48fc9b61d662ffcd950a26379c))
## [0.10.2](https://github.com/fluencelabs/trust-graph/compare/keypair-v0.10.1...keypair-v0.10.2) (2023-06-30)
### Features
* update libp2p identity ([#109](https://github.com/fluencelabs/trust-graph/issues/109)) ([d04120b](https://github.com/fluencelabs/trust-graph/commit/d04120bacf802a7e1127f4955b7391b0a4353128))
### Bug Fixes
* **keypair:** update description ([#105](https://github.com/fluencelabs/trust-graph/issues/105)) ([f7ef0f8](https://github.com/fluencelabs/trust-graph/commit/f7ef0f8da095fe1fef80faaa0b0c2d5ef854bd16))
### Reverts
* release master ([#110](https://github.com/fluencelabs/trust-graph/issues/110)) ([d80a43b](https://github.com/fluencelabs/trust-graph/commit/d80a43bcff721aff8fadf3d2d5c252804ce27a6c))
## [0.10.1](https://github.com/fluencelabs/trust-graph/compare/keypair-v0.10.0...keypair-v0.10.1) (2023-05-02)

View File

@ -1,26 +1,26 @@
[package]
name = "fluence-keypair"
version = "0.10.1"
version = "0.10.3"
authors = ["Fluence Labs"]
edition = "2021"
description = "identity"
description = "unified keypair API based on libp2p-identity"
license = "Apache-2.0"
repository = "https://github.com/fluencelabs/trust-graph"
[dependencies]
serde = { version = "1.0.118", features = ["derive"] }
bs58 = "0.4.0"
bs58 = "0.5.0"
ed25519-dalek = { version = "1.0.1", features = ["serde", "std"] }
rand = "0.8.5"
thiserror = "1.0.23"
lazy_static = "1.2"
lazy_static = "1.4"
libsecp256k1 = "0.7.1"
asn1_der = "0.6.1"
sha2 = "0.10.6"
zeroize = "1"
serde_bytes = "0.11"
eyre = "0.6.5"
libp2p-identity = { workspace = true, default-features = false, features = ["peerid", "rsa", "ed25519", "secp256k1", "multihash"] }
libp2p-identity = { workspace = true, default-features = false, features = ["peerid", "rsa", "ed25519", "secp256k1"] }
multihash = { version = "0.18.0", features = ["identity"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -201,6 +201,7 @@ pub struct Signature(pub Vec<u8>);
#[cfg(test)]
mod tests {
use super::*;
use crate::KeyPair;
use quickcheck::*;
fn eq_keypairs(kp1: &Keypair, kp2: &Keypair) -> bool {
@ -218,6 +219,17 @@ mod tests {
QuickCheck::new().tests(10).quickcheck(prop as fn() -> _);
}
#[test]
fn ed25519_keypair_convert() {
fn prop() -> bool {
let kp1 = KeyPair::generate_ed25519();
let libp2p_kp: libp2p_identity::Keypair = kp1.clone().into();
let kp2: KeyPair = libp2p_kp.into();
kp1.public() == kp2.public() && kp1.secret().unwrap() == kp2.secret().unwrap()
}
QuickCheck::new().tests(10).quickcheck(prop as fn() -> _);
}
#[test]
fn ed25519_keypair_from_secret() {
fn prop() -> bool {

View File

@ -26,7 +26,7 @@ use crate::public_key::PublicKey;
use crate::rsa;
use crate::secp256k1;
use crate::signature::Signature;
use libp2p_identity::PeerId;
use libp2p_identity::{KeyType, Keypair, PeerId};
use std::convert::TryFrom;
use std::str::FromStr;
@ -47,7 +47,6 @@ use std::str::FromStr;
/// let keypair = Keypair::rsa_from_pkcs8(&mut bytes);
/// ```
///
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum KeyFormat {
Ed25519,
@ -106,6 +105,7 @@ impl From<KeyFormat> for String {
}
}
}
#[derive(Clone)]
pub enum KeyPair {
/// An Ed25519 keypair.
@ -250,42 +250,63 @@ impl KeyPair {
impl From<libp2p_identity::Keypair> for KeyPair {
fn from(key: libp2p_identity::Keypair) -> Self {
use libp2p_identity::Keypair::*;
#[allow(deprecated)] //TODO: fix it later
match key {
Ed25519(kp) => KeyPair::Ed25519(ed25519::Keypair::decode(&mut kp.encode()).unwrap()),
#[cfg(not(target_arch = "wasm32"))]
// safety: these Keypair structures are identical
Rsa(kp) => KeyPair::Rsa(unsafe {
std::mem::transmute::<libp2p_identity::rsa::Keypair, rsa::Keypair>(kp)
}),
Secp256k1(kp) => KeyPair::Secp256k1(secp256k1::Keypair::from(
secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
)),
fn convert_keypair(key: Keypair) -> eyre::Result<KeyPair> {
match key.key_type() {
KeyType::Ed25519 => {
let kp = key.try_into_ed25519()?;
let raw_kp = ed25519::Keypair::decode(&mut kp.to_bytes())?;
Ok(KeyPair::Ed25519(raw_kp))
}
#[cfg(not(target_arch = "wasm32"))]
KeyType::RSA => {
let kp = key.try_into_rsa()?;
let raw_kp = unsafe {
std::mem::transmute::<libp2p_identity::rsa::Keypair, rsa::Keypair>(kp)
};
Ok(KeyPair::Rsa(raw_kp))
}
KeyType::Secp256k1 => {
let kp = key.try_into_secp256k1()?;
let raw_kp = secp256k1::SecretKey::from_bytes(kp.secret().to_bytes())?;
Ok(KeyPair::Secp256k1(secp256k1::Keypair::from(raw_kp)))
}
_ => unreachable!(),
}
}
convert_keypair(key).expect("Could not convert keypair")
}
}
impl From<KeyPair> for libp2p_identity::Keypair {
fn from(key: KeyPair) -> Self {
use libp2p_identity::Keypair;
use KeyPair::*;
#[allow(deprecated)] //TODO: fix it later
match key {
Ed25519(kp) => Keypair::Ed25519(
libp2p_identity::ed25519::Keypair::decode(kp.encode().to_vec().as_mut_slice())
.unwrap(),
),
#[cfg(not(target_arch = "wasm32"))]
// safety: these Keypair structures are identical
Rsa(kp) => Keypair::Rsa(unsafe {
std::mem::transmute::<rsa::Keypair, libp2p_identity::rsa::Keypair>(kp)
}),
Secp256k1(kp) => Keypair::Secp256k1(libp2p_identity::secp256k1::Keypair::from(
libp2p_identity::secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
)),
fn convert_keypair(key: KeyPair) -> eyre::Result<libp2p_identity::Keypair> {
match key {
KeyPair::Ed25519(kp) => {
// for some reason, libp2p takes SecretKey's 32 bytes here instead of Keypair's 64 bytes
let secret_bytes = kp.secret().0.to_bytes();
let kp = libp2p_identity::Keypair::ed25519_from_bytes(secret_bytes)?;
Ok(kp)
}
#[cfg(not(target_arch = "wasm32"))]
// safety: these Keypair structures are identical
KeyPair::Rsa(kp) => {
let kp = unsafe {
std::mem::transmute::<rsa::Keypair, libp2p_identity::rsa::Keypair>(kp)
};
let kp = Keypair::from(kp);
Ok(kp)
}
KeyPair::Secp256k1(kp) => {
let sk = libp2p_identity::secp256k1::SecretKey::try_from_bytes(
kp.secret().to_bytes(),
)?;
let kp = libp2p_identity::secp256k1::Keypair::from(sk);
let kp = Keypair::from(kp);
Ok(kp)
}
}
}
convert_keypair(key).expect("Could not convert key pair")
}
}

View File

@ -21,7 +21,7 @@ use crate::secp256k1;
use crate::signature::Signature;
use crate::key_pair::KeyFormat;
use libp2p_identity::PeerId;
use libp2p_identity::{KeyType, PeerId};
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
@ -126,37 +126,58 @@ impl PublicKey {
impl From<libp2p_identity::PublicKey> for PublicKey {
fn from(key: libp2p_identity::PublicKey) -> Self {
use libp2p_identity::PublicKey::*;
#[allow(deprecated)] //TODO: fix it later
match key {
Ed25519(key) => {
PublicKey::Ed25519(ed25519::PublicKey::decode(&key.encode()[..]).unwrap())
}
#[cfg(not(target_arch = "wasm32"))]
Rsa(key) => PublicKey::Rsa(rsa::PublicKey::from_pkcs1(key.encode_pkcs1()).unwrap()),
Secp256k1(key) => {
PublicKey::Secp256k1(secp256k1::PublicKey::decode(&key.encode()[..]).unwrap())
fn convert_key(key: libp2p_identity::PublicKey) -> eyre::Result<PublicKey> {
match key.key_type() {
KeyType::Ed25519 => {
let pk = key.try_into_ed25519()?;
let raw_pk = ed25519::PublicKey::decode(&pk.to_bytes())?;
Ok(PublicKey::Ed25519(raw_pk))
}
#[cfg(not(target_arch = "wasm32"))]
KeyType::RSA => {
let pk = key.try_into_rsa()?;
let raw_pk = rsa::PublicKey::from_pkcs1(pk.encode_pkcs1())?;
Ok(PublicKey::Rsa(raw_pk))
}
KeyType::Secp256k1 => {
let pk = key.try_into_secp256k1()?;
let raw_pk = secp256k1::PublicKey::decode(&pk.to_bytes())?;
Ok(PublicKey::Secp256k1(raw_pk))
}
_ => unreachable!(),
}
}
convert_key(key).expect("Could not convert public key")
}
}
impl From<PublicKey> for libp2p_identity::PublicKey {
fn from(key: PublicKey) -> Self {
#[allow(deprecated)] //TODO: fix it later
match key {
PublicKey::Ed25519(key) => libp2p_identity::PublicKey::Ed25519(
libp2p_identity::ed25519::PublicKey::decode(&key.encode()[..]).unwrap(),
),
#[cfg(not(target_arch = "wasm32"))]
PublicKey::Rsa(key) => libp2p_identity::PublicKey::Rsa(
libp2p_identity::rsa::PublicKey::decode_x509(&key.encode_x509()).unwrap(),
),
PublicKey::Secp256k1(key) => libp2p_identity::PublicKey::Secp256k1(
libp2p_identity::secp256k1::PublicKey::decode(&key.encode()[..]).unwrap(),
),
fn convert_key(key: PublicKey) -> eyre::Result<libp2p_identity::PublicKey> {
match key {
PublicKey::Ed25519(key) => {
let raw_pk =
libp2p_identity::ed25519::PublicKey::try_from_bytes(&key.encode())?;
let pk = libp2p_identity::PublicKey::from(raw_pk);
Ok(pk)
}
#[cfg(not(target_arch = "wasm32"))]
PublicKey::Rsa(key) => {
let raw_pk =
libp2p_identity::rsa::PublicKey::try_decode_x509(&key.encode_x509())?;
let pk = libp2p_identity::PublicKey::from(raw_pk);
Ok(pk)
}
PublicKey::Secp256k1(key) => {
let raw_pk =
libp2p_identity::secp256k1::PublicKey::try_from_bytes(&key.encode())?;
let pk = libp2p_identity::PublicKey::from(raw_pk);
Ok(pk)
}
}
}
convert_key(key).expect("Could not convert key")
}
}
@ -176,7 +197,7 @@ fn as_public_key(peer_id: &PeerId) -> Option<libp2p_identity::PublicKey> {
match multihash::Code::try_from(mhash.code()) {
Ok(multihash::Code::Identity) => {
libp2p_identity::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
libp2p_identity::PublicKey::try_decode_protobuf(mhash.digest()).ok()
}
_ => None,
}

View File

@ -229,6 +229,12 @@ pub struct Signature(pub Vec<u8>);
#[cfg(test)]
mod tests {
use super::*;
use crate::{key_pair, KeyFormat};
use quickcheck::QuickCheck;
fn eq_keypairs(kp1: key_pair::KeyPair, kp2: key_pair::KeyPair) -> bool {
kp1.public() == kp2.public() && kp1.secret().unwrap() == kp2.secret().unwrap()
}
#[test]
fn secp256k1_secret_from_bytes() {
@ -239,4 +245,15 @@ mod tests {
assert_eq!(sk1.0.serialize(), sk2.0.serialize());
assert_eq!(sk_bytes, [0; 32]);
}
#[test]
fn secp256k1_keypair_encode_decode() {
fn prop() -> bool {
let kp1 = key_pair::KeyPair::generate(KeyFormat::Secp256k1);
let kp1_enc = libp2p_identity::Keypair::from(kp1.clone());
let kp2 = key_pair::KeyPair::from(kp1_enc);
eq_keypairs(kp1, kp2)
}
QuickCheck::new().tests(10).quickcheck(prop as fn() -> _);
}
}

View File

@ -9,6 +9,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* trust-graph bumped from 0.4.1 to 0.4.2
* fluence-keypair bumped from 0.10.0 to 0.10.1
## [0.4.7](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.6...trust-graph-wasm-v0.4.7) (2023-07-04)
### Bug Fixes
* **deps:** update rust crate marine-rs-sdk-test to 0.10.0 ([#106](https://github.com/fluencelabs/trust-graph/issues/106)) ([725d3f8](https://github.com/fluencelabs/trust-graph/commit/725d3f8f48b3bf1ed8605e9ba2da5c966a145f0d))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* trust-graph bumped from 0.4.6 to 0.4.7
* fluence-keypair bumped from 0.10.2 to 0.10.3
## [0.4.6](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.5...trust-graph-wasm-v0.4.6) (2023-06-30)
### Reverts
* release master ([#110](https://github.com/fluencelabs/trust-graph/issues/110)) ([d80a43b](https://github.com/fluencelabs/trust-graph/commit/d80a43bcff721aff8fadf3d2d5c252804ce27a6c))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* trust-graph bumped from 0.4.5 to 0.4.6
* fluence-keypair bumped from 0.10.1 to 0.10.2
## [0.4.5](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.4...trust-graph-wasm-v0.4.5) (2023-05-09)
### Miscellaneous Chores
* **trust-graph-wasm:** Synchronize trust-graph, wasm and api versions
### Dependencies
* The following workspace dependencies were updated
* dependencies
* trust-graph bumped from 0.4.4 to 0.4.5
## [0.4.4](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.3...trust-graph-wasm-v0.4.4) (2023-05-09)
### Miscellaneous Chores
* **trust-graph-wasm:** Synchronize trust-graph, wasm and api versions
### Dependencies
* The following workspace dependencies were updated
* dependencies
* trust-graph bumped from 0.4.3 to 0.4.4
## [0.4.3](https://github.com/fluencelabs/trust-graph/compare/trust-graph-wasm-v0.4.2...trust-graph-wasm-v0.4.3) (2023-05-08)

View File

@ -1,6 +1,6 @@
[package]
name = "trust-graph-wasm"
version = "0.4.3"
version = "0.4.7"
authors = ["Fluence Labs"]
edition = "2021"
description = "trust graph wasm"
@ -12,8 +12,8 @@ name = "trust-graph"
path = "src/main.rs"
[dependencies]
trust-graph = { version = "0.4.3", path = "../trust-graph" }
fluence-keypair = { version = "0.10.1", path = "../keypair" }
trust-graph = { version = "0.4.7", path = "../trust-graph" }
fluence-keypair = { version = "0.10.3", path = "../keypair" }
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
marine-sqlite-connector = "0.8.0"

View File

@ -4,6 +4,54 @@
* dependencies
* fluence-keypair bumped from 0.10.0 to 0.10.1
## [0.4.7](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.6...trust-graph-v0.4.7) (2023-07-04)
### Miscellaneous Chores
* **trust-graph:** Synchronize trust-graph, wasm and api versions
### Dependencies
* The following workspace dependencies were updated
* dependencies
* fluence-keypair bumped from 0.10.2 to 0.10.3
## [0.4.6](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.5...trust-graph-v0.4.6) (2023-06-30)
### Bug Fixes
* **deps:** update rust crate derivative to 2.2.0 ([2001f90](https://github.com/fluencelabs/trust-graph/commit/2001f900fa13a949decd513d8cbe15e3f006a7fc))
* **deps:** update rust crate derivative to 2.2.0 ([#88](https://github.com/fluencelabs/trust-graph/issues/88)) ([2001f90](https://github.com/fluencelabs/trust-graph/commit/2001f900fa13a949decd513d8cbe15e3f006a7fc))
### Reverts
* release master ([#110](https://github.com/fluencelabs/trust-graph/issues/110)) ([d80a43b](https://github.com/fluencelabs/trust-graph/commit/d80a43bcff721aff8fadf3d2d5c252804ce27a6c))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* fluence-keypair bumped from 0.10.1 to 0.10.2
## [0.4.5](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.4...trust-graph-v0.4.5) (2023-05-09)
### Features
* dummy to trigger release ([#101](https://github.com/fluencelabs/trust-graph/issues/101)) ([1a26a68](https://github.com/fluencelabs/trust-graph/commit/1a26a6809ea9a90ca8ff3829a76257779a8767d5))
## [0.4.4](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.3...trust-graph-v0.4.4) (2023-05-09)
### Features
* fix trust-graph package ([#98](https://github.com/fluencelabs/trust-graph/issues/98)) ([a8fdb44](https://github.com/fluencelabs/trust-graph/commit/a8fdb4472ef1676724e4bfab1b4419f07faae2d9))
## [0.4.3](https://github.com/fluencelabs/trust-graph/compare/trust-graph-v0.4.2...trust-graph-v0.4.3) (2023-05-08)

View File

@ -1,6 +1,6 @@
[package]
name = "trust-graph"
version = "0.4.3"
version = "0.4.7"
authors = ["Fluence Labs"]
edition = "2021"
description = "trust graph"
@ -10,12 +10,12 @@ repository = "https://github.com/fluencelabs/trust-graph"
[dependencies]
serde = { version = "1.0.118", features = ["derive"] }
fluence-keypair = { path = "../keypair", version = "0.10.1" }
fluence-keypair = { path = "../keypair", version = "0.10.3" }
bs58 = "0.4.0"
failure = "0.1.6"
log = "0.4.11"
ref-cast = "1.0.2"
derivative = "2.1.1"
derivative = "2.2.0"
thiserror = "1.0.23"
sha2 = "0.10.6"
nonempty = "0.8.1"