Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow signing via digest #5

Merged
merged 2 commits into from
Mar 17, 2024
Merged

allow signing via digest #5

merged 2 commits into from
Mar 17, 2024

Conversation

mcallistersean
Copy link
Contributor

This adds another kw argument to the sign method that allows signing using the message digest.
This allows for usage of the library without having the full message/binary file.

Copy link
Member

@kislyuk kislyuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but please compare message to None explicitly instead of relying on it to be truthy.

hasher.update(message)
digest = hasher.digest()

if message:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if message is an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, there are some corner cases to be considered here. I added more is None checks.

@kislyuk kislyuk merged commit 9966a0c into pyauth:main Mar 17, 2024
2 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants