From 7f449aa95ca4b91f2bcaff73d08ad30279b58fa0 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 24 Jul 2023 19:23:26 +0200 Subject: [PATCH] add new call to proofs --- ereuse_devicehub/resources/action/models.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index a8dac9e3..d4505da8 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -485,7 +485,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): def get_phid(self): """This method is used for get the phid of the computer when the action was created. Usefull for get the phid of the computer were a hdd was - Ereased + Ereased. """ if self.snapshot: return self.snapshot.device.phid() @@ -494,7 +494,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): return '' def register_proof(self): - """This method is used for register a proof of erasure en dlt""" + """This method is used for register a proof of erasure en dlt.""" if 'dpp' not in app.blueprints.keys() or not self.snapshot: return @@ -514,10 +514,19 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): deviceCHID = self.device.chid docSig = self.snapshot.phid_dpp + docHash = docSig + docHashAlgorithm = 'sha3_256' docID = "{}".format(self.snapshot.uuid or '') issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id) proof_type = PROOF_ENUM['Erase'] - result = api.generate_proof(deviceCHID, docID, docSig, issuerID, proof_type) + result = api.generate_proof( + deviceCHID, + docHashAlgorithm, + docHash, + proof_type, + dh_instance, + ) + from ereuse_devicehub.resources.enums import StatusCode if result['Status'] == StatusCode.Success.value: