From 945c0d42f9c7d134551e9cc215281182b6f57e4a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 21 Jun 2023 12:48:36 +0200 Subject: [PATCH] fix, phid_dpp instead of json_wb --- ereuse_devicehub/modules/dpp/models.py | 12 ++++++------ ereuse_devicehub/resources/action/models.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ereuse_devicehub/modules/dpp/models.py b/ereuse_devicehub/modules/dpp/models.py index 9b9cd55a..038abcfc 100644 --- a/ereuse_devicehub/modules/dpp/models.py +++ b/ereuse_devicehub/modules/dpp/models.py @@ -23,13 +23,13 @@ _sorted_proofs = {'order_by': lambda: Proof.created, 'collection_class': SortedS 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 internally for software; users should not use this.""" 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.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) 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.comment = "chid:phid, (chid it's in device and phid it's in the snapshot)" 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.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) issuer_id = Column( diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index ec47f25c..a8dac9e3 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -513,7 +513,7 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): from ereuse_devicehub.modules.dpp.models import PROOF_ENUM, Proof 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 '') issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id) proof_type = PROOF_ENUM['Erase'] @@ -897,7 +897,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice): return 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 '') issuerID = "{dh}:{user}".format(dh=dh_instance, user=g.user.id)