Merge branch 'master' into 64-data-to-disk

This commit is contained in:
Sergi Delgado Segura
2020-01-15 12:44:29 +01:00
19 changed files with 1075 additions and 329 deletions

View File

@@ -1,4 +1,5 @@
import re
from common.constants import LOCATOR_LEN_HEX
def check_sha256_hex_format(value):
@@ -12,3 +13,15 @@ def check_sha256_hex_format(value):
:mod:`bool`: Whether or not the value matches the format.
"""
return isinstance(value, str) and re.match(r"^[0-9A-Fa-f]{64}$", value) is not None
def compute_locator(tx_id):
"""
Computes an appointment locator given a transaction id.
Args:
tx_id (:obj:`str`): the transaction id used to compute the locator.
Returns:
(:obj:`str`): The computed locator.
"""
return tx_id[:LOCATOR_LEN_HEX]