Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _signature_from_bytes(signature: BLSSignature) -> Signature:
try:
return Signature.from_bytes(signature)
except (RuntimeError, ValueError) as error:
raise ValidationError(f"Bad signature: {signature}, {error}")