From ac3f21c681e7359bbc64322e5805928f8249dbb0 Mon Sep 17 00:00:00 2001 From: Andrew Whitehead Date: Wed, 16 Mar 2022 08:49:07 -0700 Subject: [PATCH] set revoc_reg_id, revocation_id on issued credential exchange Signed-off-by: Andrew Whitehead --- .../protocols/issue_credential/v1_0/manager.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py index 7934d1725d..74dd313a8d 100644 --- a/aries_cloudagent/protocols/issue_credential/v1_0/manager.py +++ b/aries_cloudagent/protocols/issue_credential/v1_0/manager.py @@ -566,7 +566,9 @@ async def issue_credential( schema_id = cred_ex_record.schema_id rev_reg = None + rev_reg_id = None credential_ser = None + cred_rev_id = None if cred_ex_record.credential: LOGGER.warning( @@ -575,6 +577,8 @@ async def issue_credential( cred_ex_record.credential_exchange_id, ) credential_ser = cred_ex_record._credential.ser + cred_rev_id = cred_ex_record.revocation_id + rev_reg_id = cred_ex_record.revoc_reg_id else: cred_offer_ser = cred_ex_record._credential_offer.ser cred_req_ser = cred_ex_record._credential_request.ser @@ -599,8 +603,7 @@ async def issue_credential( cred_ex_record.credential_definition_id ) rev_reg = await active_rev_reg_rec.get_registry() - cred_ex_record.revoc_reg_id = active_rev_reg_rec.revoc_reg_id - + rev_reg_id = rev_reg.registry_id tails_path = rev_reg.tails_local_path await rev_reg.get_or_fetch_local_tails_path() @@ -661,22 +664,19 @@ async def issue_credential( ) issuer = self._profile.inject(IndyIssuer) try: - ( - credential_json, - cred_ex_record.revocation_id, - ) = await issuer.create_credential( + (credential_json, cred_rev_id) = await issuer.create_credential( schema, cred_offer_ser, cred_req_ser, credential_values, cred_ex_record.credential_exchange_id, - cred_ex_record.revoc_reg_id, + rev_reg_id, tails_path, ) credential_ser = json.loads(credential_json) # If the rev reg is now full - if rev_reg and rev_reg.max_creds == int(cred_ex_record.revocation_id): + if rev_reg and rev_reg.max_creds == int(cred_rev_id): async with self._profile.session() as session: await active_rev_reg_rec.set_state( session, @@ -728,6 +728,8 @@ async def issue_credential( ) cred_ex_record.state = V10CredentialExchange.STATE_ISSUED cred_ex_record.credential = credential_ser + cred_ex_record.revoc_reg_id = rev_reg_id + cred_ex_record.revocation_id = cred_rev_id await cred_ex_record.save(txn, reason="issue credential") await txn.commit()