Skip to content

Commit

Permalink
feat: add cred-type vc_di to demo runners
Browse files Browse the repository at this point in the history
Signed-off-by: tra371 <[email protected]>
  • Loading branch information
tra371 committed Feb 28, 2024
1 parent 9a31bff commit f7839e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
11 changes: 11 additions & 0 deletions demo/runners/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def __init__(
log_file: str = None,
log_config: str = None,
log_level: str = None,
cred_type: str = None,
**kwargs,
):
super().__init__(
Expand All @@ -188,6 +189,7 @@ def __init__(
log_file=log_file,
log_config=log_config,
log_level=log_level,
cred_type=cred_type,
**kwargs,
)
self.extra_args = [
Expand Down Expand Up @@ -330,6 +332,7 @@ async def main(
log_file: str = None,
log_config: str = None,
log_level: str = None,
cred_type: str = None,
):
if multi_ledger:
genesis = None
Expand Down Expand Up @@ -377,6 +380,7 @@ async def main(
log_file=log_file,
log_config=log_config,
log_level=log_level,
cred_type=cred_type,
)
await faber.listen_webhooks(start_port + 5)
await faber.register_did()
Expand Down Expand Up @@ -760,6 +764,13 @@ async def check_received_pings(agent, issue_count, pb):
"('debug', 'info', 'warning', 'error', 'critical')"
),
)
parser.add_argument(
"--cred-type",
type=str,
metavar="<cred-type>",
default=None,
help=("Specifyng the credential type"),
)
args = parser.parse_args()

if args.did_exchange and args.mediation:
Expand Down
22 changes: 20 additions & 2 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ async def register_did(
did: str = None,
verkey: str = None,
role: str = "TRUST_ANCHOR",
cred_type: str = CRED_FORMAT_INDY,
cred_type: str = CRED_FORMAT_INDY or CRED_FORMAT_VC_DI,
):
if cred_type in [CRED_FORMAT_INDY, CRED_FORMAT_VC_DI]:
# if registering a did for issuing indy credentials, publish the did on the ledger
Expand Down Expand Up @@ -732,7 +732,7 @@ async def register_or_switch_wallet(
public_did=False,
webhook_port: int = None,
mediator_agent=None,
cred_type: str = CRED_FORMAT_INDY,
cred_type: str = CRED_FORMAT_INDY or CRED_FORMAT_VC_DI,
endorser_agent=None,
taa_accept=False,
):
Expand Down Expand Up @@ -815,6 +815,23 @@ async def register_or_switch_wallet(
await self.register_did(
did=new_did["result"]["did"],
verkey=new_did["result"]["verkey"],
cred_type=CRED_FORMAT_INDY,
)
if self.endorser_role and self.endorser_role == "author":
if endorser_agent:
await self.admin_POST("/wallet/did/public?did=" + self.did)
await asyncio.sleep(3.0)
else:
await self.admin_POST("/wallet/did/public?did=" + self.did)
await asyncio.sleep(3.0)
elif cred_type == CRED_FORMAT_VC_DI:
# assign public did
new_did = await self.admin_POST("/wallet/did/create")
self.did = new_did["result"]["did"]
await self.register_did(
did=new_did["result"]["did"],
verkey=new_did["result"]["verkey"],
cred_type=CRED_FORMAT_VC_DI,
)
if self.endorser_role and self.endorser_role == "author":
if endorser_agent:
Expand Down Expand Up @@ -1678,6 +1695,7 @@ async def start_endorser_agent(
genesis_data=genesis,
genesis_txn_list=genesis_txn_list,
)
# await endorser_agent.register_did(cred_type=CRED_FORMAT_INDY)
await endorser_agent.register_did(cred_type=CRED_FORMAT_INDY)
await endorser_agent.listen_webhooks(start_port + 2)
await endorser_agent.start_process()
Expand Down

0 comments on commit f7839e4

Please sign in to comment.