mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 06:04:21 +01:00
Moves (and renames) check_user_pk to common so cli can use it too. Fixes the regex so it only accepts {02, 03} as prefix
This commit is contained in:
@@ -1,10 +1,23 @@
|
||||
import re
|
||||
import os
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from common.constants import LOCATOR_LEN_HEX
|
||||
|
||||
|
||||
def check_compressed_pk_format(compressed_pk):
|
||||
"""
|
||||
Checks if a given value is a 33-byte hex encoded string.
|
||||
|
||||
Args:
|
||||
compressed_pk(:obj:`str`): the value to be checked.
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: Whether or not the value matches the format.
|
||||
"""
|
||||
|
||||
return isinstance(compressed_pk, str) and re.match(r"^0[2-3][0-9A-Fa-f]{64}$", compressed_pk) is not None
|
||||
|
||||
|
||||
def check_sha256_hex_format(value):
|
||||
"""
|
||||
Checks if a given value is a 32-byte hex encoded string.
|
||||
|
||||
Reference in New Issue
Block a user