Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add role to credential exchange records #214

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ async def handle(self, context: RequestContext, responder: BaseResponder):
connection_id=context.connection_record.connection_id,
thread_id=context.message._thread_id,
initiator=V10CredentialExchange.INITIATOR_EXTERNAL,
role=V10CredentialExchange.ROLE_HOLDER,
credential_definition_id=indy_offer["cred_def_id"],
schema_id=indy_offer["schema_id"],
credential_proposal_dict=credential_proposal_dict
Expand Down
4 changes: 4 additions & 0 deletions aries_cloudagent/messaging/issue_credential/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ async def prepare_send(
auto_issue=True,
connection_id=connection_id,
initiator=V10CredentialExchange.INITIATOR_SELF,
role=V10CredentialExchange.ROLE_ISSUER,
state=V10CredentialExchange.STATE_REQUEST_RECEIVED,
credential_definition_id=credential_definition_id,
schema_id=source_credential_exchange.schema_id,
Expand All @@ -161,6 +162,7 @@ async def prepare_send(
auto_issue=True,
connection_id=connection_id,
initiator=V10CredentialExchange.INITIATOR_SELF,
role=V10CredentialExchange.ROLE_ISSUER,
credential_definition_id=credential_definition_id,
credential_proposal_dict=credential_proposal.serialize(),
)
Expand Down Expand Up @@ -257,6 +259,7 @@ async def create_proposal(
connection_id=connection_id,
thread_id=credential_proposal_message._thread_id,
initiator=V10CredentialExchange.INITIATOR_SELF,
role=V10CredentialExchange.ROLE_HOLDER,
state=V10CredentialExchange.STATE_PROPOSAL_SENT,
credential_definition_id=credential_definition_id,
schema_id=schema_id,
Expand Down Expand Up @@ -293,6 +296,7 @@ async def receive_proposal(self,):
connection_id=connection_id,
thread_id=credential_proposal_message._thread_id,
initiator=V10CredentialExchange.INITIATOR_EXTERNAL,
role=V10CredentialExchange.ROLE_ISSUER,
state=V10CredentialExchange.STATE_PROPOSAL_RECEIVED,
credential_definition_id=cred_def_id,
schema_id=schema_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Meta:

INITIATOR_SELF = "self"
INITIATOR_EXTERNAL = "external"
ROLE_ISSUER = "issuer"
ROLE_HOLDER = "holder"

STATE_PROPOSAL_SENT = "proposal_sent"
STATE_PROPOSAL_RECEIVED = "proposal_received"
Expand All @@ -40,6 +42,7 @@ def __init__(
thread_id: str = None,
parent_thread_id: str = None,
initiator: str = None,
role: str = None,
state: str = None,
credential_definition_id: str = None,
schema_id: str = None,
Expand All @@ -62,6 +65,7 @@ def __init__(
self.thread_id = thread_id
self.parent_thread_id = parent_thread_id
self.initiator = initiator
self.role = role
self.state = state
self.credential_definition_id = credential_definition_id
self.schema_id = schema_id
Expand Down Expand Up @@ -110,6 +114,7 @@ def record_tags(self) -> dict:
"connection_id",
"thread_id",
"initiator",
"role",
"state",
"credential_definition_id",
"schema_id",
Expand Down Expand Up @@ -155,6 +160,12 @@ class Meta:
example=V10CredentialExchange.INITIATOR_SELF,
validate=OneOf(["self", "external"]),
)
role = fields.Str(
required=False,
description="Issue-credential exchange role: holder or issuer",
example=V10CredentialExchange.ROLE_ISSUER,
validate=OneOf(['holder', 'issuer'])
)
state = fields.Str(
required=False,
description="Issue-credential exchange state",
Expand Down