Skip to content
Snippets Groups Projects
Commit 5a235579 authored by Patricio Kumagae's avatar Patricio Kumagae
Browse files

Comments

parent 65fd7aba
No related branches found
No related tags found
No related merge requests found
...@@ -15,4 +15,5 @@ class Utils(): ...@@ -15,4 +15,5 @@ class Utils():
@staticmethod @staticmethod
def get_proof_hash(file_hash): def get_proof_hash(file_hash):
#El proof se genera con los hashes sha256 de (archivo original+timestamp+dirección de la cuenta) + versión del contrato
return Utils.sha256_encode(str(file_hash + Utils.sha256_encode(str(int(time.time()))) + Utils.sha256_encode(ACCOUNT_ADDRESS))) + CURRENT_CONTRACT_VERSION return Utils.sha256_encode(str(file_hash + Utils.sha256_encode(str(int(time.time()))) + Utils.sha256_encode(ACCOUNT_ADDRESS))) + CURRENT_CONTRACT_VERSION
...@@ -40,6 +40,7 @@ class Stamp(APIView): ...@@ -40,6 +40,7 @@ class Stamp(APIView):
tx_hash = TimestampManager.stamp(proof_hash, file_hash) tx_hash = TimestampManager.stamp(proof_hash, file_hash)
#Al proof se le agrega la transacción para poder verificar luego si está pendiente de subida
proof = proof_hash + '-' + tx_hash.hex() proof = proof_hash + '-' + tx_hash.hex()
return Response({_('status'): _('success'), _('proof'): base64.b64encode(proof.encode('utf-8')).decode('utf-8')}, status=status.HTTP_200_OK) return Response({_('status'): _('success'), _('proof'): base64.b64encode(proof.encode('utf-8')).decode('utf-8')}, status=status.HTTP_200_OK)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment