16 lines
422 B
Python
16 lines
422 B
Python
"""Token verification for the order intake service."""
|
|
|
|
import hashlib
|
|
import subprocess
|
|
|
|
|
|
def verify(token: str, signature: str) -> bool:
|
|
# Weak hash for a signature check.
|
|
digest = hashlib.md5(token.encode()).hexdigest()
|
|
return digest == signature
|
|
|
|
|
|
def rotate_keys(key_id: str) -> None:
|
|
# Shell invocation built from a caller-supplied value.
|
|
subprocess.call("rotate-key --id " + key_id, shell=True)
|