Module mydata_did.patched_protocols.present_proof.v1_0.models.presentation_exchange
Aries#0037 v1.0 presentation exchange information with non-secrets storage.
Expand source code
"""Aries#0037 v1.0 presentation exchange information with non-secrets storage."""
from os import environ
from typing import Any
from marshmallow import fields, validate
from aries_cloudagent.messaging.models.base_record import BaseExchangeRecord, BaseExchangeSchema
from aries_cloudagent.messaging.valid import UUIDFour
unencrypted_tags = environ.get("EXCH_UNENCRYPTED_TAGS", "False").upper() == "TRUE"
class V10PresentationExchange(BaseExchangeRecord):
"""Represents an Aries#0037 v1.0 presentation exchange."""
class Meta:
"""V10PresentationExchange metadata."""
schema_class = "V10PresentationExchangeSchema"
RECORD_TYPE = "presentation_exchange_v10"
RECORD_ID_NAME = "presentation_exchange_id"
WEBHOOK_TOPIC = "present_proof"
TAG_NAMES = {"~thread_id"} if unencrypted_tags else {"thread_id"}
INITIATOR_SELF = "self"
INITIATOR_EXTERNAL = "external"
ROLE_PROVER = "prover"
ROLE_VERIFIER = "verifier"
STATE_PROPOSAL_SENT = "proposal_sent"
STATE_PROPOSAL_RECEIVED = "proposal_received"
STATE_REQUEST_SENT = "request_sent"
STATE_REQUEST_RECEIVED = "request_received"
STATE_PRESENTATION_SENT = "presentation_sent"
STATE_PRESENTATION_RECEIVED = "presentation_received"
STATE_VERIFIED = "verified"
STATE_PRESENTATION_ACKED = "presentation_acked"
def __init__(
self,
*,
presentation_exchange_id: str = None,
connection_id: str = None,
thread_id: str = None,
initiator: str = None,
role: str = None,
state: str = None,
presentation_proposal_dict: dict = None, # serialized pres proposal message
presentation_request: dict = None, # indy proof req
presentation_request_dict: dict = None, # serialized pres request message
presentation: dict = None, # indy proof
verified: str = None,
auto_present: bool = False,
error_msg: str = None,
trace: bool = False,
template_id: str = None,
**kwargs
):
"""Initialize a new PresentationExchange."""
super().__init__(presentation_exchange_id, state, trace=trace, **kwargs)
self.connection_id = connection_id
self.thread_id = thread_id
self.initiator = initiator
self.role = role
self.state = state
self.presentation_proposal_dict = presentation_proposal_dict
self.presentation_request = presentation_request # indy proof req
self.presentation_request_dict = presentation_request_dict
self.presentation = presentation # indy proof
self.verified = verified
self.auto_present = auto_present
self.error_msg = error_msg
self.trace = trace
self.template_id = template_id
@property
def presentation_exchange_id(self) -> str:
"""Accessor for the ID associated with this exchange."""
return self._id
@property
def record_value(self) -> dict:
"""Accessor for JSON record value generated for this presentation exchange."""
return {
prop: getattr(self, prop)
for prop in (
"connection_id",
"initiator",
"presentation_proposal_dict",
"presentation_request",
"presentation_request_dict",
"presentation",
"role",
"state",
"auto_present",
"error_msg",
"verified",
"trace",
"template_id"
)
}
def __eq__(self, other: Any) -> bool:
"""Comparison between records."""
return super().__eq__(other)
class V10PresentationExchangeSchema(BaseExchangeSchema):
"""Schema for de/serialization of v1.0 presentation exchange records."""
class Meta:
"""V10PresentationExchangeSchema metadata."""
model_class = V10PresentationExchange
presentation_exchange_id = fields.Str(
required=False,
description="Presentation exchange identifier",
example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily
)
connection_id = fields.Str(
required=False,
description="Connection identifier",
example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily
)
thread_id = fields.Str(
required=False,
description="Thread identifier",
example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily
)
initiator = fields.Str(
required=False,
description="Present-proof exchange initiator: self or external",
example=V10PresentationExchange.INITIATOR_SELF,
validate=validate.OneOf(["self", "external"]),
)
role = fields.Str(
required=False,
description="Present-proof exchange role: prover or verifier",
example=V10PresentationExchange.ROLE_PROVER,
validate=validate.OneOf(["prover", "verifier"]),
)
state = fields.Str(
required=False,
description="Present-proof exchange state",
example=V10PresentationExchange.STATE_VERIFIED,
)
presentation_proposal_dict = fields.Dict(
required=False, description="Serialized presentation proposal message"
)
presentation_request = fields.Dict(
required=False,
description="(Indy) presentation request (also known as proof request)",
)
presentation_request_dict = fields.Dict(
required=False, description="Serialized presentation request message"
)
presentation = fields.Dict(
required=False, description="(Indy) presentation (also known as proof)"
)
verified = fields.Str( # tag: must be a string
required=False,
description="Whether presentation is verified: true or false",
example="true",
validate=validate.OneOf(["true", "false"]),
)
auto_present = fields.Bool(
required=False,
description="Prover choice to auto-present proof as verifier requests",
example=False,
)
error_msg = fields.Str(
required=False, description="Error message", example="Invalid structure"
)
template_id = fields.Str(required=False)
Classes
class V10PresentationExchange (*, presentation_exchange_id: str = None, connection_id: str = None, thread_id: str = None, initiator: str = None, role: str = None, state: str = None, presentation_proposal_dict: dict = None, presentation_request: dict = None, presentation_request_dict: dict = None, presentation: dict = None, verified: str = None, auto_present: bool = False, error_msg: str = None, trace: bool = False, template_id: str = None, **kwargs)
-
Represents an Aries#0037 v1.0 presentation exchange.
Initialize a new PresentationExchange.
Expand source code
class V10PresentationExchange(BaseExchangeRecord): """Represents an Aries#0037 v1.0 presentation exchange.""" class Meta: """V10PresentationExchange metadata.""" schema_class = "V10PresentationExchangeSchema" RECORD_TYPE = "presentation_exchange_v10" RECORD_ID_NAME = "presentation_exchange_id" WEBHOOK_TOPIC = "present_proof" TAG_NAMES = {"~thread_id"} if unencrypted_tags else {"thread_id"} INITIATOR_SELF = "self" INITIATOR_EXTERNAL = "external" ROLE_PROVER = "prover" ROLE_VERIFIER = "verifier" STATE_PROPOSAL_SENT = "proposal_sent" STATE_PROPOSAL_RECEIVED = "proposal_received" STATE_REQUEST_SENT = "request_sent" STATE_REQUEST_RECEIVED = "request_received" STATE_PRESENTATION_SENT = "presentation_sent" STATE_PRESENTATION_RECEIVED = "presentation_received" STATE_VERIFIED = "verified" STATE_PRESENTATION_ACKED = "presentation_acked" def __init__( self, *, presentation_exchange_id: str = None, connection_id: str = None, thread_id: str = None, initiator: str = None, role: str = None, state: str = None, presentation_proposal_dict: dict = None, # serialized pres proposal message presentation_request: dict = None, # indy proof req presentation_request_dict: dict = None, # serialized pres request message presentation: dict = None, # indy proof verified: str = None, auto_present: bool = False, error_msg: str = None, trace: bool = False, template_id: str = None, **kwargs ): """Initialize a new PresentationExchange.""" super().__init__(presentation_exchange_id, state, trace=trace, **kwargs) self.connection_id = connection_id self.thread_id = thread_id self.initiator = initiator self.role = role self.state = state self.presentation_proposal_dict = presentation_proposal_dict self.presentation_request = presentation_request # indy proof req self.presentation_request_dict = presentation_request_dict self.presentation = presentation # indy proof self.verified = verified self.auto_present = auto_present self.error_msg = error_msg self.trace = trace self.template_id = template_id @property def presentation_exchange_id(self) -> str: """Accessor for the ID associated with this exchange.""" return self._id @property def record_value(self) -> dict: """Accessor for JSON record value generated for this presentation exchange.""" return { prop: getattr(self, prop) for prop in ( "connection_id", "initiator", "presentation_proposal_dict", "presentation_request", "presentation_request_dict", "presentation", "role", "state", "auto_present", "error_msg", "verified", "trace", "template_id" ) } def __eq__(self, other: Any) -> bool: """Comparison between records.""" return super().__eq__(other)
Ancestors
- aries_cloudagent.messaging.models.base_record.BaseExchangeRecord
- aries_cloudagent.messaging.models.base_record.BaseRecord
- aries_cloudagent.messaging.models.base.BaseModel
- abc.ABC
Class variables
var INITIATOR_EXTERNAL
var INITIATOR_SELF
var Meta
-
V10PresentationExchange metadata.
var RECORD_ID_NAME
var RECORD_TYPE
var ROLE_PROVER
var ROLE_VERIFIER
var STATE_PRESENTATION_ACKED
var STATE_PRESENTATION_RECEIVED
var STATE_PRESENTATION_SENT
var STATE_PROPOSAL_RECEIVED
var STATE_PROPOSAL_SENT
var STATE_REQUEST_RECEIVED
var STATE_REQUEST_SENT
var STATE_VERIFIED
var TAG_NAMES
var WEBHOOK_TOPIC
Instance variables
var presentation_exchange_id : str
-
Accessor for the ID associated with this exchange.
Expand source code
@property def presentation_exchange_id(self) -> str: """Accessor for the ID associated with this exchange.""" return self._id
var record_value : dict
-
Accessor for JSON record value generated for this presentation exchange.
Expand source code
@property def record_value(self) -> dict: """Accessor for JSON record value generated for this presentation exchange.""" return { prop: getattr(self, prop) for prop in ( "connection_id", "initiator", "presentation_proposal_dict", "presentation_request", "presentation_request_dict", "presentation", "role", "state", "auto_present", "error_msg", "verified", "trace", "template_id" ) }
class V10PresentationExchangeSchema (*args, **kwargs)
-
Schema for de/serialization of v1.0 presentation exchange records.
Initialize BaseModelSchema.
Raises
TypeError
- If model_class is not set on Meta
Expand source code
class V10PresentationExchangeSchema(BaseExchangeSchema): """Schema for de/serialization of v1.0 presentation exchange records.""" class Meta: """V10PresentationExchangeSchema metadata.""" model_class = V10PresentationExchange presentation_exchange_id = fields.Str( required=False, description="Presentation exchange identifier", example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily ) connection_id = fields.Str( required=False, description="Connection identifier", example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily ) thread_id = fields.Str( required=False, description="Thread identifier", example=UUIDFour.EXAMPLE, # typically a UUID4 but not necessarily ) initiator = fields.Str( required=False, description="Present-proof exchange initiator: self or external", example=V10PresentationExchange.INITIATOR_SELF, validate=validate.OneOf(["self", "external"]), ) role = fields.Str( required=False, description="Present-proof exchange role: prover or verifier", example=V10PresentationExchange.ROLE_PROVER, validate=validate.OneOf(["prover", "verifier"]), ) state = fields.Str( required=False, description="Present-proof exchange state", example=V10PresentationExchange.STATE_VERIFIED, ) presentation_proposal_dict = fields.Dict( required=False, description="Serialized presentation proposal message" ) presentation_request = fields.Dict( required=False, description="(Indy) presentation request (also known as proof request)", ) presentation_request_dict = fields.Dict( required=False, description="Serialized presentation request message" ) presentation = fields.Dict( required=False, description="(Indy) presentation (also known as proof)" ) verified = fields.Str( # tag: must be a string required=False, description="Whether presentation is verified: true or false", example="true", validate=validate.OneOf(["true", "false"]), ) auto_present = fields.Bool( required=False, description="Prover choice to auto-present proof as verifier requests", example=False, ) error_msg = fields.Str( required=False, description="Error message", example="Invalid structure" ) template_id = fields.Str(required=False)
Ancestors
- aries_cloudagent.messaging.models.base_record.BaseExchangeSchema
- aries_cloudagent.messaging.models.base_record.BaseRecordSchema
- aries_cloudagent.messaging.models.base.BaseModelSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
var Meta
-
V10PresentationExchangeSchema metadata.
var opts