Repository navigation
feat: deprecation warning for the Kyber classes (WP-6) - #38
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WP-6 for #14 (part of #3). Please do not auto-close #14 from this PR.
The first use of any Kyber512, Kyber768 or Kyber1024 entry point (constructor, from_keys, static encapsulate, static decapsulate) now emits one KyberDeprecationWarning per process. The class is a DeprecationWarning subclass in a new module, python/pykyber/deprecation.py, and is exported from pykyber and listed in all. Importing pykyber warns nothing, ML_KEM* never warns, and python/pykyber/_mlkem.py is untouched. Kyber output is unchanged.
The warning goes through a small decorator applied to the twelve entry points in _kyber.py. "Once per process" is a module-level flag guarded by a lock, so the default per-location registry cannot repeat it and two threads cannot both warn. stacklevel is a named constant (3: the helper, the decorator's wrapper, then the user's call). The message says Kyber (round 3) and ML-KEM are not interoperable, that both sides must switch, that switching changes the shared secret, and links https://github.com/Zikithezikit/pykyber/blob/main/docs/migration.md. Issue #15 needs to create exactly docs/migration.md, since that URL is in the message now.
Commits
Verified (how)
Sources checked
Believed, not verified
Out of scope
PR checklist
Generated with Claude Code