|
1 | 1 | # Indy Validator
|
| 2 | + |
2 | 3 | - Cactus socketio validator to integrate with Hyperledger Indy
|
3 | 4 |
|
4 | 5 | ## Build
|
| 6 | + |
5 | 7 | - By default, it assumes that indy pool is available at `172.16.0.2`
|
6 | 8 | - You can modify this behavior by editing `Dockerfile` or by setting arg `pool_ip`
|
| 9 | + |
7 | 10 | ```
|
8 | 11 | ./setup_indy.sh
|
9 | 12 | ```
|
10 | 13 |
|
| 14 | +## Updating the dependencies |
| 15 | + |
| 16 | +- When updating depedency in `requirements.txt` make sure that it's dependencies are updated as well. |
| 17 | +- Make sure you update the package version in `setup.py` as well. |
| 18 | +- After each update build and run container to ensure it still works. |
| 19 | +- Follow this process when updating the package: |
| 20 | + |
| 21 | +```bash |
| 22 | + # Go to package dir |
| 23 | + cd packages-python/cactus_validator_socketio_indy/validator-python |
| 24 | + |
| 25 | + # Setup venv and install core dependencies |
| 26 | + python3 -m venv .venv |
| 27 | + source .venv/bin/activate |
| 28 | + pip install --upgrade setuptools wheel |
| 29 | + 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 |
| 30 | + |
| 31 | + # Freeze current package listing |
| 32 | + pip freeze > requirements.txt |
| 33 | + |
| 34 | + # Copy the contents of requirements.txt to setup.py install_requires list (adjust formatting accordingly). |
| 35 | +``` |
| 36 | + |
11 | 37 | ## Test
|
| 38 | + |
12 | 39 | - Use `testcli/testsock.js` to check basic communication pattern with the validator.
|
13 | 40 |
|
14 | 41 | ### How-To
|
| 42 | + |
15 | 43 | 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`.
|
16 | 44 | 1. Generate proof and store it in local `/etc/cactus`:
|
17 |
| - ``` |
18 |
| - rm -r /etc/cactus/validator_socketio_indy/* |
19 |
| - cd ../../examples/register-indy-data/ |
20 |
| - ./script-build-docker.sh |
21 |
| - docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only |
22 |
| - ``` |
| 45 | + ``` |
| 46 | + rm -r /etc/cactus/validator_socketio_indy/* |
| 47 | + cd ../../examples/register-indy-data/ |
| 48 | + ./script-build-docker.sh |
| 49 | + docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --proof_only |
| 50 | + ``` |
23 | 51 | 1. Copy indy validator config
|
24 |
| - ``` |
25 |
| - cp -rf ./config/* /etc/cactus/validator_socketio_indy/ |
26 |
| - ``` |
| 52 | + ``` |
| 53 | + cp -rf ./config/* /etc/cactus/validator_socketio_indy/ |
| 54 | + ``` |
27 | 55 | 1. Generate validator certificate using OpenSSL tool
|
28 |
| - ``` |
29 |
| - mkdir -p "/etc/cactus/validator_socketio_indy/CA/" |
30 |
| - openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv" |
31 |
| - openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ |
32 |
| - -out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ |
33 |
| - -subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator" |
34 |
| - openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ |
35 |
| - -in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ |
36 |
| - -out "/etc/cactus/validator_socketio_indy/CA/connector.crt" |
37 |
| - ``` |
| 56 | + ``` |
| 57 | + mkdir -p "/etc/cactus/validator_socketio_indy/CA/" |
| 58 | + openssl ecparam -genkey -name "prime256v1" -out "/etc/cactus/validator_socketio_indy/CA/connector.priv" |
| 59 | + openssl req -new -sha256 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ |
| 60 | + -out "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ |
| 61 | + -subj "/C=JP/ST=Tokyo/L=Minato-Ku/O=CactusSamples/CN=IndyValidator" |
| 62 | + openssl req -x509 -sha256 -days 365 -key "/etc/cactus/validator_socketio_indy/CA/connector.priv" \ |
| 63 | + -in "/etc/cactus/validator_socketio_indy/CA/connector.csr" \ |
| 64 | + -out "/etc/cactus/validator_socketio_indy/CA/connector.crt" |
| 65 | + ``` |
38 | 66 | 1. Build and run validator container:
|
39 |
| - ``` |
40 |
| - docker build . -t indy-validator |
41 | 67 |
|
42 |
| - docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator |
43 |
| - ``` |
| 68 | + ``` |
| 69 | + docker build . -t indy-validator |
| 70 | +
|
| 71 | + docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator |
| 72 | + ``` |
| 73 | + |
44 | 74 | 1. Open separate console, install dependencies and run the testing script:
|
45 |
| - ``` |
46 |
| - cd testcli/ |
47 |
| - ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt . |
48 |
| - npm install |
49 |
| - node testsock.js |
50 |
| - ``` |
51 |
| -
|
52 |
| - Output should look like this: |
53 |
| - ``` |
54 |
| - connect |
55 |
| - AVE5voPzdLLEcm5kAAAD |
56 |
| - websocket |
57 |
| - call nop! |
58 |
| - call request2. get schema request. |
59 |
| - #[recv]response, res: [object Object] |
60 |
| - call verify() |
61 |
| - ##signsignature: .... |
62 |
| - Authentication OK |
63 |
| - ##decoded: { |
64 |
| - result: [ |
65 |
| - 'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2', |
66 |
| - '{"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}' |
67 |
| - ] |
68 |
| - } |
69 |
| - OK - Done. |
70 |
| - ``` |
| 75 | + |
| 76 | + ``` |
| 77 | + cd testcli/ |
| 78 | + ln -s /etc/cactus/validator_socketio_indy/CA/connector.crt . |
| 79 | + npm install |
| 80 | + node testsock.js |
| 81 | + ``` |
| 82 | + |
| 83 | + Output should look like this: |
| 84 | + |
| 85 | + ``` |
| 86 | + connect |
| 87 | + AVE5voPzdLLEcm5kAAAD |
| 88 | + websocket |
| 89 | + call nop! |
| 90 | + call request2. get schema request. |
| 91 | + #[recv]response, res: [object Object] |
| 92 | + call verify() |
| 93 | + ##signsignature: .... |
| 94 | + Authentication OK |
| 95 | + ##decoded: { |
| 96 | + result: [ |
| 97 | + 'Apyv5EV88KoZRqtXMmaeXV:2:Job-Certificate:0.2', |
| 98 | + '{"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}' |
| 99 | + ] |
| 100 | + } |
| 101 | + OK - Done. |
| 102 | + ``` |
71 | 103 |
|
72 | 104 | ## Manual Test
|
| 105 | + |
73 | 106 | - Validator used by `cactus-example-discounted-asset-trade` sample app.
|
0 commit comments