fix, phid_dpp instead of json_wb

This commit is contained in:
Cayo Puigdefabregas 2023-06-21 12:48:36 +02:00
parent 94ddc76e17
commit 945c0d42f9
2 changed files with 8 additions and 8 deletions

View file

@ -23,13 +23,13 @@ _sorted_proofs = {'order_by': lambda: Proof.created, 'collection_class': SortedS
class Proof(Thing): class Proof(Thing):
id = Column(BigInteger, Sequence('device_seq'), primary_key=True) id = Column(BigInteger, Sequence('proof_seq'), primary_key=True)
id.comment = """The identifier of the device for this database. Used only id.comment = """The identifier of the device for this database. Used only
internally for software; users should not use this.""" internally for software; users should not use this."""
documentId = Column(CIText(), nullable=True) documentId = Column(CIText(), nullable=True)
documentId.comment = "is the hash of snapshot.json_wb" documentId.comment = "is the uuid of snapshot"
documentSignature = Column(CIText(), nullable=True) documentSignature = Column(CIText(), nullable=True)
documentSignature.comment = "is the snapshot.json_wb with the signature of the user" documentSignature.comment = "is the snapshot.json_hw with the signature of the user"
timestamp = Column(BigInteger, nullable=False) timestamp = Column(BigInteger, nullable=False)
type = Column(Unicode(STR_SM_SIZE), nullable=False) type = Column(Unicode(STR_SM_SIZE), nullable=False)
@ -69,13 +69,13 @@ class Dpp(Thing):
""" """
id = Column(BigInteger, Sequence('device_seq'), primary_key=True) id = Column(BigInteger, Sequence('dpp_seq'), primary_key=True)
key = Column(CIText(), nullable=False) key = Column(CIText(), nullable=False)
key.comment = "chid:phid, (chid it's in device and phid it's in the snapshot)" key.comment = "chid:phid, (chid it's in device and phid it's in the snapshot)"
documentId = Column(CIText(), nullable=True) documentId = Column(CIText(), nullable=True)
documentId.comment = "is the hash of snapshot.json_wb" documentId.comment = "is the uuid of snapshot"
documentSignature = Column(CIText(), nullable=True) documentSignature = Column(CIText(), nullable=True)
documentSignature.comment = "is the snapshot.json_wb with the signature of the user" documentSignature.comment = "is the snapshot.json_hw with the signature of the user"
timestamp = Column(BigInteger, nullable=False) timestamp = Column(BigInteger, nullable=False)
issuer_id = Column( issuer_id = Column(

View file

@ -513,7 +513,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
from ereuse_devicehub.modules.dpp.models import PROOF_ENUM, Proof from ereuse_devicehub.modules.dpp.models import PROOF_ENUM, Proof
deviceCHID = self.device.chid deviceCHID = self.device.chid
docSig = hashlib.sha3_256(self.snapshot.json_wb.encode('utf-8')).hexdigest() docSig = self.snapshot.phid_dpp
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']
@ -897,7 +897,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
return return
api = API(api_dlt, token_dlt, "ethereum") api = API(api_dlt, token_dlt, "ethereum")
docSig = hashlib.sha3_256(self.json_wb.encode('utf-8')).hexdigest() docSig = self.phid_dpp
docID = "{}".format(self.uuid or '') docID = "{}".format(self.uuid or '')
issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id) issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id)