-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathutils.py
124 lines (112 loc) · 3.42 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
from aries_cloudcontroller import (
AnoncredsPresentationReqAttrSpec,
AnoncredsPresentationRequest,
AnoncredsPresentationRequestNonRevoked,
AttachDecorator,
AttachDecoratorData,
DIFProofRequest,
IndyPresSpec,
IndyProof,
IndyProofProof,
IndyProofReqAttrSpec,
IndyProofRequestedProof,
IndyProofRequestNonRevoked,
IndyRequestedCredsRequestedAttr,
IndyRequestedCredsRequestedPred,
PresentationDefinition,
V20Pres,
V20PresExRecord,
V20PresExRecordByFormat,
V20PresFormat,
V20PresProposal,
)
from app.models.verifier import IndyProofRequest
indy_proof = IndyProof(
identifiers=[],
proof=IndyProofProof(aggregated_proof=None, proofs=None),
requested_proof=IndyProofRequestedProof(),
)
indy_proof_request_empty = IndyProofRequest(
non_revoked=None,
nonce=None,
requested_attributes={},
requested_predicates={},
)
def sample_indy_proof_request(restrictions=None) -> IndyProofRequest:
return IndyProofRequest(
name="string",
non_revoked=IndyProofRequestNonRevoked(),
nonce="12345",
requested_attributes={
"0_speed_uuid": IndyProofReqAttrSpec(
name="speed",
restrictions=restrictions,
)
},
requested_predicates={},
version="1.0",
)
def sample_anoncreds_proof_request(restrictions=None) -> AnoncredsPresentationRequest:
return AnoncredsPresentationRequest(
name="string",
non_revoked=AnoncredsPresentationRequestNonRevoked(),
nonce="12345",
requested_attributes={
"0_speed_uuid": AnoncredsPresentationReqAttrSpec(
name="speed",
restrictions=restrictions,
)
},
requested_predicates={},
version="1.0",
)
dif_proof_request = DIFProofRequest(
options=None, presentation_definition=PresentationDefinition()
)
v20_presentation_exchange_records = [
V20PresExRecord(
auto_present=False,
by_format=V20PresExRecordByFormat(
pres={"indy": {"hello": "world"}},
pres_proposal={"indy": {"hello": "world"}},
pres_request={"indy": sample_indy_proof_request().to_dict()},
),
connection_id="abc",
created_at="2021-09-15 13:49:47Z",
error_msg=None,
initiator="self",
pres=V20Pres(
formats=[V20PresFormat(attach_id="1234", format="indy")],
presentationsattach=[
AttachDecorator(
data=AttachDecoratorData(base64="asdf"),
)
],
pres_ex_id="abcd",
pres_proposal=V20PresProposal(
formats=[V20PresFormat(attach_id="1234", format="indy")],
proposalsattach=[
AttachDecorator(
data=AttachDecoratorData(base64="asdf"),
)
],
),
),
pres_request=None,
role="prover",
state="proposal-sent",
thread_id=None,
trace=None,
updated_at=None,
verified="false",
),
]
indy_pres_spec = IndyPresSpec(
requested_attributes={
"0_string_uuid": IndyRequestedCredsRequestedAttr(cred_id="0_string_uuid")
},
requested_predicates={
"0_string_GE_uuid": IndyRequestedCredsRequestedPred(cred_id="0_string_GE_uuid")
},
self_attested_attributes={"sth": "sth_else"},
)