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

fix(api): resolve type unsafety of redundant params in KEX protocol inits #5

Closed
rmlibre opened this issue Jun 21, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@rmlibre
Copy link
Owner

rmlibre commented Jun 21, 2024

Description

The __init__ of key exchange protocol classes called by X25519 accept a key_exchange_type key-word argument &, for all except the 2DH client class, a my_identity_key argument. However, the latter is always an instance of the former. This is an API mistake, as accepting both is redundant & facilitates inconsistencies / type unsafety.

Links to relevant files:

Expected behavior

The DoubleDiffieHellmanClient, DoubleDiffieHellmanServer, TripleDiffieHellmanClient, & TripleDiffieHellmanServer classes should be instantiable after accepting the argument of either key_exchange_type, or an instance of that type as my_identity_key, but not both. Types should be checked with protocols from the Typing class.

@rmlibre rmlibre added the bug Something isn't working label Jun 21, 2024
@rmlibre rmlibre self-assigned this Jun 21, 2024
@rmlibre
Copy link
Owner Author

rmlibre commented Jun 21, 2024

Resolved by (714754d)

Changes to Protocol classes in aiootp/_typing/_keygens.py were necessary to allow type-checking during runtime.

Tests for the changes were added to tests/test_X25519_Ed25519.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant