

def _decode_signed_value_v1(secret, name, value, max_age_days, clock):
    parts = utf8(value).split(b'|')
    if (len(parts) != 3):
        return None
    signature = _create_signature_v1(secret, name, parts[0], parts[1])
    if (not _time_independent_equals(parts[2], signature)):
        gen_log.warning('Invalid cookie signature %r', value)
        return None
    timestamp = int(parts[1])
    if (timestamp < (clock() - (max_age_days * 86400))):
        gen_log.warning('Expired cookie %r', value)
        return None
    if (timestamp > (clock() + (31 * 86400))):
        gen_log.warning('Cookie timestamp in future; possible tampering %r', value)
        return None
    if parts[1].startswith(b'0'):
        gen_log.warning('Tampered cookie %r', value)
        return None
    try:
        return base64.b64decode(parts[0])
    except Exception:
        return None

dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/web.py _decode_signed_value_v1/original