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

Merge branch 'desarrollo'

parents f75113cb ffdd2bfa
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,7 @@ class Verify(APIView): ...@@ -93,7 +93,7 @@ class Verify(APIView):
if not request.data.get('rd'): if not request.data.get('rd'):
raise ValidationError('rd') raise ValidationError('rd')
file_hash = request.data.get('file_hash') original_file_hash = request.data.get('file_hash')
base64_ots = request.data.get('rd') base64_ots = request.data.get('rd')
ots = base64.b64decode(base64_ots).decode('utf-8') ots = base64.b64decode(base64_ots).decode('utf-8')
...@@ -111,7 +111,7 @@ class Verify(APIView): ...@@ -111,7 +111,7 @@ class Verify(APIView):
tx_ots_hash = args[0].decode('utf-8') tx_ots_hash = args[0].decode('utf-8')
tx_file_hash = args[1].decode('utf-8') tx_file_hash = args[1].decode('utf-8')
if tx_ots_hash == ots_hash and tx_file_hash == file_hash: if tx_ots_hash == ots_hash and tx_file_hash == original_file_hash:
block = TimestampManager.get_block(int(block_number)) block = TimestampManager.get_block(int(block_number))
...@@ -132,15 +132,15 @@ class Verify(APIView): ...@@ -132,15 +132,15 @@ class Verify(APIView):
contract_version = ots_hash[-2:] contract_version = ots_hash[-2:]
verified = TimestampManager.verify(contract_version, ots_hash, file_hash) verified = TimestampManager.verify(contract_version, ots_hash, original_file_hash)
if verified: if verified:
block_number = TimestampManager.get_block_number(contract_version, ots_hash) block_number = TimestampManager.get_block_number(contract_version, ots_hash)
block = TimestampManager.get_block(block_number) block = TimestampManager.get_block(block_number)
permanent_ots = PERMANENT_OTS_PREFIX + '-' + file_hash + '-' + ots_hash + '-' + tx_hash + '-' + str(block_number) permanent_ots = PERMANENT_OTS_PREFIX + '-' + original_file_hash + '-' + ots_hash + '-' + tx_hash + '-' + str(block_number)
return Response({_('status'): _('success'), _('permanent_ots'): base64.b64encode(permanent_ots.encode('utf-8')).decode('utf-8') ,_('messages'): _('file_uploaded') % (file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp)))},status=status.HTTP_200_OK) return Response({_('status'): _('success'), _('permanent_ots'): base64.b64encode(permanent_ots.encode('utf-8')).decode('utf-8') ,_('messages'): _('file_uploaded') % (original_file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp)))},status=status.HTTP_200_OK)
else: else:
try: try:
transaction = TimestampManager.get_transaction(tx_hash) transaction = TimestampManager.get_transaction(tx_hash)
......
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