Skip to content

Commit

Permalink
set revoc_reg_id, revocation_id on issued credential exchange
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
  • Loading branch information
andrewwhitehead committed Mar 16, 2022
1 parent 9c65346 commit ac3f21c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions aries_cloudagent/protocols/issue_credential/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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()

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit ac3f21c

Please sign in to comment.