Skip to content

Conversation

@pquentin
Copy link
Member

@pquentin pquentin commented Oct 30, 2019

Part of my work on urllib3/urllib3#1705. The goal is to start using trustme more in urllib3, but by doing it gradually, and only switch to a trustme-generated CA at the end of the process.

@codecov
Copy link

codecov bot commented Oct 30, 2019

Codecov Report

Merging #107 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #107   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines         359    371   +12     
  Branches       23     23           
=====================================
+ Hits          359    371   +12
Impacted Files Coverage Δ
tests/test_trustme.py 100% <100%> (ø) ⬆️
trustme/__init__.py 100% <100%> (ø) ⬆️

@pquentin pquentin requested a review from njsmith October 30, 2019 19:13

Returns:
CA: the newly-generated certificate authority
"""
Copy link
Member

Choose a reason for hiding this comment

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

Does this show up in the docs automatically, or do we need to add it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean the Returns part? It shows up like this in the docs:

Capture d’écran 2019-10-31 à 08 48 01

Without it, this part disappears

Copy link
Member

Choose a reason for hiding this comment

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

Oh no, I meant the whole docstring :-). That answers the question though!

.format(ctx.__class__.__name__))

@classmethod
def from_pem(cls, cert_path, private_key_path):
Copy link
Member

Choose a reason for hiding this comment

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

Taking paths limits this to certs that are stored in files on disk, which is kind of an arbitrary limitation. Maybe it should accept the actual PEM data instead? (Or file objects, but that feels unnecessarily complicated when we're talking about data that's a few kilobytes at most.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. This is up to you! I can accept trustme.Blobs, or bytes, or file-like objects

Copy link
Member Author

Choose a reason for hiding this comment

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

(My reasoning was that if you use from_pem then you're likely to have the files on disk, but well, this kind of thinking led to only accept certificates on disks in many APIs, so it's flawed indeed)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've implemented the bytes option. It certainly simplifies the code! Please take another look.

@pquentin
Copy link
Member Author

Thank you for the quick review! 💯

@njsmith njsmith merged commit a50b6e7 into python-trio:master Oct 31, 2019
@njsmith
Copy link
Member

njsmith commented Oct 31, 2019

Thanks!

Should I give you pypi rights so you can roll a release? What's your pypi name?

@pquentin
Copy link
Member Author

Thank you! Yes, I'd like to roll a release. Here's my PyPI account: https://pypi.org/user/quentinp/

@njsmith
Copy link
Member

njsmith commented Oct 31, 2019 via email

@pquentin
Copy link
Member Author

Thank you! 0.5.3 is out with this change.

@pquentin pquentin deleted the ca-from-pem branch October 31, 2019 08:17
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