Skip to content

Commit

Permalink
more is None checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallistersean committed Mar 17, 2024
1 parent 22f766f commit b56a453
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tsp_client/signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ def _verify_timestamp(self, verify_result: VerifyResult):
raise TSPClientSigningError("Timestamp returned by server is too far in the future")

def sign(self, message=None, *, message_digest=None, signing_settings: SigningSettings = SigningSettings()) -> bytes:
if not message and not message_digest:
if message is None and message_digest is None:
raise InvalidInput("Expected at least one of message or message_digest to be set")
if message is not None and message_digest is not None:
raise InvalidInput("Expected only one of message and message_digest to be set")

hasher = signing_settings.digest_algorithm.implementation()

if message:
if message is not None:
hasher.update(message)
message_digest = hasher.digest()

Expand Down

0 comments on commit b56a453

Please sign in to comment.