-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Bluhm <dbluhm@pm.me>
- Loading branch information
Showing
3 changed files
with
144 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
version: "3" | ||
services: | ||
agency: | ||
image: ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0 | ||
ports: | ||
- "3001:3001" | ||
command: > | ||
start | ||
--label Agency | ||
--inbound-transport http 0.0.0.0 3000 | ||
--outbound-transport http | ||
--endpoint http://agency:3000 | ||
--admin 0.0.0.0 3001 | ||
--admin-insecure-mode | ||
--tails-server-base-url http://tails:6543 | ||
--genesis-url https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_testnet_genesis | ||
--wallet-type askar | ||
--wallet-name agency | ||
--wallet-key insecure | ||
--auto-provision | ||
--multitenant | ||
--multitenant-admin | ||
--jwt-secret insecure | ||
--multitenancy-config wallet_type=askar-profile key_derivation_method=RAW | ||
--log-level debug | ||
--debug-webhooks | ||
healthcheck: | ||
test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null | ||
start_period: 30s | ||
interval: 7s | ||
timeout: 5s | ||
retries: 5 | ||
depends_on: | ||
tails: | ||
condition: service_started | ||
|
||
example: | ||
container_name: controller | ||
build: | ||
context: ../.. | ||
environment: | ||
- AGENCY=http://agency:3001 | ||
volumes: | ||
- ./example.py:/usr/src/app/example.py:ro,z | ||
command: python -m example | ||
depends_on: | ||
agency: | ||
condition: service_healthy | ||
|
||
tails: | ||
image: ghcr.io/bcgov/tails-server:latest | ||
ports: | ||
- 6543:6543 | ||
environment: | ||
- GENESIS_URL=https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_testnet_genesis | ||
command: > | ||
tails-server | ||
--host 0.0.0.0 | ||
--port 6543 | ||
--storage-path /tmp/tails-files | ||
--log-level INFO | ||
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"""Minimal reproducible example script. | ||
This script is for you to use to reproduce a bug or demonstrate a feature. | ||
""" | ||
|
||
import asyncio | ||
from os import getenv | ||
|
||
from acapy_controller import Controller | ||
from acapy_controller.logging import logging_to_stdout | ||
from acapy_controller.models import CreateWalletResponse | ||
from acapy_controller.protocols import ( | ||
didexchange, | ||
indy_anoncred_credential_artifacts, | ||
indy_anoncred_onboard, | ||
indy_issue_credential_v2, | ||
indy_present_proof_v2, | ||
) | ||
|
||
AGENCY = getenv("AGENCY", "http://agency:3001") | ||
|
||
|
||
async def main(): | ||
"""Test Controller protocols.""" | ||
async with Controller(base_url=AGENCY) as agency: | ||
alice = await agency.post( | ||
"/multitenancy/wallet", | ||
json={ | ||
"label": "Alice", | ||
"wallet_type": "askar", | ||
}, | ||
response=CreateWalletResponse, | ||
) | ||
bob = await agency.post( | ||
"/multitenancy/wallet", | ||
json={ | ||
"label": "Bob", | ||
"wallet_type": "askar", | ||
}, | ||
response=CreateWalletResponse, | ||
) | ||
|
||
async with Controller( | ||
base_url=AGENCY, wallet_id=alice.wallet_id, subwallet_token=alice.token | ||
) as alice, Controller( | ||
base_url=AGENCY, wallet_id=bob.wallet_id, subwallet_token=bob.token | ||
) as bob: | ||
# Issuance prep | ||
await indy_anoncred_onboard(alice) | ||
_, cred_def = await indy_anoncred_credential_artifacts( | ||
alice, | ||
["firstname", "lastname"], | ||
support_revocation=True, | ||
) | ||
|
||
# Connecting | ||
alice_conn, bob_conn = await didexchange(alice, bob) | ||
|
||
# Issue a credential | ||
await indy_issue_credential_v2( | ||
alice, | ||
bob, | ||
alice_conn.connection_id, | ||
bob_conn.connection_id, | ||
cred_def.credential_definition_id, | ||
{"firstname": "Bob", "lastname": "Builder"}, | ||
) | ||
|
||
# Present the the credential's attributes | ||
await indy_present_proof_v2( | ||
bob, | ||
alice, | ||
bob_conn.connection_id, | ||
alice_conn.connection_id, | ||
requested_attributes=[{"name": "firstname"}], | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
logging_to_stdout() | ||
asyncio.run(main()) |