add new call to proofs
This commit is contained in:
parent
4f2cfe5c47
commit
7f449aa95c
|
@ -485,7 +485,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
def get_phid(self):
|
def get_phid(self):
|
||||||
"""This method is used for get the phid of the computer when the action
|
"""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
|
was created. Usefull for get the phid of the computer were a hdd was
|
||||||
Ereased
|
Ereased.
|
||||||
"""
|
"""
|
||||||
if self.snapshot:
|
if self.snapshot:
|
||||||
return self.snapshot.device.phid()
|
return self.snapshot.device.phid()
|
||||||
|
@ -494,7 +494,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def register_proof(self):
|
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:
|
if 'dpp' not in app.blueprints.keys() or not self.snapshot:
|
||||||
return
|
return
|
||||||
|
@ -514,10 +514,19 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
||||||
|
|
||||||
deviceCHID = self.device.chid
|
deviceCHID = self.device.chid
|
||||||
docSig = self.snapshot.phid_dpp
|
docSig = self.snapshot.phid_dpp
|
||||||
|
docHash = docSig
|
||||||
|
docHashAlgorithm = 'sha3_256'
|
||||||
docID = "{}".format(self.snapshot.uuid or '')
|
docID = "{}".format(self.snapshot.uuid or '')
|
||||||
issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id)
|
issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id)
|
||||||
proof_type = PROOF_ENUM['Erase']
|
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
|
from ereuse_devicehub.resources.enums import StatusCode
|
||||||
|
|
||||||
if result['Status'] == StatusCode.Success.value:
|
if result['Status'] == StatusCode.Success.value:
|
||||||
|
|
Reference in New Issue