Skip to content

Comprehensive typing pass - #25

Merged
ikreymer merged 7 commits into
mainfrom
typing-work
Sep 9, 2026
Merged

ikreymer merged 7 commits into
mainfrom
typing-work

Conversation

@ikreymer

Copy link
Copy Markdown
Member

Ended up doing a fairly comprehensive typing pass on the codebase. Fixes #10

@ikreymer
ikreymer requested a review from mistydemeo August 30, 2026 01:59
Comment thread authsign/acme_signer.py
@contextmanager
def challenge_server(self, http_01_resources):
def challenge_server(
self, http_01_resources: set[standalone.HTTP01RequestHandler.HTTP01Resource]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Huh, this is revealing to me that we've been taking a set this whole time despite exclusively calling it with a single-element set (in perform_http01, below). Is that... correct? Is that what we've been meaning to do?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, the set is required by the internal api, but we're specifically allowing one http-based challenge for this. Suppose can move this lower into the api.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Although, not sure its worth a breaking change to remove the set from the param 🤷

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm yeah, if it's part of the public API then we shouldn't change it.

Comment thread authsign/crypto.py


def sign(data, private_key):
def sign(data: str, private_key: ec.EllipticCurvePrivateKey) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, it looks like we only ever pass test data here. Should we just have been passing bytestrings the whole time rather than converting str to bytes in here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's just testing the signing immediately when the key is loaded just in case -- we call this with the hash that's passed in from the SignReq model as part of the sign request:
see: https://github.com/webrecorder/authsign/blob/main/authsign/signer.py#L326

Comment thread authsign/main.py Outdated
Comment thread authsign/signer.py Outdated
@ikreymer
ikreymer merged commit 633f268 into main Sep 9, 2026
2 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.

Add typing + mypy checking

2 participants