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

Deprecate encoder in signining #523

Closed
wants to merge 11 commits into from

Conversation

lmctv
Copy link
Contributor

@lmctv lmctv commented Apr 13, 2019

Revert #504 and deprecate usage of the encoder= parameter in high level signing APIs, as suggested by @reaperhulk in his review of #507.
If we decide to follow this route, I think we should do the same for the other high level APIs too.
Since this is a potentially disruptive change for downstream users, I'd be grateful if also @dstufft could give his opinion on these changes.

@lmctv
Copy link
Contributor Author

lmctv commented Apr 13, 2019

@reaperhulk I think it makes sense, if we are willing to "just deal with bytes" in the long term, to just begin deprecating all the encoder= APIs, instead of doing a step just deprecating non-raw encoders.

@lmctv
Copy link
Contributor Author

lmctv commented May 7, 2019

@dstufft , @reaperhulk , @pyca/pynacl-core: could someone take a look at this to push it forward?

@lmctv
Copy link
Contributor Author

lmctv commented May 17, 2019

@dstufft @reaperhulk @pyca/pynacl-core ping

src/nacl/signing.py Outdated Show resolved Hide resolved
src/nacl/signing.py Outdated Show resolved Hide resolved
@@ -101,13 +116,27 @@ def verify(self, smessage, signature=None, encoder=encoding.RawEncoder):
signature.
:rtype: :class:`bytes`
"""
if len(args) == 1:
Copy link
Member

Choose a reason for hiding this comment

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

Same comment about the approach.

src/nacl/signing.py Outdated Show resolved Hide resolved
def __init__(self, seed, encoder=encoding.RawEncoder):
def __init__(self, seed, *args, **kwargs):

if len(args) == 1:
Copy link
Member

Choose a reason for hiding this comment

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

Same

src/nacl/signing.py Outdated Show resolved Hide resolved
src/nacl/signing.py Outdated Show resolved Hide resolved
src/nacl/signing.py Outdated Show resolved Hide resolved
tests/test_signing.py Show resolved Hide resolved
@lmctv lmctv requested a review from reaperhulk May 18, 2019 16:39
@pytest.mark.parametrize("hseed", [
b"77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a",
])
def test_raising_on_excess_encoder_parameter(self, hseed):
Copy link
Member

Choose a reason for hiding this comment

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

These tests aren't really testing anything interesting with the new approach, correct?

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, they were redundant. Reverted the relevant commit.

Since, after a75cb45,
those test are redundant.
@lmctv lmctv changed the title RFC Deprecate encoder in signining Deprecate encoder in signining May 25, 2019
@lmctv
Copy link
Contributor Author

lmctv commented May 25, 2019

@reaperhulk I hope this is now ready for another review.

@lmctv
Copy link
Contributor Author

lmctv commented Jun 3, 2019

@reaperhulk ping.

@lmctv
Copy link
Contributor Author

lmctv commented Jun 15, 2019

@reaperhulk Would you mind another review cycle and possibly merge this? I'd rather avoid preparing the encoder= pre-deprecation warning PR on un-reverted #504 signing documentation.

@lmctv
Copy link
Contributor Author

lmctv commented Jun 22, 2019

@reaperhulk could you please take a look here and at the proposed plan for a quick release I outlined in #532 (comment)

if encoder is None:
encoder = encoding.RawEncoder
else:
warn(("Implicit encoding/decoding of signing keys "
Copy link
Member

Choose a reason for hiding this comment

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

We should just say encoding/decoding of signing keys is deprecated. Remove the words explicit and implicit from this msg.

if encoder is None:
encoder = encoding.RawEncoder
else:
warn(("Automatic encoding/decoding of signed messages "
Copy link
Member

Choose a reason for hiding this comment

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

This should be the same message (or better yet, this should be a function that everything invokes)

if signature is not None:
# If we were given the message and signature separately, combine
# them.
smessage = signature + encoder.decode(smessage)
Copy link
Member

Choose a reason for hiding this comment

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

Can we quickly pull this revert into its own PR so we can land that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just reopened the Revert PR #505, and rebased it on current master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, #505 was kept in the Closed PR list. Just created #545 from the same branch.

if encoder is None:
encoder = encoding.RawEncoder
else:
warn(("Implicit encoding/decoding of signing keys "
Copy link
Member

Choose a reason for hiding this comment

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

Same

if encoder is None:
encoder = encoding.RawEncoder
else:
warn(("Automatic encoding/decoding of signed messages "
Copy link
Member

Choose a reason for hiding this comment

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

Same

@reaperhulk
Copy link
Member

We should still deprecate encoder but we can open a PR for it at some point.

@reaperhulk reaperhulk closed this Aug 10, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants