-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(indy-validator): fix package dependencies
- Update indy validator python dependencies. - Add README chapter on updating python dependencies to simplify this process in the future. - Use pinend ubuntu base image in indy-sdk-cli dockerfile. - Do some minor README improvements and cleanups. - Use pinned fabric-all-in-one versions in discounted-asset-trade. Tested with `discounted-asset-trade` (should work without an issue now, at least dockerless one) Depends on: #2596 Signed-off-by: Michal Bajer <[email protected]>
- Loading branch information
Showing
10 changed files
with
142 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 82 additions & 49 deletions
131
packages-python/cactus_validator_socketio_indy/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,106 @@ | ||
# Indy Validator | ||
|
||
- Cactus socketio validator to integrate with Hyperledger Indy | ||
|
||
## Build | ||
|
||
- By default, it assumes that indy pool is available at `172.16.0.2` | ||
- You can modify this behavior by editing `Dockerfile` or by setting arg `pool_ip` | ||
|
||
``` | ||
./setup_indy.sh | ||
``` | ||
|
||
## Updating the dependencies | ||
|
||
- When updating depedency in `requirements.txt` make sure that it's dependencies are updated as well. | ||
- Make sure you update the package version in `setup.py` as well. | ||
- After each update build and run container to ensure it still works. | ||
- Follow this process when updating the package: | ||
|
||
```bash | ||
# Go to package dir | ||
cd packages-python/cactus_validator_socketio_indy/validator-python | ||
|
||
# Setup venv and install core dependencies | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
pip install --upgrade setuptools wheel | ||
pip install Flask==2.3.2 Flask-SocketIO==5.1.1 PyJWT==2.4.0 PyYAML==5.4.1 python3-indy==1.16.0 eventlet==0.31.1 cryptography==41.0.3 | ||
|
||
# Freeze current package listing | ||
pip freeze > requirements.txt | ||
|
||
# Copy the contents of requirements.txt to setup.py install_requires list (adjust formatting accordingly). | ||
``` | ||
|
||
## Test | ||
|
||
- Use `testcli/testsock.js` to check basic communication pattern with the validator. | ||
|
||
### How-To | ||
|
||
1. Start indy testnet pool (follow instructions from `../../tools/docker/indy-testnet/` README). It should create docker network `indy-testnet_indy_net`, pool should be available at `172.16.0.2`. | ||
1. Generate proof and store it in local `/etc/cactus`: | ||
``` | ||
rm -r /etc/cactus/validator_socketio_indy/* | ||
cd ../../examples/register-indy-data/ | ||
./script-build-docker.sh | ||
docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only | ||
``` | ||
``` | ||
rm -r /etc/cactus/validator_socketio_indy/* | ||
cd ../../examples/register-indy-data/ | ||
./script-build-docker.sh | ||
docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only | ||
``` | ||
1. Copy indy validator config | ||
``` | ||
cp -rf ./config/* /etc/cactus/validator_socketio_indy/ | ||
``` | ||
``` | ||
cp -rf ./config/* /etc/cactus/validator_socketio_indy/ | ||
``` | ||
1. Generate validator certificate using OpenSSL tool | ||
``` | ||
mkdir -p "/etc/cactus/validator_socketio_indy/CA/" | ||
openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv" | ||
openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ | ||
-out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ | ||
-subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator" | ||
openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ | ||
-in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ | ||
-out "/etc/cactus/validator_socketio_indy/CA/connector.crt" | ||
``` | ||
``` | ||
mkdir -p "/etc/cactus/validator_socketio_indy/CA/" | ||
openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv" | ||
openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ | ||
-out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ | ||
-subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator" | ||
openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ | ||
-in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ | ||
-out "/etc/cactus/validator_socketio_indy/CA/connector.crt" | ||
``` | ||
1. Build and run validator container: | ||
``` | ||
docker build . -t indy-validator | ||
|
||
docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator | ||
``` | ||
``` | ||
docker build . -t indy-validator | ||
docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator | ||
``` | ||
|
||
1. Open separate console, install dependencies and run the testing script: | ||
``` | ||
cd testcli/ | ||
ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt . | ||
npm install | ||
node testsock.js | ||
``` | ||
Output should look like this: | ||
``` | ||
connect | ||
AVE5voPzdLLEcm5kAAAD | ||
websocket | ||
call nop! | ||
call request2. get schema request. | ||
#[recv]response, res: [object Object] | ||
call verify() | ||
##signsignature: .... | ||
Authentication OK | ||
##decoded: { | ||
result: [ | ||
'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2', | ||
'{"ver":"1.0","id":"Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2","name":"Job-Certificate","version":"0.2","attrNames":["experience","last_name","salary","first_name","employee_status"],"seqNo":19}' | ||
] | ||
} | ||
OK - Done. | ||
``` | ||
|
||
``` | ||
cd testcli/ | ||
ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt . | ||
npm install | ||
node testsock.js | ||
``` | ||
|
||
Output should look like this: | ||
|
||
``` | ||
connect | ||
AVE5voPzdLLEcm5kAAAD | ||
websocket | ||
call nop! | ||
call request2. get schema request. | ||
#[recv]response, res: [object Object] | ||
call verify() | ||
##signsignature: .... | ||
Authentication OK | ||
##decoded: { | ||
result: [ | ||
'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2', | ||
'{"ver":"1.0","id":"Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2","name":"Job-Certificate","version":"0.2","attrNames":["experience","last_name","salary","first_name","employee_status"],"seqNo":19}' | ||
] | ||
} | ||
OK - Done. | ||
``` | ||
|
||
## Manual Test | ||
|
||
- Validator used by `cactus-example-discounted-asset-trade` sample app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages-python/cactus_validator_socketio_indy/validator-python/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
__pycache__ | ||
*.log | ||
.venv | ||
venv |
36 changes: 15 additions & 21 deletions
36
packages-python/cactus_validator_socketio_indy/validator-python/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
base58==2.1.0 | ||
bidict==0.21.4 | ||
certifi==2023.7.22 | ||
cffi==1.14.6 | ||
charset-normalizer==2.0.3 | ||
click==8.0.1 | ||
base58==2.1.1 | ||
bidict==0.22.1 | ||
blinker==1.6.2 | ||
cffi==1.15.1 | ||
click==8.1.6 | ||
cryptography==41.0.3 | ||
dnspython==1.16.0 | ||
eventlet==0.31.1 | ||
Flask==2.3.2 | ||
Flask-SocketIO==5.1.1 | ||
gevent==21.1.2 | ||
greenlet==1.1.0 | ||
idna==3.2 | ||
itsdangerous==2.0.1 | ||
Jinja2==3.0.1 | ||
MarkupSafe==2.0.1 | ||
pycparser==2.20 | ||
greenlet==2.0.2 | ||
importlib-metadata==6.8.0 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.2 | ||
MarkupSafe==2.1.3 | ||
pycparser==2.21 | ||
PyJWT==2.4.0 | ||
python-engineio==4.3.0 | ||
python-socketio==5.5.0 | ||
python-engineio==4.5.1 | ||
python-socketio==5.8.0 | ||
python3-indy==1.16.0 | ||
PyYAML==5.4.1 | ||
requests==2.31.0 | ||
six==1.16.0 | ||
urllib3==1.26.6 | ||
websocket==0.2.1 | ||
Werkzeug==2.2.3 | ||
zope.event==4.5.0 | ||
zope.interface==5.4.0 | ||
Werkzeug==2.3.6 | ||
zipp==3.16.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters