Skip to content

Commit 944ffb7

Browse files
committed
implement most missing endpoints. Add TODO's for test
1 parent 9b5531d commit 944ffb7

File tree

10 files changed

+63
-444
lines changed

10 files changed

+63
-444
lines changed

libs/aries-basic-controller/aries_basic_controller/controllers/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,17 @@ async def admin_POST(
103103
raise
104104

105105

106+
async def admin_DELETE(
107+
self, path, text=False, params=None
108+
) -> ClientResponse:
109+
try:
110+
EVENT_LOGGER.debug("Controller DELETE %s request to Agent", path)
111+
112+
response = await self.admin_request("DELETE", path, None, text, params)
113+
EVENT_LOGGER.debug(
114+
"Response from DELETE %s received: \n%s", path, repr_json(response),
115+
)
116+
return response
117+
except ClientError as e:
118+
self.log(f"Error during DELETE {path}: {str(e)}")
119+
raise

libs/aries-basic-controller/aries_basic_controller/controllers/connections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ async def establish_inbound(self, connection_id: str, router_conn_id: str):
120120
return response
121121

122122
async def remove_connection(self, connection_id):
123-
response = await self.admin_POST(f"/connections/{connection_id}/remove")
123+
response = await self.admin_DELETE(f"/connections/{connection_id}")
124124
return response
125125

126126
async def create_static(self, their_seed, their_label, their_verkey, their_role, my_seed, my_did, their_endpoint, alias, their_did):

libs/aries-basic-controller/aries_basic_controller/controllers/credential.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async def get_credential_mime_types(self, credential_id):
1616
return await self.admin_GET(f"/credential/mime-types/{credential_id}")
1717

1818
async def remove_credential(self, credential_id):
19-
return await self.admin_POST(f"/credential/{credential_id}/remove")
19+
return await self.admin_DELETE(f"/credential/{credential_id}")
2020

2121
async def get_all(self, wql_query: str = None, count: int = None, start: int = None):
2222
params = {}
@@ -27,4 +27,7 @@ async def get_all(self, wql_query: str = None, count: int = None, start: int = N
2727
if start:
2828
params["start"] = start
2929

30-
return await self.admin_GET("/credentials", params=params)
30+
return await self.admin_GET("/credentials", params=params)
31+
32+
async def is_revoked(self, credential_id):
33+
return await self.admin_GET(f"credential/revoked/{credential_id}")

libs/aries-basic-controller/aries_basic_controller/controllers/issuer.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ async def store_credential(self, cred_ex_id, credential_id):
9696
return await self.admin_POST(f"{self.base_url}/records/{cred_ex_id}/store", json_data=body)
9797

9898
# Revoke and issued credential
99-
async def revoke_credential(self, rev_reg_id, cred_rev_id, publish: bool = False):
100-
params = {
101-
"rev_reg_id": rev_reg_id,
102-
"cred_reg_id": cred_rev_id,
103-
"publish": publish
104-
}
105-
return await self.admin_POST(f"{self.base_url}/revoke", params=params)
106-
107-
# Publish pending revocations
108-
async def publish_revocations(self):
109-
return await self.admin_POST(f"{self.base_url}/publish-revocations")
99+
# async def revoke_credential(self, rev_reg_id, cred_rev_id, publish: bool = False):
100+
# params = {
101+
# "rev_reg_id": rev_reg_id,
102+
# "cred_reg_id": cred_rev_id,
103+
# "publish": publish
104+
# }
105+
# return await self.admin_POST(f"{self.base_url}/revoke", params=params)
106+
#
107+
# # Publish pending revocations
108+
# async def publish_revocations(self):
109+
# return await self.admin_POST(f"{self.base_url}/publish-revocations")
110110

111111
# Remove an existing credential exchange record
112112
async def remove_record(self, cred_ex_id):
113-
return await self.admin_POST(f"{self.base_url}/records/{cred_ex_id}/remove")
113+
return await self.admin_DELETE(f"{self.base_url}/records/{cred_ex_id}")
114114

115115
# Send a problem report for a credential exchange
116116
async def problem_report(self, cred_ex_id, explanation: str):

libs/aries-basic-controller/aries_basic_controller/controllers/ledger.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ async def register_nym(self, did, verkey, role: str = None, alias: str = None):
2222

2323
return await self.admin_POST(f"{self.base_url}/register-nym", params=params)
2424

25+
async def get_nym_role(self, did):
26+
params = {
27+
"did": did
28+
}
29+
return await self.admin_GET(f"{self.base_url}/get-nym-role", params=params)
30+
2531

2632
async def get_did_verkey(self, did):
2733
params = {
@@ -41,4 +47,6 @@ async def get_taa(self):
4147
async def accept_taa(self, data):
4248
return await self.admin_POST(f"{self.base_url}/taa/accept", json_data=data)
4349

50+
#TODO PATCH rotate key pair
51+
4452

libs/aries-basic-controller/aries_basic_controller/controllers/proof.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def verify_presentation(self, pres_ex_id):
7979
return await self.admin_POST(f"{self.base_url}/records/{pres_ex_id}/verify-presentation")
8080

8181
async def remove_presentation_record(self, pres_ex_id):
82-
return await self.admin_POST(f"{self.base_url}/records/{pres_ex_id}/remove")
82+
return await self.admin_DELETE(f"{self.base_url}/records/{pres_ex_id}")
8383

8484
# def build_proof_request(self, name, version, requested_attributes, requested_predicates):
8585

libs/aries-basic-controller/aries_basic_controller/controllers/server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ async def get_status(self):
1919
async def reset_status(self):
2020
return await self.admin_POST('/status/reset')
2121

22+
async def status_ready(self):
23+
return await self.admin_GET('/status/ready')
24+
25+
async def status_live(self):
26+
return await self.admin_GET('/status/live')
27+
2228
async def get_features(self, query: str = None):
2329
params = {}
2430
if query:
2531
params["query"] = query
2632

2733
return await self.admin_GET('/features', params=params)
34+
35+
## TODO implement shutdown. Should this be a POST?

libs/aries-basic-controller/aries_basic_controller/controllers/wallet.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@ async def assign_public_did(self, did):
2626
}
2727
return await self.admin_POST(f"{self.base_url}/did/public", params=params)
2828

29-
async def get_tag_policy(self, credential_definition_id):
30-
return await self.admin_GET(f"{self.base_url}/tag-policy/{credential_definition_id}")
29+
async def get_did_endpoint(self, did):
30+
params = {
31+
"did": did
32+
}
33+
return await self.admin_GET(f"{self.base_url}/get-did-endpoint", params=params)
34+
35+
async def set_did_endpoint(self, did, endpoint, endpoint_type):
36+
body = {
37+
"did": did,
38+
"endpoint": endpoint,
39+
"endpoint_type": endpoint_type
40+
}
41+
return await self.admin_POST(f"{self.base_url}/set-did-endpoint", json_data=body)
3142

32-
async def set_tag_policy(self, credential_definition_id):
33-
return await self.admin_POST(f"{self.base_url}/tag-policy/{credential_definition_id}")
43+
## TODO Patch rotate-keypair

tutorials/aries-basic-controller/notebooks/alice/attachment.ipynb

Lines changed: 0 additions & 219 deletions
This file was deleted.

0 commit comments

Comments
 (0)